commit e3bc760df85ead53d26ec7bcc97256330ab014e4 Author: Marius Mutu Date: Thu Jul 9 21:57:44 2026 +0300 Initial commit — sursa ROAAUTO diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4e5f376 --- /dev/null +++ b/.gitignore @@ -0,0 +1,48 @@ +# Visual FoxPro - fisiere compilate +*.fxp +*.mpx + +# Visual FoxPro - backup-uri +*.bak +*.BAK +*.TBK + +# Visual FoxPro - meniuri generate (din .mnx) +*.mpr +*.MPR + +# Visual FoxPro - log-uri si erori +*.ERR +*.err +log.txt +LOG.txt + +# Visual FoxPro - fisiere temporare +*.tmp +*.TMP +*.dct +*.DCT + +# Executabile compilate +*.exe +*.EXE + +# SVN (proiectul foloseste SVN, nu git, pentru COMUN) +.svn/ + +# COMUN este gestionat separat prin SVN +COMUN/ + +# Windows +*.lnk +Thumbs.db +Desktop.ini +bash.exe.stackdump + +# FoxPro runtime index-uri auto-generate (pastrate doar daca sunt sursa) +# Comenteaza liniile de mai jos daca .cdx/.idx sunt fisiere sursa intentionate +# *.cdx +# *.idx +FoxyPreviewer_Emails.CDX +FoxyPreviewer_Emails.DBF +FoxyPreviewer_Emails.FPT diff --git a/Clase/2707oviz_devize.VCT b/Clase/2707oviz_devize.VCT new file mode 100644 index 0000000..555a4a4 Binary files /dev/null and b/Clase/2707oviz_devize.VCT differ diff --git a/Clase/2707oviz_devize.vcx b/Clase/2707oviz_devize.vcx new file mode 100644 index 0000000..e8162ec Binary files /dev/null and b/Clase/2707oviz_devize.vcx differ diff --git a/Clase/Backup/ferestrebaza0109.VCT b/Clase/Backup/ferestrebaza0109.VCT new file mode 100644 index 0000000..e02d58d Binary files /dev/null and b/Clase/Backup/ferestrebaza0109.VCT differ diff --git a/Clase/Backup/ferestrebaza0109.vcx b/Clase/Backup/ferestrebaza0109.vcx new file mode 100644 index 0000000..e08c601 Binary files /dev/null and b/Clase/Backup/ferestrebaza0109.vcx differ diff --git a/Clase/Backup/oviz_devize.VCT b/Clase/Backup/oviz_devize.VCT new file mode 100644 index 0000000..2bf90f0 Binary files /dev/null and b/Clase/Backup/oviz_devize.VCT differ diff --git a/Clase/Backup/oviz_devize.VCT.r426 b/Clase/Backup/oviz_devize.VCT.r426 new file mode 100644 index 0000000..b908883 Binary files /dev/null and b/Clase/Backup/oviz_devize.VCT.r426 differ diff --git a/Clase/Backup/oviz_devize.VCT.r704 b/Clase/Backup/oviz_devize.VCT.r704 new file mode 100644 index 0000000..5c1d6e8 Binary files /dev/null and b/Clase/Backup/oviz_devize.VCT.r704 differ diff --git a/Clase/Backup/oviz_devize.vcx b/Clase/Backup/oviz_devize.vcx new file mode 100644 index 0000000..dd15456 Binary files /dev/null and b/Clase/Backup/oviz_devize.vcx differ diff --git a/Clase/Backup/oviz_devize.vcx.r426 b/Clase/Backup/oviz_devize.vcx.r426 new file mode 100644 index 0000000..c64d4ee Binary files /dev/null and b/Clase/Backup/oviz_devize.vcx.r426 differ diff --git a/Clase/Backup/oviz_devize.vcx.r704 b/Clase/Backup/oviz_devize.vcx.r704 new file mode 100644 index 0000000..3fe0701 Binary files /dev/null and b/Clase/Backup/oviz_devize.vcx.r704 differ diff --git a/Clase/Backup/oviz_devize_1901.VCT b/Clase/Backup/oviz_devize_1901.VCT new file mode 100644 index 0000000..2e37a90 Binary files /dev/null and b/Clase/Backup/oviz_devize_1901.VCT differ diff --git a/Clase/Backup/oviz_devize_1901.vcx b/Clase/Backup/oviz_devize_1901.vcx new file mode 100644 index 0000000..0de9f6b Binary files /dev/null and b/Clase/Backup/oviz_devize_1901.vcx differ diff --git a/Clase/citeste.txt b/Clase/citeste.txt new file mode 100644 index 0000000..63eab3b --- /dev/null +++ b/Clase/citeste.txt @@ -0,0 +1 @@ +2707oviz_devize.vcx : am pus diacritice pe toate labelurile, doar ca la salvarea nu mi le retine, iar in loc de t imi pune _ in unele \ No newline at end of file diff --git a/Clase/ferestrebaza.VCT b/Clase/ferestrebaza.VCT new file mode 100644 index 0000000..e02d58d Binary files /dev/null and b/Clase/ferestrebaza.VCT differ diff --git a/Clase/ferestrebaza.vcx b/Clase/ferestrebaza.vcx new file mode 100644 index 0000000..e08c601 Binary files /dev/null and b/Clase/ferestrebaza.vcx differ diff --git a/Clase/odevize.VCT b/Clase/odevize.VCT new file mode 100644 index 0000000..fd3fb0b Binary files /dev/null and b/Clase/odevize.VCT differ diff --git a/Clase/odevize.vcx b/Clase/odevize.vcx new file mode 100644 index 0000000..bfb0358 Binary files /dev/null and b/Clase/odevize.vcx differ diff --git a/Clase/ofundal_dev.VCT b/Clase/ofundal_dev.VCT new file mode 100644 index 0000000..d6e1f03 Binary files /dev/null and b/Clase/ofundal_dev.VCT differ diff --git a/Clase/ofundal_dev.vcx b/Clase/ofundal_dev.vcx new file mode 100644 index 0000000..a45103f Binary files /dev/null and b/Clase/ofundal_dev.vcx differ diff --git a/Clase/onom_devize.VCT b/Clase/onom_devize.VCT new file mode 100644 index 0000000..45aab36 Binary files /dev/null and b/Clase/onom_devize.VCT differ diff --git a/Clase/onom_devize.vcx b/Clase/onom_devize.vcx new file mode 100644 index 0000000..8cfc941 Binary files /dev/null and b/Clase/onom_devize.vcx differ diff --git a/Clase/oviz_devize.VCT b/Clase/oviz_devize.VCT new file mode 100644 index 0000000..6a4f1a6 Binary files /dev/null and b/Clase/oviz_devize.VCT differ diff --git a/Clase/oviz_devize.vcx b/Clase/oviz_devize.vcx new file mode 100644 index 0000000..28e94d6 Binary files /dev/null and b/Clase/oviz_devize.vcx differ diff --git a/Ferestre/frm_date_comenzi.SCT b/Ferestre/frm_date_comenzi.SCT new file mode 100644 index 0000000..1fbe2a2 Binary files /dev/null and b/Ferestre/frm_date_comenzi.SCT differ diff --git a/Ferestre/frm_date_comenzi.scx b/Ferestre/frm_date_comenzi.scx new file mode 100644 index 0000000..5500527 Binary files /dev/null and b/Ferestre/frm_date_comenzi.scx differ diff --git a/Ferestre/fundal.SCT b/Ferestre/fundal.SCT new file mode 100644 index 0000000..cbc5128 Binary files /dev/null and b/Ferestre/fundal.SCT differ diff --git a/Ferestre/fundal.scx b/Ferestre/fundal.scx new file mode 100644 index 0000000..a0444cd Binary files /dev/null and b/Ferestre/fundal.scx differ diff --git a/Formulare/AUTOHAUS/20070911/sigla.jpg b/Formulare/AUTOHAUS/20070911/sigla.jpg new file mode 100644 index 0000000..e5c97e9 Binary files /dev/null and b/Formulare/AUTOHAUS/20070911/sigla.jpg differ diff --git a/Formulare/AUTOHAUS/20070911/usr_fact_cuchit.FRT b/Formulare/AUTOHAUS/20070911/usr_fact_cuchit.FRT new file mode 100644 index 0000000..19a3834 Binary files /dev/null and b/Formulare/AUTOHAUS/20070911/usr_fact_cuchit.FRT differ diff --git a/Formulare/AUTOHAUS/20070911/usr_fact_cuchit.frx b/Formulare/AUTOHAUS/20070911/usr_fact_cuchit.frx new file mode 100644 index 0000000..10ba24c Binary files /dev/null and b/Formulare/AUTOHAUS/20070911/usr_fact_cuchit.frx differ diff --git a/Formulare/AUTOHAUS/20070911/usr_fact_farachit.FRT b/Formulare/AUTOHAUS/20070911/usr_fact_farachit.FRT new file mode 100644 index 0000000..6ba0127 Binary files /dev/null and b/Formulare/AUTOHAUS/20070911/usr_fact_farachit.FRT differ diff --git a/Formulare/AUTOHAUS/20070911/usr_fact_farachit.frx b/Formulare/AUTOHAUS/20070911/usr_fact_farachit.frx new file mode 100644 index 0000000..6655c7a Binary files /dev/null and b/Formulare/AUTOHAUS/20070911/usr_fact_farachit.frx differ diff --git a/Formulare/AUTOHAUS/20070911/usr_factav_cuchit.FRT b/Formulare/AUTOHAUS/20070911/usr_factav_cuchit.FRT new file mode 100644 index 0000000..7793b93 Binary files /dev/null and b/Formulare/AUTOHAUS/20070911/usr_factav_cuchit.FRT differ diff --git a/Formulare/AUTOHAUS/20070911/usr_factav_cuchit.frx b/Formulare/AUTOHAUS/20070911/usr_factav_cuchit.frx new file mode 100644 index 0000000..21e9f8a Binary files /dev/null and b/Formulare/AUTOHAUS/20070911/usr_factav_cuchit.frx differ diff --git a/Formulare/AUTOHAUS/20070911/usr_factav_farachit.FRT b/Formulare/AUTOHAUS/20070911/usr_factav_farachit.FRT new file mode 100644 index 0000000..9f68dd5 Binary files /dev/null and b/Formulare/AUTOHAUS/20070911/usr_factav_farachit.FRT differ diff --git a/Formulare/AUTOHAUS/20070911/usr_factav_farachit.frx b/Formulare/AUTOHAUS/20070911/usr_factav_farachit.frx new file mode 100644 index 0000000..ebe1f93 Binary files /dev/null and b/Formulare/AUTOHAUS/20070911/usr_factav_farachit.frx differ diff --git a/Formulare/AUTOHAUS/20070911/usr_rap_deviz.FRT b/Formulare/AUTOHAUS/20070911/usr_rap_deviz.FRT new file mode 100644 index 0000000..8e05611 Binary files /dev/null and b/Formulare/AUTOHAUS/20070911/usr_rap_deviz.FRT differ diff --git a/Formulare/AUTOHAUS/20070911/usr_rap_deviz.frx b/Formulare/AUTOHAUS/20070911/usr_rap_deviz.frx new file mode 100644 index 0000000..b0c367b Binary files /dev/null and b/Formulare/AUTOHAUS/20070911/usr_rap_deviz.frx differ diff --git a/Formulare/AUTOHAUS/A4usr_fact_farachit.FRT b/Formulare/AUTOHAUS/A4usr_fact_farachit.FRT new file mode 100644 index 0000000..de0e13f Binary files /dev/null and b/Formulare/AUTOHAUS/A4usr_fact_farachit.FRT differ diff --git a/Formulare/AUTOHAUS/A4usr_fact_farachit.frx b/Formulare/AUTOHAUS/A4usr_fact_farachit.frx new file mode 100644 index 0000000..1075ce5 Binary files /dev/null and b/Formulare/AUTOHAUS/A4usr_fact_farachit.frx differ diff --git a/Formulare/AUTOHAUS/A4usr_factav_farachit.FRT b/Formulare/AUTOHAUS/A4usr_factav_farachit.FRT new file mode 100644 index 0000000..f08be88 Binary files /dev/null and b/Formulare/AUTOHAUS/A4usr_factav_farachit.FRT differ diff --git a/Formulare/AUTOHAUS/A4usr_factav_farachit.frx b/Formulare/AUTOHAUS/A4usr_factav_farachit.frx new file mode 100644 index 0000000..896c154 Binary files /dev/null and b/Formulare/AUTOHAUS/A4usr_factav_farachit.frx differ diff --git a/Formulare/FRUVIMED/fruvimed 20070830.tif b/Formulare/FRUVIMED/fruvimed 20070830.tif new file mode 100644 index 0000000..ca971bb Binary files /dev/null and b/Formulare/FRUVIMED/fruvimed 20070830.tif differ diff --git a/Formulare/GGMOTORS/usr__preco.FRT b/Formulare/GGMOTORS/usr__preco.FRT new file mode 100644 index 0000000..18c26fc Binary files /dev/null and b/Formulare/GGMOTORS/usr__preco.FRT differ diff --git a/Formulare/GGMOTORS/usr__preco.frx b/Formulare/GGMOTORS/usr__preco.frx new file mode 100644 index 0000000..36aeebe Binary files /dev/null and b/Formulare/GGMOTORS/usr__preco.frx differ diff --git a/Formulare/SIGMA/usr_fact_cuchit_l.FRT b/Formulare/SIGMA/usr_fact_cuchit_l.FRT new file mode 100644 index 0000000..c187ea3 Binary files /dev/null and b/Formulare/SIGMA/usr_fact_cuchit_l.FRT differ diff --git a/Formulare/SIGMA/usr_fact_cuchit_l.frx b/Formulare/SIGMA/usr_fact_cuchit_l.frx new file mode 100644 index 0000000..f8bbbbd Binary files /dev/null and b/Formulare/SIGMA/usr_fact_cuchit_l.frx differ diff --git a/Formulare/SIGMA/usr_fact_farachit_l.FRT b/Formulare/SIGMA/usr_fact_farachit_l.FRT new file mode 100644 index 0000000..f7d0f8e Binary files /dev/null and b/Formulare/SIGMA/usr_fact_farachit_l.FRT differ diff --git a/Formulare/SIGMA/usr_fact_farachit_l.frx b/Formulare/SIGMA/usr_fact_farachit_l.frx new file mode 100644 index 0000000..d026208 Binary files /dev/null and b/Formulare/SIGMA/usr_fact_farachit_l.frx differ diff --git a/Formulare/test_listare_factura/ACTACTAN.DBF b/Formulare/test_listare_factura/ACTACTAN.DBF new file mode 100644 index 0000000..4647a80 Binary files /dev/null and b/Formulare/test_listare_factura/ACTACTAN.DBF differ diff --git a/Formulare/test_listare_factura/FOXUSER.DBF b/Formulare/test_listare_factura/FOXUSER.DBF new file mode 100644 index 0000000..3bf83ce Binary files /dev/null and b/Formulare/test_listare_factura/FOXUSER.DBF differ diff --git a/Formulare/test_listare_factura/FOXUSER.FPT b/Formulare/test_listare_factura/FOXUSER.FPT new file mode 100644 index 0000000..91c2feb Binary files /dev/null and b/Formulare/test_listare_factura/FOXUSER.FPT differ diff --git a/Formulare/test_listare_factura/oproceduri_comune.prg b/Formulare/test_listare_factura/oproceduri_comune.prg new file mode 100644 index 0000000..72df8ef --- /dev/null +++ b/Formulare/test_listare_factura/oproceduri_comune.prg @@ -0,0 +1,2374 @@ +Define Class oexecutor As Custom + nHandle = 0 + cSql = '' + cCursor = '' + nSucces = 0 + cEroare = '' + nEroare = 0 + cTime = '' + lReconnect = .T. && cred ca trebuie setat pe .F. inainte de o serie de proceduri executate cu tranzactie manuala + lShowError = .F. + lQuitOnError = .F. + + Declare aEroare[1] + + +* PROCEDURE INIT( tnHandle, tcSql, tcCursor ) +* Date : 06/10/2004, 12:18:21 +* author : marius.mutu +* description: + +****** PARAMETER BLOCK ************** +* Parameters : 3 +* Parameter 1: +* Parameter 2: +* Parameter 3: +* +******************************************* INCEPUT:INIT ******************************************* + Procedure Init + Lparameters tnHandle, tcSql, tcCursor + + + If Empty(tnHandle) + This.nHandle = gnHandle + Else + This.nHandle = tnHandle + Endif + + Endproc +******************************************* SFARSIT: INIT ******************************************* + + +* PROCEDURE oExecute( tcSql, tcCursor,tlProgress, tnHandle ) +* Date : 06/10/2004, 12:16:11 +* author : marius.mutu +* description: + +****** PARAMETER BLOCK ************** +* Parameters : 3 +* Parameter 1: +* Parameter 2: +* Parameter 3: +* +******************************************* INCEPUT:oExecute ******************************************* + Procedure oExecute( tcSql, tcCursor, tlProgress, tcTitluProgress, tnHandle, tlShowError, tlQuitOnError, tlReconnect ) + Local lnHandle, lcSql, lcCursor, llProgress, lnSucces, laEroare, lcEroare, llShowError, llQuitOnError, llReconnect + + +&& tlQuitOnError : Daca face QUIT la eroare (daca vreau QUIT dau .T.) (default .F.) +&& tlShowError : Daca arata mesajul de eroare (daca vreau sa il tratez in oexecute dau .T.) (default .F.) +&& tlReconnect : Daca incearca sa se reconecteze (default .T.) + If .F. + Local This As oexecutor + Endif + This.Oreset() + + If Type('goLog')='O' + goLog.Log(tcSql,Program()) + Endif + + Local lnTip + lnTip = 0 + +*!* 29.06.2007 +*!* marius.mutu +*!* nu puneti upper(lcSql) - exista unele expresii in oracle care sunt case sensitive + If Empty(tcSql) + lcSql = This.cSql + Else + lcSql = tcSql + Endif + + If Empty(tcCursor) + lcCursor = This.cCursor + Else + lcCursor = tcCursor + Endif + + If Empty(tnHandle) + lnHandle = This.nHandle + Else + lnHandle = tnHandle + Endif + +&& DACA AM TRANZACTIE MANUALA NU FAC RECONNECT + If SQLGetprop(lnHandle,"Transactions") = 2 && TRANZACTIE MANUALA + This.lReconnect = .F. + Else + This.lReconnect = .T. + Endif + + Do Case + Case Pcount() < 6 + llQuitOnError = This.lQuitOnError + llReconnect = This.lReconnect + llShowError = This.lShowError + Case Pcount() < 7 + llQuitOnError = This.lQuitOnError + llReconnect = This.lReconnect + Otherwise + llShowError = tlShowError + llReconnect = tlReconnect + llQuitOnError = tlQuitOnError + Endcase + + lnSucces = This.nSucces + + llProgress = tlProgress && IIF(tlProgress or 'SELECT'$lcSql,.T.,.F.) + lcTitluProgress = Iif(Empty(tcTitluProgress),"",Alltrim(tcTitluProgress)) + + Declare laEroare[1] + lcEroare = '' + + + lnTip = Iif('ROLLBACK'$lcSql Or 'COMMIT'$lcSql,1,0) && daca ROLLBACK SAU COMMIT TIP = 1, ALTFEL 0 + + Do Case + Case lnTip = 0 +*!* If llProgress +*!* Local loTherm, lcTask, lnPercent, lnSeconds +*!* If !Empty(lcTitluProgress) +*!* lcTask = lcTitluProgress +*!* Else +*!* lcTask = "Se executa ... " +*!* Endif +*!* loTherm = Newobject("_thermometer","_therm","",lcTask) + +*!* lnPercent = 15 + + +*!* loTherm.Show() +*!* Endif + +*!* Do While .T. + +*!* If llProgress +*!* lnPercent = lnPercent + 5 +*!* If lnPercent > 90 +*!* lnPercent = 15 +*!* Endif + +*!* loTherm.Update(lnPercent, lcTask+" "+Trans(lnPercent)) +*!* Endif + + +*!* lnSucces = SQLExec(lnHandle,lcSql,lcCursor) +*!* If lnSucces = 0 +*!* * +*!* Else +*!* Exit +*!* Endif +*!* Enddo + +*!* If llProgress +*!* loTherm.Complete() +*!* Release loTherm +*!* Endif + + If llProgress + Local loTherm, lcTask, lnPercent, lnSeconds + If !Empty(lcTitluProgress) + lcTask = lcTitluProgress + Else + lcTask = "Se executa ... " + Endif + loTherm = Newobject("_thermometer","_therm","",lcTask) + + lnPercent = 15 + + + loTherm.Show() + Endif + + lnSucces = -1 + Do While .T. + Do While .T. + + If llProgress + lnPercent = lnPercent + 5 + If lnPercent > 90 + lnPercent = 15 + Endif + + loTherm.Update(lnPercent, lcTask+" "+Trans(lnPercent)) + Endif + + + lnSucces = SQLExec(lnHandle,lcSql,lcCursor) + If lnSucces = 0 +* + Else + Exit + Endif + Enddo + + If lnSucces > 0 + If Used(lcCursor) + lcTempCursor = Sys(2015) + Use Dbf(lcCursor) In 0 Again Shared Alias (lcTempCursor) + Use In (lcCursor) + Use Dbf(lcTempCursor) In 0 Again Alias (lcCursor) + Use In (lcTempCursor) + Endif + Exit + Endif + + If lnSucces < 0 + Release laEroare + Declare laEroare(1) + lnEroare1 = 0 + lnEroare2 = 0 + lcTextEroare = [] + lnHandle = 0 + llEroare = .F. + + Aerror(laEroare) + If Alen(laEroare) > 1 + lnEroare1 = laEroare[1] + lnEroare2 = laEroare[5] + lcTextEroare = laEroare[3] + lnHandle = laEroare[6] + llEroare = .T. + + Endif + + + Do Case + Case lnEroare1 <>1526 && eroare <> ODBC + lcTextEroare = Program() + Chr(13) + Alltrim(Str(lnEroare1)) + ' ' + laEroare[2] + If Type('goLog')='O' + goLog.Log(lcTextEroare,Program()) + Endif + If llShowError + AMESSAGEBOX(lcTextEroare,0,"Eroare") + Endif + If llQuitOnError + Quit + Retry + Else + Exit + Endif + + Case lnEroare1 = 1526 && eroare ODBC + Do Case + Case llReconnect And Inlist(lnEroare2, 12152, 3113, 3114, 12560, 4068, 28, 12) && 12512 = TNS: UNABLE TO SEND BREAK MESSAGE; 3114 = NOT CONNECTED TO ORACLE; 12560 = PROTOCOL ADAPTER ERROR + If Type('goLog')='O' + lcLog = laEroare(3) + Chr(13) + goLog.Log(lcLog,Program()) + Endif + + Do While .T. + lnRaspuns = AMESSAGEBOX('Eroare de conectare.' + Chr(13) + lcTextEroare + Chr(13) + 'Doriti reconectare?',4+32,'Eroare') && retry = 4; cancel = 2 + If lnRaspuns = 6 + + lnHandle = goConn.Connect(goConn.cHost, goConn.cUser, goConn.cPassword, llReconnect) + +*!* gnHandle = SQLConnect(gcHost,gcUserName,gcPassword) + + If lnHandle < 0 + Declare laEroare2(1) + Aerror(laEroare2) + lcTextEroare = laEroare2(3) + If Type('goLog')='O' + goLog.Log(lcTextEroare,Program()) + Endif + + Release laEroare2 + Loop + Else +*!* goExecutor.nHandle = gnHandle + Exit + Endif + Else + Quit + Retry + Endif && lnRaspuns = 6 + Enddo && .T. + Loop && daca am iesit cu un handle valid intru din nou in loop si fac cursorfill + Otherwise + lcTextEroare = Program() + Chr(13) + Alltrim(Str(lnEroare1)) + ' ' + Chr(13) + Transform(laEroare[2]) + Chr(13) + Transform(laEroare[3]) + Chr(13) + lcSql + If llShowError + lnRaspuns = AMESSAGEBOX('Eroare necunoscuta' + Chr(13) + lcTextEroare,0,'Eroare') && ok = 0 + Endif + If Type('goLog')='O' + goLog.Log(lcTextEroare,Program()) + Endif + If llQuitOnError + Quit + Retry + Else + Exit + Endif + Endcase && INLIST(lnEroare2,12152,3114) + Endcase + Endif && lnSucces < 0 + + Enddo && .T. + + If llProgress + loTherm.Complete() + Release loTherm + Endif + + Case lnTip = 1 + If 'ROLLBACK'$lcSql + lnSucces = Sqlrollback(lnHandle) + Else + lnSucces = Sqlcommit(lnHandle) + Endif + Endcase + + If lnSucces < 0 + Aerror(laEroare) + + If laEroare[1] <> 1526 + lcEroare = laEroare[2] + Else + lcEroare = Alltrim(Transform(laEroare[1])) + Chr(13) + Alltrim(Transform(laEroare[2])) + Chr(13) + Alltrim(Transform(laEroare[3])) + Chr(13) + lcSql + Endif + + If Type('goMyXMLHTTP') = 'O' + lcLunaHTTP = Iif(Type('gnLuna') = 'N', Transform(gnLuna) + "/","") + Iif(Type('GNAN') = 'N', Transform(gnAn),"") + lcErrorHTTP = Sys(0) + ":" + Iif(Type('GCS')='C'," " + GCS,"") + ": " + lcLunaHTTP + Chr(13) +Chr(10) + lcEroare + ; + CHR(13) + Chr(10) + Chr(13) + Chr(10) + GETCALLSTACK() + + lcUserName = gcUserNameApp + lcProgram = Juststem(Sys(16,0)) + goMyXMLHTTP.postError(lcErrorHTTP, lcUserName, lcProgram) + Endif + + If llShowError + AMESSAGEBOX(lcEroare,0,"Eroare") + Endif + If llQuitOnError + Quit + Retry + Endif + + Endif + + + + This.aEroare = laEroare + This.nSucces = lnSucces + This.cEroare = lcEroare + This.nEroare = Iif(Alen(laEroare)>=5,laEroare[5],0) + + Return lnSucces + + Endproc +******************************************* SFARSIT: oExecute ******************************************* + +*!* salveaza rezultatul unei functii in variabila data ca referinta +*!* intoarce SUCCES = (1,-1) +*!* lnSucces = oFunction2Value("MyFunction(MyParam1, MyParam2)", @pnReturnValue) + Function oFunction2Value + Lparameters tcFunction, tuRetValue + + lcSql = "select " + tcFunction + " as retvalue from dual" + lcCursor = Sys(2015) + lcField = lcCursor + ".retvalue" + + lnSucces = This.oExecute(lcSql, lcCursor) + + If lnSucces > 0 + tuRetValue = Evaluate(lcField) + If Used(lcCursor) + Use In (lcCursor) + Endif + Endif + + Return lnSucces + + Endfunc && oFunction2Value +******************************************* SFARSIT: oFunction2Value ******************************************* + +*!* salveaza rezultatul unui select in variabila data ca referinta +*!* daca se intorc mai multe randuri - eroare +*!* intoarce SUCCES = (1,-1) +*!* lnSucces = oSelect2Value("Select sum(cantitate) from tabel where conditie", @pnReturnValue) + Function oSelect2Value + Lparameters tcSql, tuRetValue + + Local lcSelect, lcSql, lcCursor, lcField, lnSucces + + lcSelect = Select() + lcSql = tcSql + lcCursor = Sys(2015) + + lnSucces = This.oExecute(lcSql, lcCursor) + + If lnSucces > 0 + If Reccount(lcCursor) > 1 + This.nSucces = -1 + This.cEroare = 'Au rezultat mai multe valori. Se astepta o singura valoare.' + lnSucces = -1 + Else + lcField = lcCursor + '.' + Field(1) + tuRetValue = Evaluate(lcField) + Endif + If Used(lcCursor) + Use In (lcCursor) + Endif + Endif + + Select (lcSelect) + + Return lnSucces + + Endfunc &&oSelect2Value +******************************************* SFARSIT: oFunction2Value ******************************************* + +******************************************* INCEPUT: oPrelucrareEroare ******************************************* +&& Prelucreaza mesajul de eroare : daca este intre ORA-20000 si ORA-20999 atunci afiseaza doar textul erorii + Function oPrelucrareEroare + Local lcTextEroare + lcTextEroare = This.cEroare + + If Like('*ORA-20???:*',lcTextEroare) + lnPozi=At("ORA-20",lcTextEroare)+11 + lnPozf=At("ORA",lcTextEroare,2) + lcTextEroare=Substr(lcTextEroare,lnPozi,lnPozf-lnPozi) +*!* ELSE +*!* lnPozf=At("ORA-",lcTextEroare,3) +*!* lcTextEroare=Substr(lcTextEroare,1,lnPozf-1)+[...] + Endif + Return lcTextEroare + Endfunc && oPrelucrareEroare +******************************************* SFARSIT: oPrelucrareEroare ******************************************* +* PROCEDURE oReset( ) +* Date : 06/10/2004, 12:21:06 +* author : marius.mutu +* description: + +****** PARAMETER BLOCK ************** +* Parameters : 0 +* +******************************************* INCEPUT:oReset ******************************************* + Procedure Oreset( ) + With This + .aEroare = .F. + .nSucces = 0 + .cSql = '' + .cCursor = '' + Endwith + Endproc +******************************************* SFARSIT: oReset ******************************************* + +Enddefine && oExecutor + + + + +*** oConn =========================================================================================== +Define Class oConn As Custom + + cHost = '' + cUser = '' + cPassword = '' + nHandle = 0 + cEroare = '' + Declare aEroare[7] + lShowError = .F. + lReconnect = .F. && Daca llReconnect = .T. se apeleaza InitSesiune din oInit_Optiuni.prg + + +*** Connect =========================================================================================== + Procedure Connect + Lparameters tcHost, tcUser, tcPassword, tlReconnect + +*!* tlReconnect = .T. daca se apeleaza connect la reconectare (atunci se apeleaza si InitSesiune()) + Local lnSucces, laEroare, lcString, lcHost, lcUser, lcPassword, lcSql + + If Pcount() < 3 Or Type('tcHost') # 'C' Or Type('tcUser') # 'C' Or Type('tcPassword') # 'C' +* + Else + This.cHost = tcHost + This.cUser = tcUser + This.cPassword = tcPassword + Endif + + lcHost = This.cHost + lcUser = This.cUser + lcPassword = This.cPassword + + If Pcount() < 4 Or Type('tlReconnect') # 'L' + llReconnect = This.lReconnect + Else + llReconnect = tlReconnect + Endif + + SQLSetprop(0,"DispLogin",3) + lcString="dsn="+Alltrim(lcHost)+";Uid="+Alltrim(lcUser)+";Pwd="+Alltrim(lcPassword)+";" + + This.nHandle = Sqlstringconnect(lcString) + + If Type('gnHandle') = 'N' + gnHandle = This.nHandle + Endif + + If Type('goExecutor') = 'O' + goExecutor.nHandle = This.nHandle + Endif + + If This.nHandle > 0 + lnSucces = 1 + +*** SETARI SESIUNE DUPA CONECTARE + This.postConn() + + If llReconnect + lnSucces = InitSesiune() && IN oInit_Optiuni.prg + Endif + Else + lnSucces = -1 + This.ProcessError() + Endif + + Return This.nHandle + + Endproc && Connect +*** END Connect =========================================================================================== + +*** Disconnect =========================================================================================== + Procedure Disconnect + Lparameters tnHandle + + Local lnSucces, lnHandle + + lnHandle = Iif(Empty(tnHandle) Or Type('tnHandle') # 'N', 0 , tnHandle) + + lnSucces = SQLDisconnect(lnHandle) + + If lnSucces < 0 + This.ProcessError() + Endif + + Return lnSucces + + Endproc && +*** END Disconnect =========================================================================================== + +*** ProcessError =========================================================================================== + Procedure ProcessError + + Local laEroare, lnEroare1, lnEroare2, lcTextEroare, lcEroareConectare + lcTextEroare = '' + lcEroareConectare = '' + Dimension laEroare[1] + + Aerror(laEroare) + If Alen(laEroare) > 1 + lnEroare1 = laEroare[1] + lnEroare2 = laEroare[5] + lcTextEroare = laEroare[3] + lnHandle = laEroare[6] + llEroare = .T. + + lcTextEroare = 'Conectarea nu a reusit ' + Chr(13) + Chr(10) + Alltrim(Transform(laEroare[1])) + ' ' + Chr(13) + Transform(laEroare[2]) + Chr(13) + Transform(laEroare[3]) + This.cEroare = lcTextEroare + This.aEroare = laEroare + + goLog.Log(lcTextEroare,Program()) + + If laEroare[1]=1526 And Like('*ORA-20???:*',laEroare[2]) + lnPozi = At("ORA-20",laEroare[2])+11 + lnPozf = At("ORA",laEroare[2],3) + lcEroareConectare = Substr(laEroare[2],lnPozi,lnPozf-lnPozi) + Else + lcEroareConectare = lcTextEroare + Endif + If Empty(lcEroareConectare) + lcEroareConectare="Conectarea nu a reusit!" + Endif + + AMESSAGEBOX(lcEroareConectare,0+48,"Atentie") + Endif + + Return lcTextEroare + + Endproc && ProcessError +*** END ProcessError =========================================================================================== + +*** postConn =========================================================================================== + Procedure postConn +*** PUNCT ZECIMAL + lcSql=[ALTER SESSION SET NLS_NUMERIC_CHARACTERS = ".,"] + lnSucces = goExecutor.oExecute(lcSql) + If lnSucces < 0 + AMESSAGEBOX(goExecutor.cEroare,0+16,'Eroare') + Endif + + Endproc && postConn +*** END postConn =========================================================================================== + + +Enddefine && oConn +*** END oConn =========================================================================================== + + + +* PROCEDURE Get_Ora( tnTip ) +* Date : 16/11/2004, 08:58:45 +* author : marius.mutu +* description: + +****** PARAMETER BLOCK ************** +* Parameters : 1 +* Parameter 1: +* +******************************************* INCEPUT:Get_Ora ******************************************* +Procedure Get_Ora( tnTip ) +* tnTip: 1 sau nimic = DATETIME ; 2 = CHARACTER + +Local lcRetVal, lnSucces +Local lcCursor, lcSql, lcSelect +lcSelect = Select() + +If Pcount() = 0 Or Type('tnTip') <> 'N' + lnTip = 1 +Else + lnTip = tnTip +Endif + +&&preluare ora de pe oracle server: +Store -1 To lnSucces +lcSql = [select to_char(SYSdate,'dd/mm/yyyy hh24:mi:ss') as dataora from dual] +lcCursor = [dataora_cursor] +lnSucces = goExecutor.oExecute(lcSql, lcCursor) +If lnSucces < 0 + AMESSAGEBOX(goExecutor.cEroare, 0+16, ,'Eroare') + lcRetVal = Ttoc(Datetime()) +Else + Select dataora_cursor + lcRetVal = dataora_cursor.dataora + Use In dataora_cursor +Endif + +If lnTip = 1 + lcRetVal = Ctot(lcRetVal) +Endif + +If !Empty(lcSelect) + Select (lcSelect) +Endif + +Return lcRetVal +Endproc +******************************************* SFARSIT: Get_Ora ******************************************* +*________________________________________________________ + +Function ULTIMAZI +Parameters tcAn, tcLuna + +Local lcAn, lcLuna + +If Empty(tcAn) + lcAn = pcAn +Else + lcAn = Alltrim(tcAn) +Endif + +If Empty(tcLuna) + lcLuna = pcNl +Else + lcLuna = Alltrim(tcLuna) +Endif + +If Val(lcAn) = Year(Date()) And Val(lcLuna) = Month(Date()) + Return Date() +Endif + +lcData = '01/'+ lcLuna + '/' + lcAn +ldData = Gomonth(Ctod(lcData),1) - 1 + +Return ldData + +**************************************************************** + +Function get_nivel_upf(tnid_util,tnid_prog,tnid_firma) +Private pnid_util,pnid_prog,pnid_firma +pnid_util = tnid_util +pnid_prog= tnid_prog +pnid_firma = tnid_firma +Local lnnivel +lcSql = [select ud.id_nivel,n.nivel from contafin_oracle.util_drept ud ] + ; + [join contafin_oracle.nivel n on ud.id_nivel = n.id_nivel ] + ; + [where ud.id_util = ?pnid_util and ud.id_prog = ?pnid_prog and ] +; + [ud.id_firma = ?pnid_firma] +lcCursor = [crsUtilNivel] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +If lnSucces < 0 + lcTitlu = [Eroare] + lctip = [Avertizare] + lcImagine = [exclam.ico] + lcMesaj = goExecutor.cEroare + ofrm_eroare = Createobject('frm_mesaj',lcTitlu,lcImagine,lctip,lcMesaj) + ofrm_eroare.Show(1) + Release ofrm_eroare + Return +Endif +lnnivel = &lcCursor..nivel +Return lnnivel +Endfunc &&get_nivel_upf + +******************************************************************************************************* + +Function enumefis +Parameters tc_numefis +Private pn_len,pl_return,pc_numefis,pc_char +pn_len=0 +pc_char='' +pl_return=.T. +pc_numefis=Alltrim(tc_numefis) +pn_len=Len(pc_numefis) +If pn_len=0 + pl_return=.F. +Endif +Do While pn_len>0 + pc_char=Substr(pc_numefis,pn_len,1) + If !Between(Asc(pc_char),48,57) And !Between(Asc(pc_char),97,122) And !Between(Asc(pc_char),65,90) And Asc(pc_char)<> 95 And Asc(pc_char)<>46 + pl_return=.F. + Exit + Endif + pn_len=pn_len-1 +Enddo +Return pl_return +Endfunc && enumefis +*********************************************************************************************** + + +******************************************* +* PROCEDURE ImportTable +* Date : 08/07/2005, 09:20:54 +* author : marius.mutu +* description: intoarce numele unui cursor cu datele importate dintr-un dbf +******************************************* +Procedure ImportTable +Local lcCursor +lcCursor = "" +loimport = Newobject("frm_import","importdata") +loimport.Show(1) +If gnButon = 1 + lcCursor = "crsReturn" +Endif + +Return lcCursor + +Endproc +*----------------------------------sfarsit procedura ImportTable---------------------------------- + + +Function Lista_Campuri +Lparameters tcAlias + +Local lcSelect, i, lcAlias, lcLista +lcLista = [] +lcSelect = Select() +lcAlias = tcAlias + +Select (lcAlias) +lnFields = Fcount() +For i = 1 To lnFields + lcField = Field(i) + lcLista = lcLista + [,] + lcField +Endfor +If !Empty(lcLista) + lcLista = Substr(lcLista,2) +Endif + +Select (lcSelect) +Return lcLista + +Endfunc && Lista_Campuri + + +***--------------------------------------------------------------------- +Procedure OPEN_DEFAULT_APP +Parameters tcfilename + +Declare Integer ShellExecute In shell32.Dll ; + INTEGER hndWin, ; + STRING cAction, ; + STRING cFileName, ; + STRING cParams, ; + STRING cDir, ; + INTEGER nShowWin +cFileName = tcfilename +cAction = "open" +ShellExecute(0,cAction,cFileName,"","",1) + +Endproc && OPEN_DEFAULT_APP + + +***--------------------------------------------------------------------- +Procedure GET_SCHEMA_GRID +Lparameters toGrid, tcColumnList, tcHeaderList, tcSchema, tlSelect, tnType, tcFrom, tcWhere, tcOrder, tcOutputName + +Local lcSelect, llSelect, lcAlias, lcWhere, lcOrder, lcColumn, lcHeader +Local lnType, lcInto +&& tnType : 0 CURSOR, 1 TABLE, 2 ARRAY + +If Type('tnType') # 'N' + lnType = 0 +Else + If !Between(tnType,0,2) + lnType = 0 + Else + lnType = tnType + Endif +Endif +Do Case +Case lnType = 0 + lcInto = ' INTO CURSOR ' +Case lnType = 1 + lcInto = ' INTO TABLE ' +Other lnType = 1 + lcInto = ' INTO ARRAY ' +Endcase + + +tcColumnList = '' +tcHeaderList = '' +tcSchema = '' + +lnNrCol = toGrid.ColumnCount +Dimension myArray[lnNrCol,3] + +With toGrid + For lnCol = 1 To .ColumnCount + lnColumn = .Columns(lnCol).ColumnOrder + lcColumn = .Columns(lnCol).ControlSource + llVisible = .Columns(lnCol).Visible + lnWidth = .Columns(lnCol).Width + If !llVisible Or lnWidth = 0 Or Empty(Alltrim(lcColumn)) + Adel(myArray,lnCol) + Loop + Endif + lnPos = At('.',lcColumn) + If lnPos > 0 + lcColumn = Substr(lcColumn, lnPos + 1) + Endif +*tcColumnList = tcColumnList + lcColumn + ',' + myArray[lnCol,1] = lnColumn + + For lnobjcol = 1 To .Columns(lnCol).Objects.Count + If Upper(.Columns(lnCol).Objects(lnobjcol).BaseClass)='HEADER' + lcHeader = .Columns(lnCol).Objects(lnobjcol).Caption + lcHeader = Strtran(Strtran(Strtran(Strtran(Strtran(Strtran(Strtran(Strtran(Strtran(lcHeader,Chr(32),'_'),'.','_'),'/','_'),'\','_'),"&","_"),"%",""),"(","_"),")","_"),"-","_") +*tcHeaderList = tcHeaderList + lcHeader + ',' +*tcSchema = tcSchema + lcColumn + [ as ] + lcHeader + [,] + myArray[lnCol,2] = lcColumn + myArray[lnCol,3] = lcHeader + Exit + Endif + Endfor + Endfor +*!* tcColumnList = Substr(tcColumnList, 1, Len(tcColumnList)-1) +*!* tcHeaderList = Substr(tcHeaderList , 1, Len(tcHeaderList)-1) +*!* tcSchema = Substr(tcSchema , 1, Len(tcSchema)-1) +Endwith +For i = 1 To Alen(myArray,1) + l1 = myArray[i,1] + If Type('l1') # 'N' + myArray[i,1] = -1 + Endif +Endfor + +Asort(myArray) +For i = 1 To Alen(myArray,1) + If myArray[i,1] <> -1 + tcColumnList = tcColumnList + Alltrim(myArray[i,2]) + [,] + tcHeaderList = tcHeaderList + Alltrim(myArray[i,3]) + [,] + tcSchema = tcSchema + Alltrim(myArray[i,2]) + [ as ] + Alltrim(myArray[i,3]) + [,] + Endif +Endfor + +tcColumnList = Substr(tcColumnList, 1, Len(tcColumnList)-1) +tcHeaderList = Substr(tcHeaderList , 1, Len(tcHeaderList)-1) +tcSchema = Substr(tcSchema , 1, Len(tcSchema)-1) + + +If tlSelect + tcSchema = 'SELECT ' + tcSchema +Endif +If !Empty(tcFrom) + tcSchema = tcSchema + ' FROM ' + Alltrim(tcFrom) +Endif +If !Empty(tcWhere) + tcSchema = tcSchema + ' WHERE ' + Alltrim(tcWhere) +Endif + +If !Empty(tcOrder) + tcSchema = tcSchema + ' ORDER BY ' + Alltrim(tcOrder) +Endif + +If !Empty(tcOutputName) + tcSchema = tcSchema + lcInto + tcOutputName +Endif + +Endproc && GET_SCHEMA_GRID + +***--------------------------------- +Procedure amessage +Lparameters tcMessage, tnDialogBoxType, tcTitleBarText, tnTimeOut +Local lnResponse +lnResponse = 0 +lcMessage = Iif(Empty(tcMessage),[],tcMessage) +lnDialogBoxType = Iif(Empty(tnDialogBoxType),0,tnDialogBoxType) +lcTitleBarText = Iif(Empty(tcTitleBarText),[],tcTitleBarText) +lnTimeOut = Iif(Empty(tnTimeOut),0,tnTimeOut) +If lnTimeOut # 0 + lnResponse = AMESSAGEBOX(lcMessage,lnDialogBoxType,lcTitleBarText,lnTimeOut) +Else + lnResponse = AMESSAGEBOX(lcMessage,lnDialogBoxType,lcTitleBarText) +Endif + +Return lnResponse + +Endproc && amessage +***--------------------------------- + +***--------------------------------- +Function AMESSAGEBOX +Lparameters tcMessage, tnDialogBoxType, tcTitle, tcFont, tnTimeOut ,tnTimeoutValue + +Local loMessage, lnReturn, lcMessageboxForm + +*!* *!* LOGHEZ ERORILE +*!* IF TYPE('goLog') = 'O' AND 'ERROR'$UPPER(tcMessage) OR 'EROARE'$UPPER(tcMessage) OR 'ORA-'$UPPER(tcMessage) +*!* goLog.LOG(tcMessage,PROGRAM()) +*!* ENDIF +If Type('gcNumeProgram') = 'C' And gcNumeProgram = 'ROASTART' + lcMessageboxForm = "messagebox_form_desktop" && desktop .T. +Else + lcMessageboxForm = "messagebox_form" +Endif +If !'MESSAGEBOX'$Upper(Set("Classlib")) + If Type('lnTimeOut') = 'N' And lnTimeOut # 0 + lnReturn = Messagebox(tcMessage, tnDialogBoxType, tcTitle, tnTimeOut) + Else + lnReturn = Messagebox(tcMessage, tnDialogBoxType, tcTitle) + Endif +Else + loMessage = Newobject(lcMessageboxForm, "MessageBox.vcx", "", tcMessage, tnDialogBoxType, tcTitle, tcFont, tnTimeOut ,tnTimeoutValue) + loMessage.AlwaysOnTop = .T. + loMessage.Show(1) + lnReturn = loMessage.IDOpcion +Endif + + +Return lnReturn + +Endfunc && amessagebox +***--------------------------------- + +Procedure export_xls +Lparameters tcAlias,tcNumeFisier + +If Empty(tcNumeFisier) + tcNumeFisier = 'Foaie_Excel' +Endif + +Local lcSelect +lcSelect = Select() + +If Used(tcAlias) + lcDir = Addbs(gcTempPath) + + lcFile = Putfile('Nume fisier:', tcNumeFisier , 'XLS') + If Empty(lcFile) && Esc pressed + Return + Endif + + + Select (tcAlias) + Export To (lcFile) Type Xl5 + Select (lcSelect) + + OPEN_DEFAULT_APP(lcFile) + +Endif +Endproc && export_xls + +*__________________________________________________________ + +&& Folosesc un tabel (tabel,id) cu cate o linie pt fiecare tabel +&& aflu id-ul urmator si il scriu in tabela +&& returnez id-ul +&& EX1: LNEW_ID=NEW_ID("GRILA_SAL") --> urmatorul id din fara cautare in tabela originala +&& EX2: LNEW_ID=NEW_ID("GRILA_SAL","ID") --> urmatorul id din cu cautare in tabela originala dupa campul +&& ex3: LNEW_ID=NEW_ID("GRILA_SAL","ID",.T.) --> .T. INSEAMNA CA TABELUL ORIGINAL ESTE INDEXAT DUPA FAC SEEK IN LOC DE LOCATE +Procedure NEW_ID +Parameters TALIAS,TFIELD,TTAG +*WAIT WINDOW TALIAS +*ON error Errorh(ERROR(),PROGRAM(),LINENO()) +LLLOOKUP=Iif(Type("tfield")="C",.T.,.F.) +LLTAG=Iif(Type("TTAG")="C",.T.,.F.) +TALIAS=Upper(Alltrim(TALIAS)) + + +*** Save Stats +LCOLDALIAS = Alias() && keep current work area +LNOLDRECNO = Iif(!Eof(),Recno(),0) && save record number + +LCSETDEL=Set("deleted") +&& lnmaxval = (10^pcidsize)-1 && wrap around after this val + +*** +&& PUN ORDINEA PE ID +If LLLOOKUP And LLTAG + Sele (TALIAS) + Set Order To &TTAG +Endif +*** +LCNEWID = 0 && our return result - NULL if failed +Select IDS +Locate For Upper(Alltrim(TABEL))=TALIAS +If !Found() + If Flock() + Append Blank + Replace TABEL With TALIAS + Unlock + Endif + +Endif + +Set Deleted Off +&& acum sunt pe inregistrarea corecta + + +*** lock counter table and update counter +Select IDS +If Rlock() +*** Avoid use of Macros - Convert to mem var & update it + LNCOUNTERVAL = NEW_ID + +*** VERIFY ID NUMBER - search 'til no match + Do While .T. +*** increase the counter - update field and var + LNCOUNTERVAL = LNCOUNTERVAL+1 + +*!* *** check for wraparound +*!* IF lncounterval > lnmaxval +*!* lncounterval = 1 +*!* ENDIF + + Select (TALIAS) + If LLLOOKUP + If LLTAG + LCAUT="SEEK "+Allt(Str(LNCOUNTERVAL)) + Else + LCAUT="LOCATE FOR "+Allt(TFIELD)+"="+Allt(Str(LNCOUNTERVAL)) +*** now see if it exists + &LCAUT +* LOCATE FOR &TFIELD=LNCOUNTERVAL + If !Found() +*** No match - DONE + Exit + Endif && !found() + Endif && lltag + Else + Exit + Endif && lllokup + + Enddo && done + + Sele IDS + Replace NEW_ID With LNCOUNTERVAL + LCNEWID=LNCOUNTERVAL + + Unlock In IDS +Endif && rlock() + +*** Reset record number on original file + +If !Empty(LCOLDALIAS) + Sele (LCOLDALIAS) + If LNOLDRECNO#0 + Goto LNOLDRECNO + Endif +Endif +Set Deleted &LCSETDEL + +Return LCNEWID + +Endproc && NEW_ID + + +***------------------------------------------------------------------------------------------------------- + +* Foloseste comment de la coloane si tooltiptext de la grid pt a salva recordsource si controlsource din grid inainte de reconstructie +Procedure SAVE_GRID +Param toGrid +*wait wind 'save_grid' +Private pogrid +If Param()=0 Or Type('togrid')!="O" + Return .F. +Endif + +pogrid=toGrid + +* remember control sources in the column's comment field +With pogrid + Local nColumnIndex + For m.nColumnIndex = 1 To .ColumnCount + .Columns(m.nColumnIndex).Tag = .Columns(m.nColumnIndex).ControlSource + Endfor + .ToolTipText=.RecordSource + .RecordSource="" +Endwith + +Return .T. +Endproc && SAVE_GRID +***-------------------------------------------------------------- +Procedure RESTORE_GRID +Param toGrid + +*wait wind 'restore_grid' +Private pogrid +If Param()=0 Or Type('togrid')!="O" + Return .F. +Endif + +pogrid=toGrid + + +With pogrid +* restore record source + .RecordSource = .ToolTipText +* restore control sources + For m.nColumnIndex = 1 To .ColumnCount + .Columns(m.nColumnIndex).ControlSource = .Columns(m.nColumnIndex).Tag + Endfor + .ToolTipText="" +Endwith +Return .T. +Endproc && RESTORE_GRID + +****** + +* Foloseste comment de la coloane si tooltiptext de la grid pt a salva recordsource si controlsource din grid inainte de reconstructie +Procedure SAVE_GRID_COMMENT +Param toGrid +*wait wind 'save_grid' +Private pogrid +If Param()=0 Or Type('togrid')!="O" + Return .F. +Endif + +pogrid=toGrid + +* remember control sources in the column's comment field +With pogrid + Local nColumnIndex + For m.nColumnIndex = 1 To .ColumnCount + .Columns(m.nColumnIndex).Comment = .Columns(m.nColumnIndex).ControlSource + Endfor + .ToolTipText=.RecordSource + .RecordSource="" +Endwith + +Return .T. +Endproc && SAVE_GRID_COMMENT +***-------------------------------------------------------------- +Procedure RESTORE_GRID_COMMENT +Param toGrid + +*wait wind 'restore_grid' +Private pogrid +If Param()=0 Or Type('togrid')!="O" + Return .F. +Endif + +pogrid=toGrid + + +With pogrid +* restore record source + .RecordSource = .ToolTipText +* restore control sources + For m.nColumnIndex = 1 To .ColumnCount + .Columns(m.nColumnIndex).ControlSource = .Columns(m.nColumnIndex).Comment + Endfor + .ToolTipText="" +Endwith +Return .T. +Endproc && RESTORE_GRID_COMMENT + + +* Foloseste comment de la coloane si tooltiptext de la grid pt a salva recordsource si controlsource din grid inainte de reconstructie +Procedure SAVE_GRID_TAG +Param toGrid +*wait wind 'save_grid' +Private pogrid +If Param()=0 Or Type('togrid')!="O" + Return .F. +Endif + +pogrid=toGrid + +* remember control sources in the column's comment field +With pogrid + Local nColumnIndex + For m.nColumnIndex = 1 To .ColumnCount + .Columns(m.nColumnIndex).Tag = .Columns(m.nColumnIndex).ControlSource + Endfor + .ToolTipText=.RecordSource + .RecordSource="" +Endwith + +Return .T. +Endproc && SAVE_GRID_TAG +***-------------------------------------------------------------- +Procedure RESTORE_GRID_TAG +Param toGrid + +*wait wind 'restore_grid' +Private pogrid +If Param()=0 Or Type('togrid')!="O" + Return .F. +Endif + +pogrid=toGrid + + +With pogrid +* restore record source + .RecordSource = .ToolTipText +* restore control sources + For m.nColumnIndex = 1 To .ColumnCount + .Columns(m.nColumnIndex).ControlSource = .Columns(m.nColumnIndex).Tag + Endfor + .ToolTipText="" +Endwith +Return .T. +Endproc && RESTORE_GRID_TAG + + +*------------------------------------------- +* Function...: Xmenu +* Author.....: MARTIN +* Date.......: 04/06/1997 +* Notes......: Based on an idea from Steve Zimmelman for FoxPro 2.x +* Parameters.: tcItems = Semicolon-separated String with the various options +* ...........: tnBar = Initially selected item (default=1) +* Returns....: Selected item number +* See Also...: PROMPT() [FoxPro Native] +* +Procedure XMENU +Lparameters TCITEMS, TNBAR + +Local NITEMCOUNT, AITEMS, X, NROW, NCOL, CTITLE, NLASTPOS, CCOLOR, AITEMS + +Private CPOPMENU, NSELECT && They flow into the GetChoice internal procedure + +If Pcount() < 2 + TNBAR = 1 +Endif + +Activate Screen + +* Parse every item +* +m.NITEMCOUNT = Occurs( ';', TCITEMS ) + 1 +Dimen AITEMS[ m.nItemCount ] +m.NLASTPOS = 1 + +For m.X = 1 To m.NITEMCOUNT + + If m.X < m.NITEMCOUNT + + AITEMS[ m.x ] = Subs( m.TCITEMS, m.NLASTPOS, ; + ( At( ';', m.TCITEMS, m.X ) - 1 ) - m.NLASTPOS + 1 ) + Else + AITEMS[ m.x ] = Subs( m.TCITEMS, m.NLASTPOS, ; + ( Len( m.TCITEMS ) - m.NLASTPOS ) + 1 ) + Endif + + If AITEMS[ m.x ] # "\-" + + AITEMS[ m.x ] = Allt( AITEMS[ m.x ] ) + Endif + + m.NLASTPOS=At( ';', m.TCITEMS, m.X ) + 1 +Next + +* Calculates the mouse pointer position +* +m.NROW = Iif( Mrow() + m.NITEMCOUNT < Srow(), Mrow() - 1, Srow() - m.NITEMCOUNT ) +m.NCOL = Iif( Mcol() + 10 < Scol(), Mcol() - 3, Mcol() - 13 ) + +* Gets an unique name for the pop-up +* +m.CPOPMENU = 'M' + Sys(3) + "_" + +Define Popup ( m.CPOPMENU ) SHORTCUT Relative From NROW, NCOL + +For m.X = 1 To m.NITEMCOUNT + + Define Bar m.X Of ( m.CPOPMENU ) Prompt AITEMS[ m.x ] +Next + +m.CANS = "" +m.NSELECT = 0 +Clear Type + +On Selection Popup ( m.CPOPMENU ) Do GETCHOICE + +Activate Popup ( m.CPOPMENU ) Bar TNBAR + +Pop Key +Release Popup ( m.CPOPMENU ) + +Return Iif( Lastkey()=27, 0, m.NSELECT ) + +Endproc && XMENU + +*-------------------- +Procedure GETCHOICE + +m.NSELECT = Bar() + +Deactivate Popup ( m.CPOPMENU ) + +Return +&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& MENIU &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& + +Procedure lista2array +Parameters tcLISTA,taArray,tcSeparator +&& tcLista este un sir de caractere care contine elementele separate prin <;> default +&& tarray este vectorul care se completeaza - trebuie dat prin referinta +&& tcSeparator separatorul de elemente din tcLista - default este ";" - este optional +&& intoarce numarul de elemente gasite + +&& ex: lnNr = lista2array("ana;are;mere",@alista,";") +External Array taArray +Local lcLista,lcSeparator,lnNRF,lcF1,i + +lnNRF = 0 + +lcLista=Upper(Allt(tcLISTA)) +If Parameters()<3 Or Empty(tcSeparator) + lcSeparator=";" +Else + lcSeparator=Alltrim(tcSeparator) +Endif + +If Right(lcLista,1)!=lcSeparator + lcLista=lcLista+lcSeparator +Endif + +lnNRF=Occurs(lcSeparator,lcLista) + +If lnNRF>0 + Dimension taArray[lnNrf,1] + + For i=1 To lnNRF + lcF1=Left(lcLista,At(lcSeparator,lcLista)-1) + + If i!=lnNRF + lcLista=Substr(lcLista,At(lcSeparator,lcLista)+1) + Endif + + taArray[i]=lcF1 + Endfor +Else + lnNRF = 0 +Endif + +Return lnNRF + +Endproc && lista2array + + +***------------------------------------------------------------------------------------------- +Procedure get_mask +Parameters tnint, tndec + +Local lnint, lndec +lnint = tnint +lndec = tndec +lnrest = Mod(lnint,3) + +lcString = Replicate("9",lnrest) +lnint_ramas = lnint - lnrest +Do While lnint_ramas > 0 + lcString = lcString + " "+ Replicate("9",3) + lnint_ramas = lnint_ramas - 3 +Enddo +If lndec > 0 + lcString = lcString +"."+Replicate("9",tndec) +Endif + +Return lcString + +Endproc && get_mask +***----------------------------------------------------------- + + +******************************************************************* +* PROCEDURE Get_Version( ) +* Date : 17/11/2004, 16:34:20 +* author : marius.mutu +* description: + +****** PARAMETER BLOCK ************** +* Parameters : 0 +* +******************************************* INCEPUT:Get_Version ******************************************* +Procedure Get_Version(tlNoRevision,tlInfo,tcfilename) +Local laVersion,lcVersion,lcFileName + +*-- Get Version Information +*-- Added 4-1-98 BDC +Local lcVersionText, lcFileName,llNoRevision,llInfo + +Dimension aVersion(12) + +If Empty(tcfilename) + lcFileName = Sys(16,0) +Else + lcFileName = tcfilename +Endif +llNoRevision = tlNoRevision +llInfo = tlInfo + + + +*** EGL: 2002.1.2 17:06 - switched to AGETFILEVERSION(). +If Val(Substr(Version(), 15)) >= 6 +* The AGETFILEVERSION() function was introduced in VFP 6 + +*!* DECLARE STRING GetCommandLine IN Kernel32 +*!* lcFileName = GetCommandLine() + lcVersionText = "" + +*!* IF GetFileVersion(&lcFileName,@aVersion) = 0 + If Agetfileversion(aVersion, lcFileName) > 0 + If !llInfo +* daca vreau doar numarul versiunii + lcVersion = Allt(aVersion(4)) + If llNoRevision +* daca nu vreau si revizia + lnPos = Rat('.',lcVersion,1) + Else + lnPos = Len(lcVersion) + Endif + lcVersionText = Left(lcVersion,lnPos) + Else +* vreau toata informatia despre fisier + If Not Empty(aVersion(1)) + lcVersionText = Allt(aVersion(1)) + Endif + + If Not Empty(aVersion(2)) + lcVersionText = lcVersionText+Chr(10)+"Produs de: "+ Allt(aVersion(2)) + Endif + + If Not Empty(aVersion(3)) + lcVersionText = lcVersionText+Chr(10)+"Descriere: "+ Allt(aVersion(3)) + Endif + + If Not Empty(aVersion(4)) + lcVersionText = lcVersionText+Chr(10)+"Versiune fisier: "+ Allt(aVersion(4)) + Endif + + If Not Empty(aVersion(5)) + lcVersionText = lcVersionText+Chr(10)+"Nume intern: "+ Allt(aVersion(5)) + Endif + + If Not Empty(aVersion(6)) + lcVersionText = lcVersionText+Chr(10)+"Copyright: "+ Allt(aVersion(6)) + Endif + + If Not Empty(aVersion(7)) + lcVersionText = lcVersionText+Chr(10)+"Marca inregistrata: "+ Allt(aVersion(7)) + Endif + + If Not Empty(aVersion(8)) + lcVersionText = lcVersionText+Chr(10)+"Nume fisier: "+ Allt(aVersion(8)) + Endif + + If Not Empty(aVersion(9)) + lcVersionText = lcVersionText+Chr(10)+"Private Build: "+ Allt(aVersion(9)) + Endif + + If Not Empty(aVersion(10)) + lcVersionText = lcVersionText+Chr(10)+"Nume produs: "+ Allt(aVersion(10)) + Endif + + If Not Empty(aVersion(11)) + lcVersionText = lcVersionText+Chr(10)+"Versiune produs: "+ Allt(aVersion(11)) + Endif + + If Not Empty(aVersion(12)) + lcVersionText = lcVersionText+Chr(10)+"Special Build: "+ Allt(aVersion(12)) + Endif + + If Empty(lcVersionText) + lcVersionText = "Versiune necunoscuta." + Endif + Endif + Else + + lcVersionText = "Versiune necunoscuta." + + Endif + +Else + lcVersionText = "Versiune necunoscuta." +Endif +Return lcVersionText + +Endproc +******************************************* SFARSIT: Get_Version ******************************************* + + +* PROCEDURE Get_Hexa( tnDeca ) +* Date : 18/11/2004, 17:56:48 +* author : marius.mutu +* description: transforma un Deca in Hexa + +****** PARAMETER BLOCK ************** +* Parameters : 1 +* Parameter 1: Numarul in Deca +* +******************************************* INCEPUT:Get_Hexa ******************************************* +Procedure Get_Hexa( tnDeca ) +Local laHexa,lnHexa,lnDeca + + +If Empty(tnDeca) + lnDeca = 0 +Else + lnDeca = tnDeca +Endif + +Dimension laHexa[16] +laHexa[1] = '0' +laHexa[2] = '1' +laHexa[3] = '2' +laHexa[4] = '3' +laHexa[5] = '4' +laHexa[6] = '5' +laHexa[7] = '6' +laHexa[8] = '7' +laHexa[9] = '8' +laHexa[10] = '9' +laHexa[11] = 'A' +laHexa[12] = 'B' +laHexa[13] = 'C' +laHexa[14] = 'D' +laHexa[15] = 'E' +laHexa[16] = 'F' + +lnHexa = '' + +Do While lnDeca > 0 + lnrest = Mod(lnDeca,16) + lcHexa = laHexa[lnRest+1] + lnDeca = Int(lnDeca/16) + + lnHexa = lcHexa + lnHexa + lnrest = Mod(lnDeca,16) + +Enddo + +Return lnHexa + +Endproc +******************************************* SFARSIT: Get_Hexa ******************************************* +&& completeaza cu spatii si CRLF un mesaj a.i. pe fiecare linie sa fie lnLength caractere +Function format_msg +Parameters tcErrMsg,tnLength +Local lnLength,lcLinie,lcMesaj,lnPoz,lnCate,i,j +lcMesaj="" +If Empty(tnLength) + lnLength=50 && numarul de caractere pe linie +Else + lnLength=tnLength +Endif +i=1 +If At(Chr(13)+Chr(10),tcErrMsg,i)>0 + lnCate=At(Chr(13)+Chr(10),tcErrMsg,i)+1 + i=i+1 +Else + lnCate=Min(lnLength,Rat(' ',Substr(tcErrMsg,1,lnLength))-1) +Endif +lnPoz=1 +*!* lcLinie=Substr(tcErrMsg,1,lnCate) + +Do While lnPoz0 + lnCate=At(Chr(13)+Chr(10),tcErrMsg,i)+2-lnPoz + i=i+1 + Else + lcNextChar=Substr(tcErrMsg,lnPoz+lnLength,1) + lcLinieNoua=Substr(tcErrMsg,lnPoz,lnLength) + If lcNextChar!=' ' And Len(lcLinieNoua)>=lnLength + lnCate=Min(lnLength,Rat(' ',lcLinieNoua)-1) + Else + lnCate=lnLength + Endif + Endif +Enddo +Return lcMesaj +Endfunc && format_msg +***--------------------------------------------------------------------------------------------- +Procedure C_LUNA +Parameters tnnrluna +Do Case +Case tnnrluna=1 + Return "IANUARIE" +Case tnnrluna=2 + Return "FEBRUARIE" +Case tnnrluna=3 + Return "MARTIE" +Case tnnrluna=4 + Return "APRILIE" +Case tnnrluna=5 + Return "MAI" +Case tnnrluna=6 + Return "IUNIE" +Case tnnrluna=7 + Return "IULIE" +Case tnnrluna=8 + Return "AUGUST" +Case tnnrluna=9 + Return "SEPTEMBRIE" +Case tnnrluna=10 + Return "OCTOMBRIE" +Case tnnrluna=11 + Return "NOIEMBRIE" +Case tnnrluna=12 + Return "DECEMBRIE" +Otherwise + Return "" +Endcase +Endproc &&c_luna +***-------------------------------------------------------------------------------------- +***-------------------------------------------------------------------------------------- +Procedure CLUNA3 +Parameters tnnrluna +Do Case +Case tnnrluna=1 + Return "Ian" +Case tnnrluna=2 + Return "Feb" +Case tnnrluna=3 + Return "Mar" +Case tnnrluna=4 + Return "Apr" +Case tnnrluna=5 + Return "Mai" +Case tnnrluna=6 + Return "Iun" +Case tnnrluna=7 + Return "Iul" +Case tnnrluna=8 + Return "Aug" +Case tnnrluna=9 + Return "Sep" +Case tnnrluna=10 + Return "Oct" +Case tnnrluna=11 + Return "Noi" +Case tnnrluna=12 + Return "Dec" +Otherwise + Return Space(3) +Endcase +Endproc &&cluna3 +***-------------------------------------------------------------------------------------- +***------------------------------------------------------------------------------------ +Procedure cluna +Parameters tcGrup,tcTipCumul,tcAn + +lcTipCumul=Upper(Alltrim(tcTipCumul)) +lcAn=Alltrim(tcAn) +lcgrup=Alltrim(tcGrup) +lnGrup=Val(lcgrup) +Do Case +Case lcTipCumul="T" + lcret="Trim. "+lcgrup+" "+lcAn +Case lcTipCumul="S" + lcret="Sem. "+lcgrup+" "+lcAn +Case lcTipCumul="A" + lcret="Anul "+lcAn +Otherwise + Do Case + Case lnGrup=1 + lcret="Ian "+lcAn + Case lnGrup=2 + lcret="Feb "+lcAn + Case lnGrup=3 + lcret="Mar "+lcAn + Case lnGrup=4 + lcret="Apr "+lcAn + Case lnGrup=5 + lcret="Mai "+lcAn + Case lnGrup=6 + lcret="Iun "+lcAn + Case lnGrup=7 + lcret="Iul "+lcAn + Case lnGrup=8 + lcret="Aug "+lcAn + Case lnGrup=9 + lcret="Sep "+lcAn + Case lnGrup=10 + lcret="Oct "+lcAn + Case lnGrup=11 + lcret="Noi "+lcAn + Case lnGrup=12 + lcret="Dec "+lcAn + Otherwise + lcret=lcAn + Endcase +Endcase +Return lcret +Endproc &&cluna +***------------------------------------------------------------------------------------ +***------------------------------------------------------------------------------------ +Procedure get_trimestru +Parameters tnNrTrim +Do Case +Case tnNrTrim = 1 + Return "Trim. I" +Case tnNrTrim = 2 + Return "Trim. II" +Case tnNrTrim = 3 + Return "Trim. III" +Case tnNrTrim = 4 + Return "Trim. IV" +Otherwise + Return Space(7) +Endcase +Endproc && get_trimestru +***-------------------------------------------------------------------------------------- +Procedure get_semestru +Parameters tnNrSem +Do Case +Case tnNrSem = 1 + Return "Sem. I" +Case tnNrSem = 2 + Return "Sem. II" +Otherwise + Return Space(7) +Endcase +Endproc && get_semestru +***-------------------------------------------------------------------------------------- +Function Lista_Campuri +Lparameters tcAlias + +Local lcSelect, i, lcAlias, lcLista +lcLista = [] +lcSelect = Select() +lcAlias = tcAlias + +Select (lcAlias) +lnFields = Fcount() +For i = 1 To lnFields + lcField = Field(i) + lcLista = lcLista + [,] + lcField +Endfor +If !Empty(lcLista) + lcLista = Substr(lcLista,2) +Endif + +Select (lcSelect) +Return lcLista + +Endfunc && Lista_Campuri +***---------------------------------------- + +Procedure NRORD +Parameters ALI +Sele &ALI +A=Reccount() +If A=0 + Return +Endif +If A>65000 + Return 0 +Endif +Declare NROR(A) +K=0 +Scan + K=K+1 + NROR(K)=Recno() +Endscan +Return + +******************** +Function NRCRT +NR=Ascan(NROR,Recno()) +Return NR +********************** + +***---------------------------------------- +Function caps_first +Lparameters tcMesaj +Local lcMesaj +If !Empty(tcMesaj) And Len(tcMesaj)>1 + lcMesaj=Upper(Substr(tcMesaj,1,1))+Strtran(Lower(Substr(tcMesaj,2)),[oracle],[Oracle]) +Else + lcMesaj=Upper(tcMesaj) +Endif +Return lcMesaj +Endfunc && caps_first +***---------------------------------------- + +*!* FUNCTION ultima_zi_din_luna +*!* PARAMETERS tcAnul, tcLuna +*!* +*!* LOCAL ldData +*!* ldData = DATE(VAL(tcAnul),VAL(tcLuna), 1) +*!* ldData = GOMONTH(ldData,1) +*!* ldData = DATE(YEAR(ldData),MONTH(ldData), 1) - 1 +*!* RETURN ldData +*!* ENDFUNC + +Function ultima_zi_din_luna +Parameters tcAnul, tcLuna + +Local ldData, lcAnul, lcLuna + +If Type('tcAnul') = 'N' + lcAnul = Transform(tcAnul) +Else + lcAnul = tcAnul +Endif +If Type('tcLuna') = 'N' + lcLuna = Transform(tcLuna) +Else + lcLuna = tcLuna +Endif + +ldData = Date(Val(lcAnul),Val(lcLuna), 1) +ldData = Gomonth(ldData,1) +ldData = Date(Year(ldData),Month(ldData), 1) - 1 +Return ldData +Endfunc + + + +****************************************************************************** + +Procedure viz_prg_instalat +If Used('v_programe_instalate') + Use In v_programe_instalate +Endif +*!* lcSql = [select * from vdef_util_programe where id_util=]+Alltrim(Str(gnIdUtil))+; +*!* [ order by ordine] +lcSql = [{call contafin_oracle.pack_drepturi.programe_utilizator(]+Alltrim(Str(gnIdUtil))+[)}] +lcCursor = [v_programe_instalate] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +goExecutor.Oreset() + +Endproc +****************************************************************************** +Procedure lansare_toolbar + +Do viz_prg_instalat In oproceduri_comune.prg + +If Used('v_programe_instalate') And Reccount('v_programe_instalate') > 0 + + otool = Createobject('toolset') + + With otool.tool1 + If Used('v_programe_favorite') + Use In v_programe_favorite + Endif + Select * From v_programe_instalate Where favorit=1 Order By ordine_favorit Into Cursor v_programe_favorite + Select v_programe_favorite + Scan + + If Type('gcappname')='C' + If gcappname=Upper(Alltrim(nume)) + Loop + Endif + Endif + + lnParametru_prog = parametru_prog && pt. programul de Contracte - clienti si furnizori + lcParametru_prog = Alltrim(Str(Nvl(lnParametru_prog,0))) + + lnIdProgram=id_program + lcIdProgram=Alltrim(Str(lnIdProgram)) + lcNumeProgram=Proper(Alltrim(explicatie)) + + lcImagine=Upper(Alltrim(nume))+".png" &&nume poza + + lcCaleImagine=gcappPath+'grafice\'+lcImagine &&cale imagine + If !File(lcCaleImagine) + lcImagine = 'na.png' + lcCaleImagine=gcappPath+'grafice\na.png' + Endif + lnIdGrupProg=id_grup_prog + lnIdGrupProgFav=0 + lcCaleProgram = dirgen+Iif(Empty(Director),Juststem(nume),Alltrim(Director))+[\]+; &&cale program + Juststem(Alltrim(nume))+[.exe] + lcParametru = gcHost + [;] + gcuserName + [;] + gcPassword + [;] + Alltrim(Str(gnIdUtil)) + [;] + ; + lcIdProgram + [;] + lcParametru_prog + [;] &¶metri + lcComandaProgram=[run /n ] + lcCaleProgram +[ ]+lcParametru + + lcImgNume="img_"+lcIdProgram+"_"+lcParametru_prog + + If lnIdProgram>0 + .AddObject(lcImgNume,'img_program') + .&lcImgNume..comanda_program = lcComandaProgram &&adaug poza + .&lcImgNume..Picture = lcImagine + .&lcImgNume..ToolTipText = lcNumeProgram + .&lcImgNume..Visible=.T. + Endif + + + Endscan + + .Dock(0) + .Show + Endwith +Endif + +If Used('v_programe_instalate') + Use In v_programe_instalate +Endif + +If Used('v_programe_favorite') + Use In v_programe_favorite +Endif + +Endproc +***--------------------------------------------------------------------------------------------------------------------------------------- +***--------------------------------------------------------------------------------------------------------------------------------------- +Procedure ceretitlu_rap +Parameters tcMesaj,tctitlu + +Local lcTitlu +lcTitlu = tctitlu +obj1=Createobject("frm_cere_titlu") +obj1.clb_tx_simplu1.lb_simplu1.Caption = tcMesaj +obj1.clb_tx_simplu1.text_simplu1.ControlSource = 'lctitlu' +obj1.Show(1) +Return lcTitlu + +Endproc +***--------------------------------------------------------------------------------------------------------------------------------------- +***------------------------------------------------------------------------------------------- +Procedure cursor2lista +Lparameters tcCursor, tcColumn,tcSeparator +&& tcCursor - cursor +&& tcColumn - coloana din cursor care va constitui lista +&& tcSeparator separatorul de elemente din tcLista - default este ";" - este optional +&& intoarce lista de valori separate prin separatori +&& ex: lcLista = cursor2lista("cursor","id",";") +Local lcLista,lcSeparator, lcSelect + +lcLista = "" +lcSeparator = Iif(!Empty(tcSeparator) And Type('tcSeparator') = 'C', tcSeparator, ";") +If Used(tcCursor) + lcSelect = Select() + lcColumn = tcCursor + "." + tcColumn + If Type(lcColumn) # 'U' + Select &tcColumn From (tcCursor) Into Cursor crsListaTemp + + Select crsListaTemp + Scan + lcLista = lcLista + Alltrim(Transform(Evaluate(tcColumn))) + lcSeparator + Endscan + Use In crsListaTemp + + If !Empty(lcLista) + lcLista = Left(lcLista, Len(lcLista) - 1) + Endif + Endif + + + Select (lcSelect) +Endif + +Return lcLista + +Endproc && cursor2lista + +***------------------------------------------------------------------------------------------- +***------------------------------------------------------------------------------------------- +Procedure GETCALLSTACK +Local nPos +nPos=Program(-1) - 2 + + +Local cCallStack,i +cCallStack="" +For i=nPos To 1 Step -1 + cCallStack=cCallStack + Program(i) + Chr(13)+Chr(10) +Endfor + + +Return cCallStack + +Endproc && GETCALLSTACK +***------------------------------------------------------------------------------------------- +&& -------------------------- INCEPUT verific_cont ------------------------------ +Procedure verific_cont +Parameters tcCont, tlNoMessage + +Private pcCont +pcCont = Alltrim(tcCont) + +&& verificare contului cu Planul de Conturi +lcSel = [SELECT cont from ] + GCS + [.vplcont_sintetic WHERE TRIM(cont) = ?pcCont and an = ?gnAn ] +lcCursor = 'crs_verific' +lnSucces = goExecutor.oExecute(lcSel,lcCursor) +If lnSucces < 0 + AMESSAGEBOX(goExecutor.cEroare,0+16,"Eroare") +Endif + +If lnSucces > 0 + If Reccount('crs_verific')=0 + lnSucces = -1 + Endif +Endif + +If lnSucces < 0 And !tlNoMessage + AMESSAGEBOX('Acest cont nu este definit in planul de conturi!',0+48, 'Atentie') +Endif + +Return lnSucces + +Endproc + +&& -------------------------- SFARSIT verific_cont ------------------------------ + +* ===================== GetHash ==================================== +* INTOARCE UN OBIECT DE TIP HASH CREAT DIN tcPropertyValueList +*!* loHash = GetHash([cselect=>select id, name from test??cwhere=>id=pnId??corder=>name]) +*!* lnMembers = AMEMBERS(laMembers, loHash) +*!* FOR i = 1 TO lnMembers +*!* MESSAGEBOX(loHash.&laMembers(i)) +*!* ENDFOR +* ================================================================== +Function GetHash +Lparameters tcPropertyValueList + +Local loHash + +loHash = Createobject("MyHash", tcPropertyValueList) +Return loHash + +Endfunc + + +* ===================== MyHash ==================================== +* OBIECT EMULARE HASH +* loHash = GetHash([cselect=>select id, name from test??cwhere=>id=pnId??corder=>name]) +* ================================================================== +Define Class MyHash As Custom + + + Procedure ReadMe + If .F. + Local loHash + loHash = Createobject("MyHash", [cselect=>select id, name from test??cwhere=>id=pnId??corder=>name]) + Endif + Endproc && readme + +*!* sir "proprietate1=>valoare1??proprietate2=>valoare2" +*!* genereaza proprietati si valori din sirul initial + Procedure Init + Lparameters tcPropertyValueList + + Local i, lnProperties, lcPropertyValue, lcValue, luValue + +&& tcPropertyValueList = [cselect =>ala bala portocala??cfiltru=>un filtru - atentie la spatiile din stanga valorii] + If Type('tcPropertyValueList') = 'C' And !Empty(tcPropertyValueList) + lnProperties = Getwordcount(tcPropertyValueList,'??') + For i = 1 To lnProperties + lcPropertyValue = Alltrim(Getwordnum(tcPropertyValueList,i,'??')) + If At('=>', lcPropertyValue) > 0 + lcProperty = Getwordnum(Strtran(lcPropertyValue,'=>',Chr(18)), 1, Chr(18)) + lcValue = Getwordnum(Strtran(lcPropertyValue,'=>',Chr(18)), 2, Chr(18)) + luValue = This.GetDefaultValue(lcProperty, lcValue) + This.SetValue(lcProperty, luValue) + Endif + Endfor + Endif + Endproc && INIT + +*!* Seteaza valoarea unei proprietati daca exista sau adauga proprietatea, si intoarce valoarea + Procedure SetValue + Lparameters tcProperty, tuValue + + If Type('THIS.&tcProperty') <> 'U' + This.&tcProperty = tuValue + Else + This.AddProperty(tcProperty, tuValue) + Endif + + Return This.&tcProperty + + Endproc && SetValue + +*!* Intoarce valoarea unei proprietati daca exista, altfel valoarea empty() corespunzator tipului proprietatii + Function GetValue + Lparameters tcProperty + + Local lcProperty, luValue + lcProperty = 'THIS.' + tcProperty + + If Type('THIS.&tcProperty') <> 'U' + luValue = This.&tcProperty + Else + luValue = This.GetDefaultValue(tcProperty) + Endif + Return luValue + + Endfunc && GetValue + +*!* Intoarce valoarea empty() a unei proprietati dupa tip = prima litera din numele proprietatii daca nu primeste decat tcProperty +*!* Converteste tcValue la tipul variabilei tcProperty daca tcValue e primit ca parametru + Function GetDefaultValue + Lparameters tcProperty, tcValue + + Local lcType, luValue + luValue = "" + lcType = Upper(Left(tcProperty,1)) + llEmptyValue = Iif(Pcount() = 1, .T., .F.) + + Do Case + Case lcType $ "CM" + luValue = Iif(llEmptyValue, '', tcValue) + Case lcType $ "NIF" + luValue = Iif(llEmptyValue, 0, Val(tcValue)) + Case lcType = "T" + luValue = Iif(llEmptyValue, Dtot({}), Ctot(tcValue)) + Case lcType = "D" + luValue = Iif(llEmptyValue, {}, Ctod(tcValue)) + Case lcType = "L" + luValue = Iif(llEmptyValue, .F., Iif(tcValue = "1" Or Upper(tcValue) = "T" Or Upper(tcValue) = '.T.' Or Upper(tcValue) = 'YES', .T., .F.)) + Otherwise + luValue = "" + Endcase + + Return luValue + Endfunc && GetDefaultValue + +*!* Intoarce .T. daca exista proprietatea + Function HasProperty + Lparameters tcProperty + + Local lcProperty, llReturn + lcProperty = 'THIS.' + tcProperty + llReturn = .F. + + If Type('THIS.&tcProperty') <> 'U' + llReturn = .T. + Endif + + Return llReturn + + Endfunc && HasProperty + +Enddefine && Hash + +Function get_zileluc( ) + +lnzileluc = 0 +lcSql = [select zileluc from ] + GCS + [.sal_calendar where an=?gnan and luna=?gnluna] +lcCursor = [v_zileluc] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +goExecutor.Oreset() +If lnSucces < 0 + AMESSAGEBOX(goExecutor.cEroare,0+16,"Eroare") + Return +Else + Select v_zileluc + lnzileluc = zileluc +Endif +Return lnzileluc + +******************************************* +* PROCEDURE param_listari( tcraport, tcTitlu, tcSemnaturi ) +* Date : 07/28/05, 14:04:21 +* author : liana.macinic +* description: + +****** PARAMETER BLOCK ************** +* Parameters : 3 +* Parameter 1: +* Parameter 2: +* Parameter 3: +* +******************************************* +Procedure param_listari( tcraport, tctitlu, tcSemnaturi, tlFaraTab) +Store '' To tctitlu, tcSemnaturi + +Local lnIdRaport +If Used('v_raport') + Use In v_raport +Endif + +lcSql = [select id_raport,titlu from ] + GCS + [.sal_nom_rapoarte where UPPER(raport) = ']+Upper(Alltrim(tcraport))+['] +lcCursor = [v_raport] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +goExecutor.Oreset() +If lnSucces < 0 + AMESSAGEBOX(goExecutor.cEroare,0+16,"Eroare") + Return +Endif +Select v_raport +lnIdRaport = v_raport.id_raport +tctitlu = v_raport.titlu +Use + + +If Used('v_date') + Use In v_date +Endif + +lcSql = [select semnatura,NUME from ] + GCS + [.sal_semnaturi_rap where id_raport = ]+Alltrim(Str(lnIdRaport))+[ and sters = 0 order by ordine] +lcCursor = [v_date] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +goExecutor.Oreset() +If lnSucces < 0 + AMESSAGEBOX(goExecutor.cEroare,0+16,"Eroare") + Return +Endif + +Local lcSemn,lcNumeRap,lcListaNumeRap +Store '' To lcSemn,lcNumeRap,lcListaNumeRap + + +Select v_date +Scan + Scatter Name lcDateRap Memo + lcSemn = Alltrim(Nvl(lcDateRap.semnatura,"")) + lcNumeRap = Alltrim(Nvl(lcDateRap.nume,'')) + If Len(lcSemn) => Len(lcNumeRap) + lcNumeRap = Padr(lcNumeRap,Len(lcSemn)," ") + Else + lcSemn= Padr(lcSemn,Len(lcNumeRap)," ") + Endif + If tlFaraTab + tcSemnaturi = tcSemnaturi+lcSemn + Else + tcSemnaturi = tcSemnaturi+Chr(9)+Chr(9)+lcSemn + Endif + + If tlFaraTab + lcListaNumeRap = lcListaNumeRap + lcNumeRap + Else + lcListaNumeRap = lcListaNumeRap + +Chr(9)+Chr(9)+lcNumeRap + Endif +Endscan + +tcSemnaturi = tcSemnaturi + Chr(13) + lcListaNumeRap +*!* SELECT v_date +*!* SCAN +*!* tcSemnaturi = tcSemnaturi+CHR(9)+CHR(9)+ALLTRIM(v_date.nume) +*!* ENDSCAN +*!* tcSemnaturi = tcSemnaturi+CHR(9)+CHR(9)+CHR(9)+CHR(9) +Select v_date +Use +Endproc +*----------------------------------sfarsit procedura param_listari---------------------------------- +** --------------------------------INCEPUT: facturi_duplicate ------------------------------ +Procedure facturi_duplicate +Parameters tcCont, tnId_Part, tnNract, tcMesajReturn + +Private pcCont, pnNract, pnId_part +Local lcMesaj, MesajReturn +lcMesaj = '' +pcCont = tcCont +pnId_part = tnId_Part +pnNract = tnNract +lcMesajReturn = tcMesajReturn + +If !(Alltrim(Str(pnNract))$lcMesajReturn) + If Inlist(Allt(pcCont),'4111','401','404') + lnTotctva = 0 + Do Case + Case Allt(pcCont) = '4111' + lcSql = [select count(*) as nr_ireg, sum(debit) as debit from ireg_parteneri ]+; + [ where an=?gnAn and luna=?gnLuna and cont = ?pcCont and nract = ?pnNract]+; + [ and extract(year from dataireg)*12+extract(month from dataireg) = ?gnAn*12+?gnLuna ] + lcCursor = [crsFactDbl] + lnSucces = goExecutor.oExecute(lcSql,lcCursor) + goExecutor.Oreset() + + If lnSucces < 0 + AMESSAGEBOX(goExecutor.cEroare,0+16,'Eroare') + Return + Endif + + Select crsFactDbl + If nr_ireg > 0 + lnTotctva = debit + lcMesaj = 'Factura '+Allt(Str(pnNract)) + ", "+ Alltrim(Transform(lnTotctva, get_mask(14,GnPA)))+' lei, mai exista inregistrata in luna curenta.' + Endif + + Case Allt(pcCont) = '401' + lcSql = [select count(*) as nr_ireg, sum(credit) as credit from ireg_parteneri ]+; + [ where an=?gnAn and luna=?gnLuna and cont = ?pcCont and nract = ?pnNract]+; + [ and extract(year from dataireg)*12+extract(month from dataireg) = ?gnAn*12+?gnLuna ]+; + [ and id_part = ?pnId_part] + lcCursor = [crsFactDbl] + lnSucces = goExecutor.oExecute(lcSql,lcCursor) + goExecutor.Oreset() + + If lnSucces < 0 + AMESSAGEBOX(goExecutor.cEroare,0+16,'Eroare') + Return + Endif + + Select crsFactDbl + If nr_ireg > 0 + lnTotctva = credit + lcMesaj = 'Factura '+Allt(Str(pnNract)) + ", "+ Alltrim(Transform(lnTotctva, get_mask(14,GnPA)))+' lei, mai exista inregistrata in luna curenta.' + Endif + Case Allt(pcCont) = '404' + lcSql = [select count(*) as nr_ireg, sum(credit) as credit from vireg_parteneri ]+; + [ where an=?gnAn and luna=?gnLuna and cont = ?pcCont and nract = ?pnNract]+; + [ and extract(year from dataireg)*12+extract(month from dataireg) = ?gnAn*12+?gnLuna ]+; + [ and id_part = ?pnId_part] + lcCursor = [crsFactDbl] + lnSucces = goExecutor.oExecute(lcSql,lcCursor) + goExecutor.Oreset() + + If lnSucces < 0 + AMESSAGEBOX(goExecutor.cEroare,0+16,'Eroare') + Return + Endif + + Select crsFactDbl + If nr_ireg > 0 + lnTotctva = credit + lcMesaj = 'Factura '+Allt(Str(pnNract)) + ", "+ Alltrim(Transform(lnTotctva, get_mask(14,GnPA)))+' lei, mai exista inregistrata in luna curenta.' + Endif + Endcase + + Endif +Endif + +Return lcMesaj + +Endproc && facturi_duplicate +&& ------------------------------SFARSIT: facturi_duplicate ------------------------------ + + + + diff --git a/Formulare/test_listare_factura/proceduri_rapoarte.prg b/Formulare/test_listare_factura/proceduri_rapoarte.prg new file mode 100644 index 0000000..8659319 --- /dev/null +++ b/Formulare/test_listare_factura/proceduri_rapoarte.prg @@ -0,0 +1,179 @@ +*!* PROCEDURI_RAPOARTE.PRG + + +*!* LISTARE RAPORT UTILIZATOR +*!* PARAMETRI : tcAlias - alias-ul cursorului; tcTipExport - FRX/XLS; tcRaport - numele raportului +*!* Se listeaza raportul USR_ din directorul \\SERVER\ROA\USERREPORTS\\\ daca exista +*!* Daca nu exista raporturl USR_ se listeaza raportul default +PROCEDURE LISTAREUSERREPORT +LPARAMETERS tcAlias, tcTipExport, tcRaport, toListener, tnPreview, tcImprimanta +** Valori pentru tnPreview +** 1 - cu vizualizare +** 2 - listare directa + +LOCAL lcSelect, lcRaportPath, lcTipExport, lnPreview, lcImprimanta +STORE [] TO lcImprimanta + +IF TYPE('tcTipExport') = 'C' + lcTipExport = UPPER(ALLTRIM(tcTipExport)) +ELSE + IF EMPTY(tcRaport) + lcTipExport = 'XLS' + ELSE + lcTipExport = 'FRX' + ENDIF +ENDIF +IF EMPTY(tcAlias) + RETURN +ENDIF +IF !USED(tcAlias) + RETURN +ENDIF +IF EMPTY(tnPreview) + lnPreview = 1 +ELSE + lnPreview = tnPreview +ENDIF + +DO CASE +CASE lcTipExport = 'FRX' + IF !EMPTY(tcImprimanta) +*!* verificare ca tcImprimanta este instalata pe calculatorul respectiv + IF APRINTERS(laPrinters) > 0 AND ASCAN(laPrinters,tcImprimanta,1,ALEN(laPrinters,1),1,15) > 0 + lcImprimanta = tcImprimanta + ENDIF + ENDIF + + RELEASE laPrinters + + lcRaportPath = getUserRepPath() + [USR_] + JUSTSTEM(tcRaport) + [.FRX] + + IF !FILE(lcRaportPath) + lcRaportPath = tcRaport + ENDIF + + lcSelect = SELECT() + IF !EMPTY(tcAlias) AND USED(tcAlias) + SELECT (tcAlias) + ENDIF + + lnRaspuns = 6 + DO WHILE lnRaspuns = 6 + TRY + IF !EMPTY(toListener) + REPORT FORM (lcRaportPath) OBJECT toListener + ELSE + IF lnPreview = 1 + KEYBOARD '{CTRL+F10}' + REPORT FORM (lcRaportPath) TO PRINTER PROMPT PREVIEW + ELSE + IF !EMPTY(lcImprimanta) + lcImprimantaTemp = SYS(6) + SET PRINTER TO NAME (lcImprimanta) + REPORT FORM (lcRaportPath) TO PRINTER + IF !EMPTY(NVL(lcImprimantaTemp,[])) + SET PRINTER TO (lcImprimantaTemp) + ELSE + SET PRINTER TO + ENDIF + ELSE + REPORT FORM (lcRaportPath) TO PRINTER PROMPT + ENDIF + ENDIF + ENDIF + lnRaspuns = 7 + CATCH TO oEroare + IF oEroare.MESSAGE='Error loading driver error.' + lnRaspuns = aMESSAGEBOX("Eroare la driverul imprimantei.Doriti sa reincercati listarea?",4+32+256,"Confirmare relistare") + ELSE + aMESSAGEBOX(oEroare.MESSAGE,16,"Eroare") + lnRaspuns = 7 + ENDIF + ENDTRY + ENDDO + + SELECT (lcSelect) + +CASE lcTipExport = 'XLS' + export_xls(tcAlias) +ENDCASE + + +ENDPROC && LISTAREUSERREPORT + +********************* INCEPUT Modifica_raport_utilizator ********************** +* PROCEDURE Modifica_raport_utilizator +* Date : 26.07.2006, 17:44:33 +* author : marius.mutu +PROCEDURE Modifica_raport_utilizator + +lcUserRepPath = getUserRepPath() +CD (lcUserRepPath) +lcFile = GETFILE("frx","Alegeti un raport","Alege") +IF FILE(lcFile) AND UPPER(JUSTEXT(lcFile)) = "FRX" + MODIFY REPORT (lcFile) +ENDIF + +ENDPROC && Modifica_raport_utilizator +********************* SFARSIT Modifica_raport_utilizator ********************** + +*!* INTOARCE DIRECTORUL CU RAPOARTE UTILIZATOR PENTRU APLICATIA, SCHEMA CURENTA +FUNCTION getUserRepPath +LOCAL lcAppPath, lcAppName, liAt, lcDirgen, lcUserRepPath +lcAppPath=ADDBS(JUSTPATH(SYS(16,0))) +lcAppName=ALLT(UPPE(JUSTSTEM(SYS(16,0)))) +liAt=RAT("\",lcAppPath,2) +lcDirgen=ADDBS(LEFT(lcAppPath,liAt-1)) +lcUserRepPath = lcDirgen + 'USERREPORTS\' +IF !DIRECTORY(lcUserRepPath) + MD (lcUserRepPath) +ENDIF +lcUserRepPath = lcUserRepPath + lcAppName + '\' +IF !DIRECTORY(lcUserRepPath) + MD (lcUserRepPath) +ENDIF +lcUserRepPath = lcUserRepPath + gcS + '\' +IF !DIRECTORY(lcUserRepPath) + MD (lcUserRepPath) +ENDIF + +RETURN lcUserRepPath + +ENDFUNC + +**************************************************************************** +*!* extrage frx din executabil pe disc in directorul USERREPORTS +PROCEDURE UserReport2File +LPARAMETERS tcRaport + +LOCAL lcRaport, lcFile +IF EMPTY(tcRaport) + lcRaport= INPUTBOX("Raport","Scrieti numele raportului","raport.frx") +ELSE + lcRaport = tcRaport +ENDIF + +IF EMPTY(lcRaport) + RETURN +ENDIF + +lcRaport = JUSTSTEM(lcRaport) + '.frx' +lcFile = getUserRepPath() + "USR_" + lcRaport +IF FILE(lcFile) + RETURN +ENDIF + +*!* TRY +*!* USE (lcRaport) IN 0 again SHARED ALIAS crsRaportTemp +*!* ENDTRY + +IF !FILE(lcRaport) + aMESSAGEBOX('Nu exista raportul ' + lcRaport) +ELSE + USE (lcRaport) IN 0 AGAIN SHARED ALIAS crsRaportTemp + SELECT crsRaportTemp + COPY TO (lcFile) + USE IN crsRaportTemp +ENDIF + +ENDPROC && UserReport2File \ No newline at end of file diff --git a/Formulare/test_listare_factura/sel.txt b/Formulare/test_listare_factura/sel.txt new file mode 100644 index 0000000..1ff89a1 --- /dev/null +++ b/Formulare/test_listare_factura/sel.txt @@ -0,0 +1 @@ +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,sysdate as dataora,tip_persoana,0 as capital_soc_var,0 as capital_soc_sub from jcsserver.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,null as dataora,tip_persoana,0 as capital_soc_var,0 as capital_soc_sub from jcsserver.nom_parteneri where sters = 0 and inactiv = 0 and id_part in (select id_partener from jcsserver.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,null as dataora,0 as tip_persoana,capital_soc_var,capital_soc_sub from syn_nom_firme where id_firma = ?gnIdFirma \ No newline at end of file diff --git a/Formulare/test_listare_factura/suma_in_vorbe.prg b/Formulare/test_listare_factura/suma_in_vorbe.prg new file mode 100644 index 0000000..eae5ff2 --- /dev/null +++ b/Formulare/test_listare_factura/suma_in_vorbe.prg @@ -0,0 +1,205 @@ +*!* Function SUMA_IN_VORBE +Parameter tnSuma +Local i,lit,numar1,numar2 +Store 0 To i,j,lnSuma,lnSuma2 +Store 1 To putere +Store '' To lit,numar1,numar2 +If Used('mila1') + Use In mila1 +Endif +Use mila1 In 0 Shared + +lnSuma=Round(tnSuma,2) +lnSuma2=(lnSuma-Int(lnSuma))*100 +lnSuma=Int(lnSuma) + +*!* lnSuma=ROUND(lnSuma,gnPa) +*!* FOR j=1 TO gnPa +*!* putere=10*putere +*!* ENDFOR +*!* lnSuma2=(lnSuma-Int(lnSuma))*putere + +numar1=Space(12) +*!* numar2=Space(gnPa) +numar2=Space(2) + +numar1=Str(lnSuma,12) +*!* numar2=Str(lnSuma2,gnPa) +numar2=Str(lnSuma2,2) + +Dimension A(12) +A(1)=Subs(numar1,12,1) +A(2)=Subs(numar1,11,1) +A(3)=Subs(numar1,10,1) +A(4)=Subs(numar1,9,1) +A(5)=Subs(numar1,8,1) +A(6)=Subs(numar1,7,1) +A(7)=Subs(numar1,6,1) +A(8)=Subs(numar1,5,1) +A(9)=Subs(numar1,4,1) +A(10)=Subs(numar1,3,1) +A(11)=Subs(numar1,2,1) +A(12)=Subs(numar1,1,1) +Sele mila1 +********************* +Loca For NR=Val(A(12)) +lit=lit+Alltri(cr1) + +If Val(A(11))=1 + If Val(A(10))=0 + Loca For NR=Val(A(11)) + lit=lit+Alltri(cr5) + Else + Loca For NR=Val(A(10)) + lit=lit+Alltri(cr4) + Endif +Else + If Val(A(10))=0 + Loca For NR=Val(A(11)) + lit=lit+Alltrim(cr5) + Else + Loca For NR=Val(A(11)) + lit=lit+Alltrim(cr2) + Loca For NR=Val(A(10)) + lit=lit+Alltrim(cr3) + Endif +Endif +Do Case +Case Val(A(12)) # 0 + lit=lit+' miliarde' +Case Val(A(11)) # 0 + lit=lit+' miliarde' +Case Val(A(10)) # 0 + lit=lit+' miliarde' +Endcase +*********************** +Loca For NR=Val(A(9)) +lit=lit+Alltri(cr1) + +If Val(A(8))=1 + If Val(A(7))=0 + Loca For NR=Val(A(8)) + lit=lit+Alltri(cr5) + Else + Loca For NR=Val(A(7)) + lit=lit+Alltri(cr4) + Endif +Else + If Val(A(7))=0 + Loca For NR=Val(A(8)) + lit=lit+Alltrim(cr5) + Else + Loca For NR=Val(A(8)) + lit=lit+Alltrim(cr2) + Loca For NR=Val(A(7)) + lit=lit+Alltrim(cr3) + Endif +Endif +Do Case +Case Val(A(9)) # 0 + lit=lit+' milioane' +Case Val(A(8)) # 0 + lit=lit+' milioane' +Case Val(A(7)) # 0 + lit=lit+' milioane' +Endcase +*********************** +Loca For NR=Val(A(6)) +lit=lit+Alltri(cr1) + +If Val(A(5))=1 + If Val(A(4))=0 + Loca For NR=Val(A(5)) + lit=lit+Alltri(cr5) + Else + Loca For NR=Val(A(4)) + lit=lit+Alltri(cr4) + Endif +Else + If Val(A(4))=0 + Loca For NR=Val(A(5)) + lit=lit+Alltrim(cr5) + Else + Loca For NR=Val(A(5)) + lit=lit+Alltrim(cr2) + Loca For NR=Val(A(4)) + lit=lit+Alltrim(cr3) + Endif +Endif +Do Case +Case Val(A(6)) # 0 + lit=lit+' mii' +Case Val(A(5)) # 0 + lit=lit+' mii' +Case Val(A(4)) # 0 + lit=lit+' mii' +Endcase + +********************* +Loca For NR=Val(A(3)) +lit=lit+Alltri(cr1) + +If Val(A(2))=1 + If Val(A(1))=0 + Loca For NR=Val(A(2)) + lit=lit+Alltri(cr5) + Else + Loca For NR=Val(A(1)) + lit=lit+Alltri(cr4) + Endif +Else + If Val(A(1))=0 + Loca For NR=Val(A(2)) + lit=lit+Alltrim(cr5) + Else + Loca For NR=Val(A(2)) + lit=lit+Alltrim(cr2) + Loca For NR=Val(A(1)) + lit=lit+Alltrim(cr3) + Endif +Endif +Do Case +Case Val(A(3)) # 0 + lit=lit+' lei' +Case Val(A(2)) # 0 + lit=lit+' lei' +Case Val(A(1)) # 0 + lit=lit+' lei' +Endcase + + +********************* +Do Case +Case lnSuma2>1 + lit=lit+' si' + Dimension B(2) + B(1)=Subs(numar2,2,1) + B(2)=Subs(numar2,1,1) + + Do Case + Case Val(B(2))=1 And Val(B(1))!=0 + Loca For NR=Val(B(1)) + lit=lit+Alltri(cr4) + Case Val(B(2))=0 + Loca For NR=Val(B(1)) + lit=lit+Alltrim(cr3) + Case Val(B(1))=0 + Loca For NR=Val(B(2)) + lit=lit+Alltrim(cr5) + Otherwise + Loca For NR=Val(B(2)) + lit=lit+Alltrim(cr2) + Loca For NR=Val(B(1)) + lit=lit+Alltrim(cr3) + Endcase + lit=lit+' bani' +Case lnSuma2=1 + lit=lit+'si un ban' +Endcase + +Sele mila1 +*!* use + +lit=Strtran(lit,' ','') +Use In mila1 +Return lit \ No newline at end of file diff --git a/Formulare/test_listare_factura/test_listare_factura.prg b/Formulare/test_listare_factura/test_listare_factura.prg new file mode 100644 index 0000000..cfb8b4d --- /dev/null +++ b/Formulare/test_listare_factura/test_listare_factura.prg @@ -0,0 +1,245 @@ +*tnIdClient,tcCursor,tcSirNrOrd,tcNrInmat,tnTipfact,tnProcDiscM,tnProcDiscN,tnDiscountM,tnDiscountN,tnDiscountTvaM,tnDiscountTvaN,tcdenop +SET DELETED ON +SET CENTURY ON +SET ANSI ON +SET EXACT ON +SET DATE DMY +SET SAFETY OFF + +*CLOSE DATABASES ALL + +lcDir = "C:\TEST_LISTARE_FACTURA\" +*lcDir = "d:\roa_rb\roaauto\test\test_listare_factura\" +CD (lcDir) +messagebox(lcDir) +lcHost = "roa_arrow" +lcUserName = "auto_arrow" +lcPassword = "123" +PRIVATE gnHandle +gnHandle = 0 +gnTIP_LFACTURA = 1 +plEmiteBon = .F. +PRIVATE gcS +gcS = lcUserName +PRIVATE gnIdFirma, gnIdUtil +gnIdFirma = 1 +gnIdUtil = 1 +PRIVATE GNCGARANTIE +GNCGARANTIE = 0 +PRIVATE GNPA, gnLuna, gnAn, gnAnRon, gnLunaRon, gnPc +gnLuna = 7 +gnAn = 2007 +gnAnRon = 2005 +gnLunaRon = 7 +gnPc = 2 +GNPA = 2 +pntotftva = 100 +pntottva = 19 +pntotctva = 119 +pcNumeresp = "" +pcbidresp = "" +pccnpresp = "" + +SET DEFAULT TO (lcDir) +SET PATH TO (lcDir) +SET PROCEDURE TO oproceduri_comune.prg ADDITIVE +SET PROCEDURE TO proceduri_rapoarte.prg ADDITIVE +SET PROCEDURE TO test_listare_factura.prg ADDITIVE + +PRIVATE goExecutor +goExecutor = CREATEOBJECT("oExecutor") + +PRIVATE goConn +goConn = CREATEOBJECT("oConn") +gnHandle = goConn.CONNECT(lcHost, lcUserName, lcPassword) + + +IF !USED('actactan') + USE actactan IN 0 SHARED +ENDIF + + +DO listare_factura WITH 34,"actactan","59/CT-02-ZIP","CT-02-ZIP",1,0,0,0,0,0,0,"MANOPERA" + +goConn.Disconnect() + +PROCEDURE listare_factura + PARAMETERS tnIdClient,tcCursor,tcSirNrOrd,tcNrInmat,tnTipfact,tnProcDiscM,tnProcDiscN,tnDiscountM,tnDiscountN,tnDiscountTvaM,tnDiscountTvaN,tcdenop + + 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)) + 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,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,] + ; + [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,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 + ptDataOra = poClient.dataora + CASE tip = 2 + WITH poDate + .nume_responsabil = denumire + .BIresp = reg_comert + .CNPresp = cod_fiscal + ENDWITH + OTHERWISE + SCATTER NAME poFirma + 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.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 ^ + + + REPORT FORM usr_factav_cuchit TO PRINTER PROMPT PREVIEW + + + RELEASE poDate +ENDPROC && listare_factura +********************************************************************************************************* + +DEFINE CLASS oDateFacturaDevize AS CUSTOM + devize_multiple = 0 + listanrord = [] + dataact = {} + datascad = {} + 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 + WITH THIS + .id_client = tnIdPartener + .nrinmat_del = tcNrInmat + .devize_multiple = tnDevize + .listanrord = tcSirNrOrd + ENDWITH + ENDPROC + +ENDDEFINE diff --git a/Formulare/test_listare_factura/usr_fact_cuchit.FRT b/Formulare/test_listare_factura/usr_fact_cuchit.FRT new file mode 100644 index 0000000..b9b037e Binary files /dev/null and b/Formulare/test_listare_factura/usr_fact_cuchit.FRT differ diff --git a/Formulare/test_listare_factura/usr_fact_cuchit.frx b/Formulare/test_listare_factura/usr_fact_cuchit.frx new file mode 100644 index 0000000..545f06c Binary files /dev/null and b/Formulare/test_listare_factura/usr_fact_cuchit.frx differ diff --git a/Formulare/test_listare_factura/usr_fact_farachit.FRT b/Formulare/test_listare_factura/usr_fact_farachit.FRT new file mode 100644 index 0000000..ddbbc59 Binary files /dev/null and b/Formulare/test_listare_factura/usr_fact_farachit.FRT differ diff --git a/Formulare/test_listare_factura/usr_fact_farachit.frx b/Formulare/test_listare_factura/usr_fact_farachit.frx new file mode 100644 index 0000000..6f7cde9 Binary files /dev/null and b/Formulare/test_listare_factura/usr_fact_farachit.frx differ diff --git a/Formulare/test_listare_factura/usr_factav_cuchit.frt b/Formulare/test_listare_factura/usr_factav_cuchit.frt new file mode 100644 index 0000000..791c52d Binary files /dev/null and b/Formulare/test_listare_factura/usr_factav_cuchit.frt differ diff --git a/Formulare/test_listare_factura/usr_factav_cuchit.frx b/Formulare/test_listare_factura/usr_factav_cuchit.frx new file mode 100644 index 0000000..03a4bfb Binary files /dev/null and b/Formulare/test_listare_factura/usr_factav_cuchit.frx differ diff --git a/Formulare/test_listare_factura/usr_factav_farachit.FRT b/Formulare/test_listare_factura/usr_factav_farachit.FRT new file mode 100644 index 0000000..1fc4fd1 Binary files /dev/null and b/Formulare/test_listare_factura/usr_factav_farachit.FRT differ diff --git a/Formulare/test_listare_factura/usr_factav_farachit.frx b/Formulare/test_listare_factura/usr_factav_farachit.frx new file mode 100644 index 0000000..1e1ce8b Binary files /dev/null and b/Formulare/test_listare_factura/usr_factav_farachit.frx differ diff --git a/Grafice/clie1.bmp b/Grafice/clie1.bmp new file mode 100644 index 0000000..e36837d Binary files /dev/null and b/Grafice/clie1.bmp differ diff --git a/Grafice/clie2.bmp b/Grafice/clie2.bmp new file mode 100644 index 0000000..e975ae0 Binary files /dev/null and b/Grafice/clie2.bmp differ diff --git a/Grafice/fact1.bmp b/Grafice/fact1.bmp new file mode 100644 index 0000000..ac20cdd Binary files /dev/null and b/Grafice/fact1.bmp differ diff --git a/Grafice/fact2.bmp b/Grafice/fact2.bmp new file mode 100644 index 0000000..d75176c Binary files /dev/null and b/Grafice/fact2.bmp differ diff --git a/Grafice/gene1.bmp b/Grafice/gene1.bmp new file mode 100644 index 0000000..0de72b1 Binary files /dev/null and b/Grafice/gene1.bmp differ diff --git a/Grafice/gene2.bmp b/Grafice/gene2.bmp new file mode 100644 index 0000000..c4f2c79 Binary files /dev/null and b/Grafice/gene2.bmp differ diff --git a/Grafice/logo_template.jpg b/Grafice/logo_template.jpg new file mode 100644 index 0000000..cf345bf Binary files /dev/null and b/Grafice/logo_template.jpg differ diff --git a/Grafice/norm1.bmp b/Grafice/norm1.bmp new file mode 100644 index 0000000..605b7f4 Binary files /dev/null and b/Grafice/norm1.bmp differ diff --git a/Grafice/norm2.bmp b/Grafice/norm2.bmp new file mode 100644 index 0000000..bef723a Binary files /dev/null and b/Grafice/norm2.bmp differ diff --git a/Grafice/roaauto.bmp b/Grafice/roaauto.bmp new file mode 100644 index 0000000..16ac086 Binary files /dev/null and b/Grafice/roaauto.bmp differ diff --git a/Grafice/valid1.bmp b/Grafice/valid1.bmp new file mode 100644 index 0000000..1dcb771 Binary files /dev/null and b/Grafice/valid1.bmp differ diff --git a/Grafice/valid2.bmp b/Grafice/valid2.bmp new file mode 100644 index 0000000..b8f16ef Binary files /dev/null and b/Grafice/valid2.bmp differ diff --git a/Help/manual_ROAAUTO.pdf b/Help/manual_ROAAUTO.pdf new file mode 100644 index 0000000..cfcb64f Binary files /dev/null and b/Help/manual_ROAAUTO.pdf differ diff --git a/Initializari/euro500t.txt.template b/Initializari/euro500t.txt.template new file mode 100644 index 0000000..ac80fb6 --- /dev/null +++ b/Initializari/euro500t.txt.template @@ -0,0 +1,5 @@ + /t /RO /com: /speed:38400 /ecr:10 /data_file: + + +[/com:n] [/speed:nnnn] [/ecr:nn] [/num:nn] [/o:nnn] [/start:nnn] [/len:nnn] [/cfg:ssssss] [/tel:ttttttt] +[/data_file:file] [/cfg_file:file] [/err_file:file] [/run_file :f ile] [/drm:drm] [/online_wait:time] diff --git a/Initializari/euro500t_erori.xml.template b/Initializari/euro500t_erori.xml.template new file mode 100644 index 0000000..4af1109 --- /dev/null +++ b/Initializari/euro500t_erori.xml.template @@ -0,0 +1,134 @@ + + +1 +Communication error +Eroare de comunicare + + + +3 +Not finished sale in ECR, firstly finish the sale! +Vanzare neterminata in ECR!Terminati mai intai vanzarea! + + + +4 +Tax assignment out of range, or not active tax! +Cota de tva inexistenta sau inactiva! + + + +5 +DPT assignment out of range +Departament inexistent! + + + +6 +Sale unit out of range! + + + + +7 +Quantity out of range + + + + +8 +Price out of range + + + + +9 +Forbidden Online in particular mode! + + + + +10 +Command out of range or 2 times called command "3" or "4"! + + + + +11 +PLU number out of range + + + + +12 +Text out of character set + + + + +13 +Payment value out of range + + + + +14 +Payment type out of range + + + + +15 +Currency out of range! + + + + +16 +Sale command but sale no started! + + + + +30 +Number of serial port out of range! +Numarul portului serial nu este valid! + + + +31 +ECR number out of range +Numarul casei de marcat nu este valid! + + + +32 +Incorrect ECR type! +Tipul casei de marcat specificat in fisierul de configurare este incorect! + + + +33 +Incorrect communication speed in SETUP.DAT file +Viteza de comunicare specificata in fisierul de configurare este incorecta! + + + +34 +Error in ITEMS.TXT +Eroare in fisierul ITEMS.TXT! + + + +35 +Time-out error +Casa de marcat nu este deschisa sau nu este conectata la computer! + + + +36 +To open SETUP.DAT file impossible or do not exist +Eroare la deschiderea fisierului de configurare! + + + \ No newline at end of file diff --git a/Initializari/roaauto_bon.xml.template b/Initializari/roaauto_bon.xml.template new file mode 100644 index 0000000..6a69700 --- /dev/null +++ b/Initializari/roaauto_bon.xml.template @@ -0,0 +1,11 @@ + + + +\INITIALIZARI\ +1 +C:\EURO500\ +ONLINE.EXE +ITEMS.TXT +1 + + \ No newline at end of file diff --git a/Meniuri/analize_prod_neterm.MNT b/Meniuri/analize_prod_neterm.MNT new file mode 100644 index 0000000..e42b13a Binary files /dev/null and b/Meniuri/analize_prod_neterm.MNT differ diff --git a/Meniuri/analize_prod_neterm.mnx b/Meniuri/analize_prod_neterm.mnx new file mode 100644 index 0000000..cddf5e5 Binary files /dev/null and b/Meniuri/analize_prod_neterm.mnx differ diff --git a/Meniuri/editscurt.MNT b/Meniuri/editscurt.MNT new file mode 100644 index 0000000..93b0b23 Binary files /dev/null and b/Meniuri/editscurt.MNT differ diff --git a/Meniuri/editscurt.mnx b/Meniuri/editscurt.mnx new file mode 100644 index 0000000..84a309f Binary files /dev/null and b/Meniuri/editscurt.mnx differ diff --git a/Meniuri/listari_facturi.MNT b/Meniuri/listari_facturi.MNT new file mode 100644 index 0000000..6e21380 Binary files /dev/null and b/Meniuri/listari_facturi.MNT differ diff --git a/Meniuri/listari_facturi.mnx b/Meniuri/listari_facturi.mnx new file mode 100644 index 0000000..24d6eab Binary files /dev/null and b/Meniuri/listari_facturi.mnx differ diff --git a/Meniuri/listari_manopera.MNT b/Meniuri/listari_manopera.MNT new file mode 100644 index 0000000..1732b6b Binary files /dev/null and b/Meniuri/listari_manopera.MNT differ diff --git a/Meniuri/listari_manopera.mnx b/Meniuri/listari_manopera.mnx new file mode 100644 index 0000000..6618eb2 Binary files /dev/null and b/Meniuri/listari_manopera.mnx differ diff --git a/Meniuri/roaauto.MNT b/Meniuri/roaauto.MNT new file mode 100644 index 0000000..6544a1c Binary files /dev/null and b/Meniuri/roaauto.MNT differ diff --git a/Meniuri/roaauto.mnx b/Meniuri/roaauto.mnx new file mode 100644 index 0000000..320e6b7 Binary files /dev/null and b/Meniuri/roaauto.mnx differ diff --git a/Meniuri/serii.MNT b/Meniuri/serii.MNT new file mode 100644 index 0000000..738d54c Binary files /dev/null and b/Meniuri/serii.MNT differ diff --git a/Meniuri/serii.mnx b/Meniuri/serii.mnx new file mode 100644 index 0000000..9780519 Binary files /dev/null and b/Meniuri/serii.mnx differ diff --git a/Meniuri/verificari.MNT b/Meniuri/verificari.MNT new file mode 100644 index 0000000..c1c398b Binary files /dev/null and b/Meniuri/verificari.MNT differ diff --git a/Meniuri/verificari.mnx b/Meniuri/verificari.mnx new file mode 100644 index 0000000..ac5db2a Binary files /dev/null and b/Meniuri/verificari.mnx differ diff --git a/Meniuri/verificari_com.MNT b/Meniuri/verificari_com.MNT new file mode 100644 index 0000000..e5e4e0a Binary files /dev/null and b/Meniuri/verificari_com.MNT differ diff --git a/Meniuri/verificari_com.mnx b/Meniuri/verificari_com.mnx new file mode 100644 index 0000000..85df782 Binary files /dev/null and b/Meniuri/verificari_com.mnx differ diff --git a/Programe/onom_devize.prg b/Programe/onom_devize.prg new file mode 100644 index 0000000..dfbc670 --- /dev/null +++ b/Programe/onom_devize.prg @@ -0,0 +1,437 @@ +******************************************* +* PROCEDURE viz_mecanici( ) +* Data/ora : 12/14/04, 14:16:18 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure viz_mecanici( ) + +Private pomecanici,pcschema1,pcselect1 +Store '' To pomecanici +If Used('v_mecanici') + Use In v_mecanici +Endif + +pcschema1=[''] +pcselect1=['select * from ] + gcS + [.auto_vmecanici where 1=2'] +pcorder1=[nume,prenume] +pcfiltru1 = [2=2] +llAfiseaza = .F. +gencursor('pomecanici','v_mecanici',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza) +pomecanici.ca_baza1.afisare() +ofrmmecanici=Createobject('frm_mecanici') +ofrmmecanici.Show(1) +Release pomecanici +Endproc + +**********************sfarsit procedura viz_mecanici******************* + +******************************************* +* PROCEDURE viz_asiguratori( ) +* Data/ora : 12/15/04, 15:57:12 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure viz_asiguratori( ) +&&code goes here +Local lnIdAsigurator +Private poasiguratori,pcschema1,pcselect1 +Store '' To poasiguratori +If Used('v_asiguratori') + Use In v_asiguratori +Endif + +pcschema1=[''] +pcselect1=['select * from ] + gcS + [.auto_vasiguratori where 1=2'] +pcorder1=[asigurator] +pcfiltru1 = [2=2] +llAfiseaza = .F. +gencursor('poasiguratori','v_asiguratori',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza) +poasiguratori.ca_baza1.afisare() + +Select v_asiguratori +Go Top +lnIdAsigurator=id_asigurator + +Private poinspector,pcschema2,pcselect2 +Store '' To poinspector +If Used('v_inspectori') + Use In v_inspectori +Endif + +pcschema2=[''] +pcselect2=['select * from ] + gcS + [.auto_vinspectori where 1=2'] +pcorder2=[inspector] +pcfiltru2 = [id_asigurator=]+Alltrim(Str(lnIdAsigurator)) +llAfiseaza = .F. +gencursor('poinspector','v_inspectori',pcselect2,pcfiltru2,pcschema2,pcorder2,llAfiseaza) +poinspector.ca_baza1.afisare() + +ofrmasig=Createobject('frm_asiguratori') +ofrmasig.Show(1) +Release poasiguratori + +Endproc + +**********************sfarsit procedura viz_asiguratori******************* +******************************************* +* PROCEDURE viz_masini_marci( ) +* Data/ora : 12/16/04, 09:15:00 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure viz_masini_marci() +Lparameters tlReturn +Local llReturn +Private pomarci,pcschema1,pcselect1 +Store '' To pomarci +If !Empty(tlReturn) + llReturn=tlReturn +Else + llReturn=.F. +Endif + +If Used('v_marci') + Use In v_marci +Endif +pcschema1=[''] +pcselect1=['select * from ] + gcS + [.auto_vmarci where 1=2'] +pcorder1=[marca] +pcfiltru1 = [2=2] +llAfiseaza = .F. +gencursor('pomarci','v_marci',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza) +pomarci.ca_baza1.afisare() + + +Private pomasini,pcschema2,pcselect2 +Store '' To pomasini +If Used('v_masini') + Use In v_masini +Endif +pcschema2=[''] +pcselect2=['select * from ] + gcS + [.auto_vmasini where 1=2'] +pcorder2=[masina] +pcfiltru2 = [2=2] +llAfiseaza = .F. +gencursor('pomasini','v_masini',pcselect2,pcfiltru2,pcschema2,pcorder2,llAfiseaza) +pomasini.ca_baza1.afisare() +SELECT v_masini +SET FILTER TO id_marca=v_marci.id_marca + +ofrmmarcimasini=Createobject('frm_marci_masini') +ofrmmarcimasini.lreturnval=llReturn +ofrmmarcimasini.Show(1) +Release pomasini,pomarci + +Endproc + +**********************sfarsit procedura viz_masini_marci******************* +******************************************* +* PROCEDURE viz_delegati( ) +* Data/ora : 12/16/04, 09:40:39 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +*!* Procedure viz_delegati +*!* Lparameters tnidpartener,tcpartener +*!* Private podelegati,pcschema1,pcselect1,odetalii +*!* LOCAL llAfiseaza +*!* Store '' To podelegati +*!* If Used('v_delegati') +*!* Use In v_delegati +*!* Endif +*!* pcschema1=[''] +*!* pcselect1=['select * from ] + gcS + [.dev_vdelegati where 1=2'] +*!* pcorder1=[delegat] +*!* *!* pcfiltru1=[sters=0] +*!* pcfiltru1=[1=2] +*!* llAfiseaza=.F. +*!* gencursor('podelegati','v_delegati',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza) +*!* podelegati.ca_baza1.afisare() +*!* ofrmdelegati=Createobject('frm_delegati',tnidpartener,tcpartener) +*!* ofrmdelegati.Show(1) + +*!* Select v_delegati +*!* Scatter Name odetalii +*!* Use In v_delegati +*!* Release podelegati +*!* Return odetalii +*!* Endproc + +**********************sfarsit procedura viz_delegati******************* +******************************************* +* PROCEDURE viz_norme( ) +* Data/ora : 12/16/04, 10:39:24 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure viz_norme( ) +Private ponorme,pcschema1,pcselect1 +Store '' To ponorme +If Used('v_norme') + Use In v_norme +Endif + +pcschema1=[''] +pcselect1=['select * from ] + gcS + [.auto_vnorme where 1=2'] +pcorder1=[masina,denop] +pcfiltru1 = [1=2] +llAfiseaza = .F. +gencursor('ponorme','v_norme',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza) +ponorme.ca_baza1.afisare() +ofrmnorme=Createobject('frm_norme') +ofrmnorme.Show(1) +Release ponorme + +Endproc + +**********************sfarsit procedura viz_norme******************* +******************************************* +* PROCEDURE viz_ansamble( ) +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure viz_ansamble( ) +Private ponorme,pcschema1,pcselect1 +Store '' To poansamble +If Used('v_ansamble') + Use In v_ansamble +Endif + +pcschema1=[''] +pcselect1=['select * from ] + gcS + [.auto_vansamble where 1=2'] +pcorder1=[denumire] +pcfiltru1 = [2=2] +llAfiseaza = .F. +gencursor('poansamble','v_ansamble',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza) +poansamble.ca_baza1.afisare() +ofrmansamble=Createobject('frm_ansamble') +ofrmansamble.Show(1) +Release poansamble,ofrmansamble +Endproc +**********************sfarsit procedura viz_norme******************* +******************************************* +* PROCEDURE viz_preturi( ) +* Data/ora : 12/16/04, 11:15:21 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure viz_preturi( ) +Private popreturi,pcschema1,pcselect1 +Store '' To popreturi +If Used('v_preturi') + Use In v_preturi +Endif +pcschema1=[''] +pcselect1=['select * from ] + gcS + [.auto_vpreturi where 1=2'] +pcorder1=[marca] +pcfiltru1 = [2=2] +llAfiseaza = .F. +gencursor('popreturi','v_preturi',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza) +popreturi.ca_baza1.afisare() +ofrmpreturi=Createobject('frm_preturi') +ofrmpreturi.Show(1) +Release popreturi + +Endproc + +**********************sfarsit procedura viz_preturi******************* + +******************************************* +* PROCEDURE viz_clienti( ) +* Data/ora : 12/27/04, 10:07:39 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure viz_clienti( ) +lparameters tlDoarMasiniActive && modificare v 2.1.1 + +Private poclie,pcschema1,pcselect1 +Local llAfiseaza +Store .F. To llAfiseaza +Store '' To poclie +If Used('v_clie') + Use In v_clie +Endif + +pcschema1=['id_part N(20),denumire C(254),nume C(254),prenume C(254),cod_fiscal C(254),reg_comert C(254),id_loc_inreg N(20),id_categorie_entitate N(20),'+] + ; + ['localitate_inreg C(254),prefix C(254),sufix C(254),tip_persoana N(20),banca C(254),cont_banca C(254),motiv_inactiv C(254),inactiv N(1),'+] + ; + ['eliberatde C(254),dataeliberat d,id_adresa N(20),adresa C(254),telefon C(254),telefon2 C(254),id_loc N(20),localitate C(254),'+] + ; + ['judet C(254),id_judet N(20),sector N(4),apart C(254),etaj C(254),scara C(254),bloc C(254),strada C(254),numar C(254),codpostal C(254),'+] + ; + ['categorie_entitate C(254)'] +pcselect1=[select b.id_part,b.denumire,b.nume,b.prenume,b.cod_fiscal,b.reg_comert,b.id_loc_inreg,b.id_categorie_entitate,b.localitate_inreg,b.prefix,] + ; + [b.sufix,b.tip_persoana,b.banca,b.cont_banca,b.motiv_inactiv,b.inactiv,b.eliberatde,b.dataeliberat,b.id_adresa,b.adresa,b.telefon,b.telefon2,b.id_loc,] + ; + [b.localitate,b.judet,b.id_judet,b.sector,b.apart,b.etaj,b.scara,b.bloc,b.strada,b.numar,b.codpostal,b.categorie_entitate ] + ; + [from ]+gcS+[.coresp_tip_part a left join ]+gcS+[.vnom_parteneri b ]+; + [on a.id_part=b.id_part where a.id_tip_part in ] + ; + [(select id_tip_part from coresp_tip_cont where cont = ?gcCont411) and b.inactiv=0] +pcorder1=[b.nume] +pcfiltru1 = [1 = 2] +llAfiseaza = .F. +gencursor('poclie','v_clie',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza) +poclie.ca_baza1.afisare() + +Private pomasini,pcschema2,pcselect2 +Store '' To pomasini +If Used('v_masiniclie') + Use In v_masiniclie +Endif + +pcschema2=[''] +*!* modificare v 2.1.1 +If tlDoarMasiniActive + pcselect2=['select * from ] + gcS + [.auto_vmasiniclienti where id_partener not in '+]+; + ['(select id_part from nom_parteneri where sters = 1 or inactiv = 1) and inactiv=0'] +Else +*!* modificare v 2.1.1 ^ + pcselect2=['select * from ] + gcS + [.auto_vmasiniclienti where id_partener not in '+]+; + ['(select id_part from nom_parteneri where sters = 1 or inactiv = 1)'] +*!* modificare v 2.1.1 +Endif +*!* modificare v 2.1.1 ^ +pcorder2=[masina] +pcfiltru2 = [1 = 2] +llAfiseaza = .F. +gencursor('pomasini','v_masiniclie',pcselect2,pcfiltru2,pcschema2,pcorder2,llAfiseaza) +pomasini.ca_baza1.afisare() + +Select v_clie +ofrmclienti=Createobject('frm_dev_clienti',tlDoarMasiniActive) && modificare v 2.1.1 +*!* IF gnNivelUtilizator=0 +*!* ofrmclienti.cmd_modifica1.visible=.T. +*!* ENDIF +ofrmclienti.Show(1) + +Release popreturi +Select v_masiniclie +Scatter Name omclie +Return omclie +Endproc + +**********************sfarsit procedura viz_clienti******************* + +******************************************* +* PROCEDURE viz_dealeri( ) +* Data/ora : 01/03/05, 16:51:46 +* autor : liana.macinic +* descriere: + +Procedure viz_dealeri( ) +Private podealeri,pcschema1,pcselect1 +Store '' To podealeri +If Used('v_furnizori') + Use In v_furnizori +Endif + +pcschema1=[''] +pcselect1=['select * from ] + gcS + [.auto_vfurnizori where 1=2'] +pcorder1=[denumire] +pcfiltru1 = [2=2] +llAfiseaza = .F. +gencursor('podealeri','v_furnizori',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza) +podealeri.ca_baza1.afisare() +ofrmdealeri=Createobject('frm_dealeri') +ofrmdealeri.Show(1) +Release podealeri + + +Endproc + +**********************sfarsit procedura viz_dealeri******************* +*------------------------------inceput procedura viz_responsabili----------------------------------------- +* PROCEDURE viz_responsabili( ) +* Data : 03/29/05, 10:05:19 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parameters : 0 +* +******************************************* +*!* PROCEDURE viz_resp( ) +*!* Local lnIdResp +*!* Private poResp,pcschema1,pcselect1 +*!* Store '' To poResp +*!* If Used('v_Resp') +*!* Use In v_Resp +*!* Endif + +*!* pcschema1=[''] +*!* pcselect1=['select * from ] + gcS + [.dev_vnom_resp where 1=2'] +*!* pcorder1=[ales] +*!* pcfiltru1 = [2=2] +*!* llAfiseaza = .F. +*!* gencursor('poResp','v_Resp',pcselect1,pcfiltru1,pcschema1,pcorder1,llAfiseaza) +*!* poResp.ca_baza1.afisare() + +*!* Select v_Resp +*!* Go Top +*!* lnIdResp=id_Resp + + +*!* ofrmResp=Createobject('frm_Resp') +*!* ofrmResp.Show(1) +*!* Release poResp + +*!* ENDPROC +*------------------------------sfarsit procedura viz_responsabili----------------------------------------- +*********************************************************************** +Procedure caut_marci_masini +Parameters tnPornire, tlDesktop,tlToateIreg + +Local lcCont, loCauta, lnPornire, llDesktop +lnPornire = tnPornire && 1-incepe cu...6-toate +llDesktop = tlDesktop + +Store "" To loCauta + +lcSelect = [select id_marca, marca FROM ] + gcS + [.auto_vmarci ] +lcFiltru = [1=2] +lcSchema = [] +lcOrder = [marca] +lccoloane = [marca] +lcTitlu = [Alegeti marca] +lcTitluColoane = [Marca] +lcFiltruOriginal = [inactiv = 0] +lcNumeProc = [] +If Empty(tlToateIreg) + llToateIreg = .F. +Else + llToateIreg = tlToateIreg +Endif +loCauta = cauta_alfa(lcSelect,lcFiltru,lcSchema,lcOrder,lccoloane,lcTitlu,lcTitluColoane, lcNumeProc, llToateIreg, lcFiltruOriginal,,lnPornire,,,llDesktop) + +Return loCauta +Endproc && caut_marci_masini +*********************************************************************** diff --git a/Programe/oproceduri_analize.prg b/Programe/oproceduri_analize.prg new file mode 100644 index 0000000..ee8799e --- /dev/null +++ b/Programe/oproceduri_analize.prg @@ -0,0 +1,1156 @@ +*!* 12.10.2015 +*!* marius.mutu +*!* valori_mat_bon, bon_com_nefact - fara comenzile arhivate INCHIS_FORTAT = 0 +*!* #4224 + +******************************************* +* PROCEDURE ver_valid_lun( ) +* Data/ora : 01/31/05, 09:19:02 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure ver_valid_lun( ) +*!* Private poordl,pcschema1,pcselect1 +*!* Store '' To poordl + +*!* pcschema1=[''] +*!* pcselect1=['select a.nrord,a.datai,a.nume,b.manopera,a.util_valid,a.dataoravalid '+] + ; +*!* ['from ] + gcS + [.dev_vordl a '+] + ; +*!* ['left join ] + gcS + [.dev_vordl_man b on a.id_ordl=b.id_ordl '+] + ; +*!* ['where 1=2'] +*!* pcorder1= [a.nrord] +*!* pcfiltru1 = [extract(month from a.dataoravalid) = ] + Alltrim(Str(gnLuna)) + [ and extract(year from a.dataoravalid) = ] + Alltrim(Str(gnAn)) + [ and a.validat = 1] +*!* gencursor('poordl','crsordl',pcselect1,pcfiltru1,pcschema1,pcorder1) +*!* poordl.ca_baza1.afisare() + +*!* If Reccount('crsordl')=0 +*!* Use In crsordl +*!* amessagebox("Nu exista comenzi validate in luna "+Alltrim(Str(gnLuna))+"/"+Alltrim(Str(gnAn))+" !",0+64,"Info listare") +*!* Return +*!* Endif + +*!* Private pcTitlu,pcDataora +*!* Store '' To pcTitlu,pcDataora +*!* pcTitlu = 'LISTA COMENZILOR VALIDATE IN CURSUL LUNII '+Alltrim(Str(gnLuna))+' / '+Alltrim(Str(gnAn)) +*!* pcDataora = get_ora(2) +*!* Select crsordl +*!* gofundal.Visible=.F. +*!* Keyboard "{ctrl+f10}" +*!* Report Form comvalidnef To Printer Prompt Preview +*!* gofundal.Visible=.T. +Endproc + +**********************sfarsit procedura ver_valid_lun******************* +******************************************* +* PROCEDURE ver_valid( ) +* Data/ora : 01/31/05, 10:39:49 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure ver_valid( ) + +*!* Private poordl,pcschema1,pcselect1 +*!* Store '' To poordl + +*!* pcschema1=[''] +*!* pcselect1=['select a.nrord,a.datai,a.nume,a.asigurator,a.util_valid,a.dataoravalid '+] + ; +*!* ['from ] + gcS + [.dev_vordl a '+] + ; +*!* ['where 1=2'] +*!* pcorder1= [a.nrord] +*!* pcfiltru1 = [a.validat = 1] +*!* gencursor('poordl','crsordl',pcselect1,pcfiltru1,pcschema1,pcorder1) +*!* poordl.ca_baza1.afisare() + +*!* If Reccount('crsordl')=0 +*!* Use In crsordl +*!* amessagebox("Nu exista comenzi validate!",0+64,"Info listare") +*!* Return +*!* Endif + +*!* Private pcTitlu,pcDataora +*!* Store '' To pcTitlu,pcDataora +*!* pcTitlu = 'LISTA COMENZILOR VALIDATE - TOTAL ' +*!* pcDataora = get_ora(2) +*!* gofundal.Visible=.F. +*!* Keyboard "{ctrl+f10}" +*!* Select crsordl +*!* Report Form comvalid To Printer Prompt Preview +*!* gofundal.Visible=.T. +Endproc + +**********************sfarsit procedura ver_valid******************* + +******************************************* +* PROCEDURE ver_nevalid( ) +* Data/ora : 01/31/05, 10:54:49 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure ver_nevalid( ) + +*!* Private poordl,pcschema1,pcselect1 +*!* Store '' To poordl + +*!* pcschema1=[''] +*!* pcselect1=['select a.nrord,a.datai,a.nume,a.asigurator,a.util_valid,a.dataoravalid '+] + ; +*!* ['from ] + gcS + [.dev_vordl a '+] + ; +*!* ['where 1=2'] +*!* pcorder1= [a.nrord] +*!* pcfiltru1 = [a.validat = 0] +*!* gencursor('poordl','crsordl',pcselect1,pcfiltru1,pcschema1,pcorder1) +*!* poordl.ca_baza1.afisare() + +*!* If Reccount('crsordl')=0 +*!* Use In crsordl +*!* amessagebox("Nu exista comenzi deschise si nevalidate in luna "+Alltrim(Str(gnLuna))+"/"+Alltrim(Str(gnAn))+" !",0+64,"Info listare") +*!* Return +*!* Endif + +*!* Private pcTitlu,pcDataora +*!* Store '' To pcTitlu,pcDataora +*!* pcTitlu = 'LISTA COMENZILOR NEVALIDATE - TOTAL ' +*!* pcDataora = get_ora(2) +*!* Select crsordl + +*!* Public titlu +*!* titlu='LISTA COMENZILOR DESCHISE SI NEVALIDATE IN LUNA '+Alltrim(Str(gnLuna))+' - '+Alltrim(Str(gnAn)) +*!* gofundal.Visible=.F. +*!* Keyboard "{ctrl+f10}" +*!* Report Form comvalid To Printer Prompt Preview +*!* gofundal.Visible=.T. +*!* *!* sele clie +*!* *!* set order to tag codc +*!* *!* sele ordl +*!* *!* SET RELATION TO codc INTO Clie ADDITIVE + +*!* *!* sele ordl +*!* *!* *set order to tag datai +*!* *!* set filter to !validat +*!* *!* report form comvalid to printer prompt preview +*!* *!* sele ordl +*!* *!* set filter to +*!* *!* sele ordl +*!* *!* SET RELATION off inTO Clie + +Endproc + +**********************sfarsit procedura ver_nevalid******************* +******************************************* +* PROCEDURE ver_nefact( ) +* Data/ora : 01/31/05, 11:00:23 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure ver_nefact( ) + +*!* Private pcselect,pcschema,pcfiltru,pcorder,pofacturi,llAfiseaza +*!* Store '' To pofacturi +*!* pcschema=[''] +*!* pcorder=[a.nume] +*!* pcselect=['select a.nrord,a.datai,a.nume,a.asigurator,a.validat,a.dataoravalid,a.util_valid from ] + gcS + [.dev_vvalid_comenzi a ]+; +*!* [where 1=2'] +*!* *!* pcfiltru=[b.luna=]+ALLTRIM(STR(gnLuna))+[ and b.an=]+ALLTRIM(STR(gnAn)) +*!* pcfiltru=[a.facturat = 0] + +*!* llAfiseaza=.F. +*!* gencursor('pofacturi','crsfacturi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza) +*!* pofacturi.ca_baza1.afisare() + +*!* If Reccount('crsfacturi')=0 +*!* Use In crsfacturi +*!* amessagebox("Nu exista comenzi nefacturate in luna "+Alltrim(Str(gnLuna))+"/"+Alltrim(Str(gnAn))+" !",0+64,"Info listare") +*!* Return +*!* Endif + +*!* Private pcTitlu,pcDataora +*!* Store '' To pcTitlu,pcDataora +*!* pcTitlu = 'LISTA COMENZILOR NEFACTURATE - LUNA '+Alltrim(Str(gnLuna))+' / '+ Alltrim(Str(gnAn)) +*!* pcDataora = get_ora(2) +*!* Select crsfacturi +*!* gofundal.Visible=.F. +*!* Keyboard "{ctrl+f10}" +*!* Report Form comfact To Printer Prompt Preview +*!* gofundal.Visible=.T. +Endproc + +**********************sfarsit procedura ver_nefact******************* +******************************************* +* PROCEDURE ver_valid_nefact( ) +* Data/ora : 01/31/05, 12:05:27 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure ver_valid_nefact( ) + +*!* Private pcselect,pcschema,pcfiltru,pcorder,pofacturi,llAfiseaza +*!* Store '' To pofacturi +*!* pcschema=[''] +*!* pcorder=[a.nume] +*!* pcselect=['select a.nrord,a.datai,a.nume,a.asigurator,a.validat,a.dataoravalid,a.util_valid from ] + gcS + [.dev_vvalid_comenzi a ]+; +*!* [where 1=2'] +*!* *!* pcfiltru=[b.luna=]+ALLTRIM(STR(gnLuna))+[ and b.an=]+ALLTRIM(STR(gnAn)) +*!* pcfiltru=[a.facturat = 0 and a.validat = 1 and extract(month from a.dataoravalid) = ]+Alltrim(Str(gnLuna))+ [ and extract(year from a.dataoravalid) = ]+Alltrim(Str(gnAn)) + +*!* llAfiseaza=.F. +*!* gencursor('pofacturi','crsfacturi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza) +*!* pofacturi.ca_baza1.afisare() + +*!* If Reccount('crsfacturi')=0 +*!* Use In crsfacturi +*!* amessagebox("Nu exista comenzi validate si nefacturate in luna "+Alltrim(Str(gnLuna))+"/"+Alltrim(Str(gnAn))+" !",0+64,"Info listare") +*!* Return +*!* Endif + +*!* Private pcTitlu,pcDataora +*!* Store '' To pcTitlu,pcDataora +*!* pcTitlu = 'LISTA COMENZILOR VALIDATE SI NEFACTURATE IN LUNA '+Alltrim(Str(gnLuna))+' / '+ Alltrim(Str(gnAn)) +*!* pcDataora = get_ora(2) + +*!* gofundal.Visible=.F. +*!* Keyboard "{ctrl+f10}" +*!* Select crsfacturi +*!* Report Form comfact To Printer Prompt Preview +*!* gofundal.Visible=.T. +*!* Use In crsfacturi + +Endproc +**********************sfarsit procedura ver_valid_nefact******************* + +******************************************* +* PROCEDURE ver_com_rep( ) +* Data/ora : 01/31/05, 12:45:31 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure ver_com_rep( ) + +*!* Private pcselect,pcschema,pcfiltru,pcorder,pofacturi,llAfiseaza +*!* Store '' To pofacturi +*!* pcschema=[''] +*!* pcorder=[nume] +*!* pcselect=['select nrord,datai,nume,asigurator,validat,facturat,datafact,dataoravalid,util_valid from ] + gcS + [.dev_vvalid_comenzi ]+; +*!* [where 1=2'] +*!* *!* pcfiltru=[b.luna=]+ALLTRIM(STR(gnLuna))+[ and b.an=]+ALLTRIM(STR(gnAn)) +*!* pcfiltru=[facturat = 0 and validat = 1 and extract(month from dataoravalid) = ]+Alltrim(Str(gnLuna))+ [ and extract(year from dataoravalid) = ]+Alltrim(Str(gnAn)) +*!* pcfiltru = [trunc(datai) < to_date('01/]+Alltrim(Str(gnLuna)) + [/]+Alltrim(Str(gnAn))+; +*!* [','dd/mm/yyyy') and ((trunc(datafact)?gnLuna+?gnAn*12)) ]+; + [AND INCH_VALIDARE = 0] +Else + lcFiltru = [EXTRACT(MONTH FROM DATAI)+EXTRACT(YEAR FROM DATAI)*12<=?gnLuna+?gnAn*12 AND ] + ; + [(((FACTURAT=0 OR (FACTURAT=1 AND EXTRACT(MONTH FROM DATAFACT)+EXTRACT(YEAR FROM DATAFACT)*12>?gnLuna+?gnAn*12)) ]+; + [AND INCH_VALIDARE = 0) OR ((VALIDAT=0 OR (VALIDAT=1 AND EXTRACT(MONTH FROM DATAORAVALID)+EXTRACT(YEAR FROM DATAORAVALID)*12>]+; + [?gnLuna+?gnAn*12)) AND INCH_VALIDARE = 1))] +Endif + +loTherm = Newobject("_thermometer","_therm","","Valori materiale bonate pe comenzi nefacturate...") +lcTask = "Generare raport..." +_Screen.MousePointer= 11 +With loTherm + .AlwaysOnTop=.T. + .Show() + + lnPercent = 5 + .Update(lnPercent, lcTask) + pcDataora=get_ora(2) + + lnPercent = 10 + .Update(lnPercent, lcTask) +*!* inlocuire dev_vvalid_comenzi + lcSql = [SELECT NUME,NRORD,DATAI,MATERIALE,ASIGURATOR FROM auto_VALIDARE_COMENZI WHERE ] + ; + [MATERIALE!=0 AND INCHIS_FORTAT = 0 and ] + lcFiltru + [ ORDER BY 2] + lnSucces = goExecutor.oExecute(lcSql,'crsmatnefact') + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,'Eroare') + Endif + .Complete() + .AlwaysOnTop=.F. +Endwith +Release loTherm +_Screen.MousePointer= 0 + +If Reccount('crsmatnefact')=0 + amessagebox("Nu exista valori materiale bonate pe comenzi nefacturate!",0+48,"Info analiza") + Return +Endif + +gofundal.Visible=.F. +Keyboard "{ctrl+f10}" +Select crsmatnefact +*!* Report Form matnefact To Printer Prompt Preview +goExport.export2frx('crsmatnefact','matnefact ',.F., , , , , .T.) +gofundal.Visible=.T. +Use In (SELECT('crsmatnefact')) + +Endproc +**********************sfarsit procedura valori_mat_bon ******************* +**********************inceput procedura bon_com_nefact_sectii ******************* +*!* Sele ordl.*,clie.nume From ordl,clie ; +*!* where !ordl.facturat And ordl.codc=clie.codc; +*!* and !Empty(ordl.nrord) And &cond; +*!* into Table &loc\&nfscurt\tempo\matnefact Order By nrord +*!* cond='((MONTH(DATAACT)<=VAL(M.NL) AND YEAR(DATAACT)=VAL(M.AN)) OR YEAR(DATAACT)?gnLuna+?gnAn*12)) ]+; + [AND A.INCH_VALIDARE=0] +Else +*!* lcFiltru = [EXTRACT(MONTH FROM A.DATAI)+EXTRACT(YEAR FROM A.DATAI)*12<=?gnLuna+?gnAn*12 AND ] + ; +*!* [((A.ID_LUCRARE NOT IN (SELECT ID_LUCRARE FROM ] + gcS + [.DEV_VORDL_FACTURI WHERE FACTURAT=1 ] + ; +*!* [AND EXTRACT(MONTH FROM DATAACT)+EXTRACT(YEAR FROM DATAACT)*12<=?gnLuna+?gnAn*12) AND A.ID_TIP=1)] + ; +*!* [OR ((A.VALIDAT=0 OR (A.VALIDAT=1 AND EXTRACT(MONTH FROM A.DATAORAVALID)+EXTRACT(YEAR FROM A.DATAORAVALID)*12>]+; +*!* [?gnLuna+?gnAn*12)) AND A.ID_TIP IN (2,3,4)))] + lcFiltru = [(((A.FACTURAT=0 OR ]+; + [(A.FACTURAT=1 AND EXTRACT(MONTH FROM A.DATAFACT)+EXTRACT(YEAR FROM A.DATAFACT)*12>?gnLuna+?gnAn*12)) ]+; + [AND A.INCH_VALIDARE=0) ]+; + [OR ((A.VALIDAT=0 OR ]+; + [(A.VALIDAT=1 AND EXTRACT(MONTH FROM A.DATAORAVALID)+EXTRACT(YEAR FROM A.DATAORAVALID)*12>?gnLuna+?gnAn*12)) ]+; + [AND A.INCH_VALIDARE=1))] +Endif + +If tlCuSectie + lcOrder = [ORDER BY 9,4] + lcExplicatie = [ - pe sectii] +Else + lcOrder = [ORDER BY 4] + lcExplicatie = [] +Endif + +loTherm = Newobject("_thermometer","_therm","","Bonuri pe comenzi nefacturate"+lcExplicatie+"...") +lcTask = "Generare raport..." +_Screen.MousePointer= 11 +With loTherm + .AlwaysOnTop=.T. + .Show() + + lnPercent = 5 + .Update(lnPercent, lcTask) + pcDataora=get_ora(2) + + lnPercent = 10 + .Update(lnPercent, lcTask) + + + lcSql=[SELECT A.ID_LUCRARE,A.NUME,A.DATAI,A.NRORD,B.ID_SECTIE,B.DATAACT,B.NRACT,]+; + [(case ]+; + [when b.luna+b.an*12<]+; + [pack_sesiune.GET_LUNARON()+pack_sesiune.GET_ANRON()*12]+; + [ and ]+; + [pack_sesiune.getAn()*12+pack_sesiune.getLuna()>=]+; + [pack_sesiune.GET_ANRON()*12+pack_sesiune.GET_LUNARON() ]+; + [then nvl(b.suma,0)/10000]+; + [ else ]+; + [nvl(b.suma,0) end ) ]+; + [as SUMA,C.SECTIE,D.NUME AS NRESP ]+; + [FROM auto_NORMARE_COMENZI A ]+; + [LEFT JOIN ACT B ON A.ID_LUCRARE=B.ID_LUCRARE ]+; + [LEFT JOIN VNOM_SECTII C ON B.ID_SECTIE=C.ID_SECTIE ]+; + [LEFT JOIN VNOM_RESPONSABILI D ON B.ID_RESPONSABIL=D.ID_RESPONSABIL ]+; + [WHERE EXTRACT(MONTH FROM A.DATAI)+EXTRACT(YEAR FROM A.DATAI)*12<=?gnLuna+?gnAn*12 AND A.INCHIS_FORTAT = 0 AND ]+; + lcFiltru +; + [AND B.STERS=0 AND B.SCD IN ('332','331') AND B.SCC='711' ]+; + [AND EXTRACT(MONTH FROM B.DATAACT)+EXTRACT(YEAR FROM B.DATAACT)*12<=?gnLuna+?gnAn*12 ] + ; + lcOrder + + + lnSucces = goExecutor.oExecute(lcSql,'crsmatnefact') + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,'Eroare') + Endif + .Complete() + .AlwaysOnTop=.F. +Endwith +Release loTherm +_Screen.MousePointer= 0 +*!* SELECT crsmatnefact +*!* BROWSE +If Reccount('crsmatnefact')=0 + amessagebox("Nu exista bonuri pe comenzi nefacturate!",0+48,"Info analiza") + Return +Endif + +gofundal.Visible=.F. +Keyboard "{ctrl+f10}" +Select crsmatnefact +If tlCuSectie +*!* Report Form matbon_sec To Printer Prompt Preview + goExport.export2frx('crsmatnefact','matbon_sec',.F., , , , , .T.) +Else +*!* Report Form matbon To Printer Prompt Preview + goExport.export2frx('crsmatnefact','matbon',.F., , , , , .T.) +ENDIF + + +gofundal.Visible=.T. +Use In (SELECT('crsmatnefact')) + +Endproc +**********************sfarsit procedura bon_com_nefact_sectii ******************* + +**********************inceput procedura raport_salarizare ******************* +Procedure raport_salarizare +Private pcDataora,plPerioada,pcondper,pcPerioada,pnLunaI,pnAnI,pnLunaF,pnAnF +Local lcOrder,lcSql,lcFiltru,lnSucces + +pcondper="" +ofrmperioada=Createobject('frm_perioada_luni') +ofrmperioada.Show(1) +If gnButon=2 + Return +Endif + +plPerioada=.F. +lnPoz=At('_',pcondper) +If lnPoz>0 + plPerioada=.T. +Endif + +If plPerioada + pnLunaI=Val(Substr(pcondper,1,2)) + pnAnI=Val(Substr(pcondper,3,4)) + pnLunaF=Val(Substr(pcondper,8,2)) + pnAnF=Val(Substr(pcondper,10,4)) + pcPerioada = [Perioada ]+ ; + SUBSTR(pcondper,1,2)+'/'+Substr(pcondper,3,4) + ' - ' + ; + SUBSTR(pcondper,8,2)+'/'+Substr(pcondper,10,4) +Else + pnLunaI=Val(Substr(pcondper,1,2)) + pnAnI=Val(Substr(pcondper,3,4)) + pnLunaF=pnLunaI + pnAnF=pnAnI + pcPerioada = [Luna ] + Substr(pcondper,1,2)+'/'+Substr(pcondper,3,4) +Endif + +loTherm = Newobject("_thermometer","_therm","","Raport de salarizare...") +lcTask = "Generare raport..." +_Screen.MousePointer= 11 +With loTherm + .AlwaysOnTop=.T. + .Show() + + lnPercent = 5 + .Update(lnPercent, lcTask) + pcDataora=get_ora(2) + + lnPercent = 10 + .Update(lnPercent, lcTask) + distribuire_timp_normat() + + lnPercent = 70 + .Update(lnPercent, lcTask) + 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 + + lnPercent = 80 + .Update(lnPercent, lcTask) + lcSql=[SELECT * FROM ]+gcS+[.AUTO_ANALIZA_SALARII_REG ORDER BY NUME] + + lnSucces = goExecutor.oExecute(lcSql,'crssalarii') + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,'Eroare') + Endif + .Complete() + .AlwaysOnTop=.F. +Endwith +Release loTherm +_Screen.MousePointer= 0 + +ofrmsalarii=Createobject("frm_raport_salarizare") +ofrmsalarii.Show(1) +Release ofrmsalarii,pcDataora,plPerioada,pcondper,pcPerioada,pnLunaI,pnAnI,pnLunaF,pnAnF +Endproc +**********************sfarsit procedura raport_salarizare ******************* +**********************inceput procedura raport_salarizare_val ******************* +Procedure raport_salarizare_val + Private pcDataora,pcTitlu,pcondper,pcPerioada,pnLunaI,pnAnI,pnLunaF,pnAnF + Local lcSql,lcCursor + lcCursor = [crssalarii] + pcondper="" + ofrmperioada=Createobject('frm_perioada_luni') + ofrmperioada.Show(1) + If gnButon=2 + Return + Endif + + If At('_',pcondper)>0 + pnLunaI=Val(Substr(pcondper,1,2)) + pnAnI=Val(Substr(pcondper,3,4)) + pnLunaF=Val(Substr(pcondper,8,2)) + pnAnF=Val(Substr(pcondper,10,4)) + pcPerioada = [Perioada ]+ ; + SUBSTR(pcondper,1,2)+'/'+Substr(pcondper,3,4) + ' - ' + ; + SUBSTR(pcondper,8,2)+'/'+Substr(pcondper,10,4) + Else + pnLunaI=Val(Substr(pcondper,1,2)) + pnAnI=Val(Substr(pcondper,3,4)) + pnLunaF=pnLunaI + pnAnF=pnAnI + pcPerioada = [Luna ] + Substr(pcondper,1,2)+'/'+Substr(pcondper,3,4) + Endif + + loTherm = Newobject("_thermometer","_therm","","Raport de salarizare - comenzi validate ...") + lcTask = "Generare raport..." + _Screen.MousePointer= 11 + With loTherm + .AlwaysOnTop=.T. + .Show() + + lnPercent = 5 + .Update(lnPercent, lcTask) + distribuire_timp_normat() + + lnPercent = 70 + .Update(lnPercent, lcTask) + lcSql = [begin pack_auto.set_perioada_raport(?pnLunaI,?pnAnI,?pnLunaF,?pnAnF); end;] + If goExecutor.oExecuta(lcSql) + lnPercent = 80 + .Update(lnPercent, lcTask) + lcSql=[SELECT * FROM ]+gcS+[.AUTO_ANALIZA_SALARII_VAL ORDER BY NUME] + goExecutor.oExecuta(lcSql,lcCursor) + Endif + .Complete() + .AlwaysOnTop=.F. + Endwith + Release loTherm + _Screen.MousePointer= 0 + + If Used(lcCursor) + If Reccount(lcCursor)>0 + pcDataora=Ttoc(get_ora()) + pcTitlu = [RAPORT DE SALARIZARE - COMENZI VALIDATE ÎN ] + goExport.export2frx([crssalarii],[salarii],.F., , , , , .T.) && modificare v 2.1.9 + Else + amessagebox("Nu exista inregistrari pentru listare!",0+48,"Atentie") + Endif + Use In (lcCursor) + Endif + Release pcDataora,pcTitlu,pcondper,pcPerioada,pnLunaI,pnAnI,pnLunaF,pnAnF +Endproc +**********************sfarsit procedura raport_salarizare_val ******************* +**********************inceput procedura manopera_asig ******************* +Procedure manopera_asig +Lparameters tlCuSectie +Private pcDataora,plPerioada,pcondper,pcPerioada +Local lcOrder,lcSql,lcFiltru,lnSucces + +pcondper="" +ofrmperioada=Createobject('frm_perioada_luni') +ofrmperioada.Show(1) +If gnButon=2 + Return +Endif + +plPerioada=.F. +lnPoz=At('_',pcondper) +If lnPoz>0 + plPerioada=.T. +Endif + +lcFiltru = [extract(month from (decode(e.inch_validare,0,last_day(trunc(c.dataact)),last_day(trunc(a.dataoravalid))))) + ] + ; + [extract(year from (decode(e.inch_validare,0,last_day(trunc(c.dataact)),last_day(trunc(a.dataoravalid))))) * 12 ] + +If plPerioada + lnInit=Val(Substr(pcondper,1,2))+Val(Substr(pcondper,3,4))*12 + lnFinal=Val(Substr(pcondper,8,2))+Val(Substr(pcondper,10,4))*12 + lcFiltru = lcFiltru + [ between ]+; + ALLTRIM(Str(lnInit))+[ and ]+Alltrim(Str(lnFinal)) + pcPerioada = [Perioada ]+ ; + SUBSTR(pcondper,1,2)+'/'+Substr(pcondper,3,4) + ' - ' + ; + SUBSTR(pcondper,8,2)+'/'+Substr(pcondper,10,4) +Else + lnInit = Val(Substr(pcondper,1,2))+Val(Substr(pcondper,3,4))*12 + lcFiltru = lcFiltru + [ = ]+; + ALLTRIM(Str(lnInit)) + pcPerioada = [Luna ] + Substr(pcondper,1,2)+'/'+Substr(pcondper,3,4) +Endif + +loTherm = Newobject("_thermometer","_therm","","Ore de manopera pe asiguratori...") +lcTask = "Generare raport..." +_Screen.MousePointer= 11 +With loTherm + .AlwaysOnTop=.T. + .Show() + + lnPercent = 5 + .Update(lnPercent, lcTask) + pcDataora=get_ora(2) + + lnPercent = 10 + .Update(lnPercent, lcTask) + +*!* lcSql=[SELECT TIP,LUNA,ASIG,TIMP_N FROM ]+gcS+[.DEV_ANALIZA_MANASIG ]+lcFiltru+; +*!* [ ORDER BY LUNA,TIP] + lcSql = [Select decode(a.id_tip, 1, 'POST GARANTIE', 2, 'GARANTIE', 'REGIE') As tip,] + ; + [NVL(d1.denumire, '') as asig,] + ; + [decode(e.inch_validare,0,last_day(trunc(c.dataact)),last_day(trunc(a.dataoravalid))) as luna,] + ; + [Nvl(Sum(round(b.timpn, 3)), 0) As timp_n ] + ; + [From ] + ; + [(select a.id_ordl, a.id_lucrare, a.id_asigurator, a.id_tip, ] + ; + [(case when extract(month from a.dataoravalid) + extract(year from a.dataoravalid) * 12 ] + ; + [<= pack_sesiune.getluna() + pack_sesiune.getan() * 12 then 1 else 0 end) as validat,] + ; + [(case when extract(month from a.dataoravalid) + extract(year from a.dataoravalid) * 12 ] + ; + [<= pack_sesiune.getluna() + pack_sesiune.getan() * 12 then a.dataoravalid else null end) as dataoravalid ] + ; + [from ] + gcS + [.dev_ordl a where a.sters = 0) a ] + ; + [Left Join ] + gcS + [.dev_oper b on a.id_ordl = b.id_ordl ] + ; + [left join ] + gcS + [.auto_vordl_facturi c on a.id_lucrare = c.id_lucrare ] + ; + [left join ] + gcS + [.dev_nom_asiguratori d on a.id_asigurator = d.id_asigurator ] + ; + [left join ] + gcS + [.nom_parteneri d1 on d.id_part = d1.id_part ] + ; + [left join ] + gcS + [.dev_tip_deviz e on a.id_tip = e.id_tip ] + ; + [Where ((a.validat = 1 and e.inch_validare = 1) or (nvl(c.facturat, 0) = 1 and e.inch_validare = 0)) ] + ; + [and ] + lcFiltru + [ and b.sters = 0 ] + ; + [Group By d1.denumire, a.id_tip, decode(e.inch_validare,0,last_day(trunc(c.dataact)),last_day(trunc(a.dataoravalid))) ] + ; + [order by 3,1,2] + + lnSucces = goExecutor.oExecute(lcSql,'manopera_asig') + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,'Eroare') + Endif + .Complete() + .AlwaysOnTop=.F. +Endwith +Release loTherm +_Screen.MousePointer= 0 + +If Reccount('manopera_asig')=0 + amessagebox("Nu exista inregistrari pentru acest raport!",0+64,"Raport manopera pe asiguratori") + Return +Endif + +Select manopera_asig +gofundal.Visible=.F. +Keyboard "{ctrl+f10}" +Report Form rap_manasig To Printer Prompt Preview +gofundal.Visible=.T. +Use In manopera_asig + +Endproc +**********************sfarsit procedura manopera_asig ******************* +******************************************************************************************* +Procedure verificare_articole +Private pcTitlu +Local lcCursorRaport, lcConditie, lcTitlu +lcConditie = [] +lcConditie2 = [] +lcCompletareTitlu = [] +pnOptiune=1 +pnButon=1 +lnRaspuns = 1 +Do While lnRaspuns = 1 + lcTitlu = [ARTICOLE PE COMENZI] + lcIntrebare="Doriti ca raportul sa contina :" + lnNrOptiuni=4 + ofrmopt=Createobject("frm_optiune",lcTitlu,lcIntrebare,lnNrOptiuni) + ofrmopt.ogOptiuni.option1.Caption="Ptr. un articol (cu intrari in luna)" + ofrmopt.ogOptiuni.option2.Caption="Ptr. un articol din stocul lunii" + ofrmopt.ogOptiuni.option3.Caption="Doar articolele cu intrari in luna" + ofrmopt.ogOptiuni.option4.Caption="Toate articolele din stocul lunii" + ofrmopt.Show(1) + + Release ofrmopt + If pnButon=1 + If Inlist(pnOptiune,1,3) + lcConditie = [and x.cant <> 0] + lcCompletareTitlu = [ CU INTRÃRI ÎN LUNÃ] + Endif + + If Inlist(pnOptiune,1,2) + loCauta = caut_articol() + If !Empty(Nvl(loCauta.id_articol,0)) + lcConditie2 = [and x.id_articol = ] + Alltrim(Str(loCauta.id_articol)) + lcTip = [ARTICOL] + Else + Return + Endif + Else + lcTip = [ARTICOLE] + Endif + + pcTitlu = [VERIFICÃRI ] + lcTip + lcCompletareTitlu + [ PE COMENZI] + + lcCursorRaport = [crsArticoleVerif] + Use In (Select(lcCursorRaport)) + lcSql = [select a.id_articol,d.denumire,d.codmat,d.um,a.pret,a.cants,a.cant,a.id_gestiune,] + ; + [b.nume_gestiune, b.cante, b.id_lucrare, e.nrord, NVL(c.facturat, 0) as facturat,a.nr_pag ] + ; + [from (select x.id_articol, x.id_gestiune, x.cont, x.acont, x.cants, x.cant,] + ; + [decode(q.nr_pag, 6, x.pretv, x.pret) as pret,q.nr_pag ] + ; + [from stoc x ] + ; + [left join nom_gestiuni q on x.id_gestiune = q.id_gestiune ] + ; + [where x.an = ?gnAn and x.luna = ?gnLuna ] + lcConditie + lcConditie2 + [) a ] + ; + [left join (select x.id_articol,decode(y.nr_pag, 6, x.pretv, x.pret) as pret,x.id_gestiune,] + ; + [x.cont,x.acont,x.id_lucrare,sum(nvl(x.cante, 0)) as cante,y.nume_gestiune ] + ; + [from rul x ] + ; + [left join nom_gestiuni y on x.id_gestiune = y.id_gestiune ] + ; + [where x.sters = 0 and x.cante <> 0 and x.an = ?gnAn and x.luna = ?gnLuna and x.id_tip_rulaj = 0 ] + lcConditie2 + ; + [group by x.id_gestiune, y.nume_gestiune, x.id_articol, decode(y.nr_pag, 6, x.pretv, x.pret),] + ; + [x.cont, x.acont, x.id_lucrare) b ] + ; + [on a.id_articol = b.id_articol and a.pret = b.pret and a.id_gestiune = b.id_gestiune ] + ; + [and NVL(a.cont, 'XXXX') = NVL(b.cont, 'XXXX') and NVL(a.acont, 'XXXX') = NVL(b.acont, 'XXXX') ] + ; + [left join auto_vordl_facturate c on b.id_lucrare = c.id_lucrare ] + ; + [left join nom_articole d on a.id_articol = d.id_articol ] + ; + [left join vnom_lucrari e on b.id_lucrare = e.id_lucrare ] + ; + [order by b.nume_gestiune, d.denumire, d.codmat, d.um, a.pret] + lnSucces = goExecutor.oExecute(lcSql,lcCursorRaport) + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,'Eroare') + Endif + If Used(lcCursorRaport) + If Reccount(lcCursorRaport) > 0 + Private pcDataora,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 + pcDataora = get_ora(2) + pcPerioada = [LUNA ] + Padl(Alltrim(Str(gnLuna)),2,[0]) + [/] + Alltrim(Str(gnAn)) + Select (lcCursorRaport) + Keyboard '{CTRL+F10}' + Report Form rap_articole_comenzi To Printer Prompt Preview + Case pnOptiune=2 + lcSirColoane=[nume_gestiune,denumire,codmat,um,nrord,facturat,cante,cant,cants] + lcSirNume=[Gestiune,Nume_articol,Cod_material,UM,Nr_comanda,Facturat,Iesiri,Intrari_in_luna,Stoc_precedent] + exportare(lcCursorRaport,lcSirColoane,lcSirNume) + Endcase + Release ofrmaleg + Enddo + Else + amessagebox("Nu exista inregistrari pentru listare!",0+48,"Atentie") + Endif + Use In (lcCursorRaport) + Endif + Else + lnRaspuns = 2 + Endif +Enddo +Endproc && verificare_articole +******************************************************************************************* + + +PROCEDURE viz_date_comenzi +PRIVATE poDateComenzi +poDateComenzi = '' + +TEXT TO lcSelect NOSHOW +select nrord, + id_part, + nume, + cod_fiscal, + datai, + asigurator, + inspector, + banca, + cont_banca, + adresa, + email, + telefon1, + telefon2, + nr_dosar, + validat, + id_masiniclient, + nrinmat, + series, + seriem, + culoare, + kmint, + id_masina, + id_marca, + marca, + masina, + semn, + id_lucrare, + codmat, + denumire, + cante, + pret, + data, + id + from auto_analiza_comenzi +ENDTEXT + +lcSchema = [nrord C(50),id_part N(12),nume C(70),cod_fiscal C(30),datai T,asigurator C(70),inspector C(24),banca C(40),] + ; +[cont_banca C(30),adresa C(250),email C(100),telefon1 C(30),telefon2 C(30),nr_dosar C(40),validat N(3),id_masiniclient (12),nrinmat C(40),] + ; +[series C(17),seriem C(18),culoare C(30),kmint N(12),id_masina N(7),id_marca N(7),marca C(24),masina C(20),semn C(1),] + ; +[id_lucrare N(20),codmat C(50),denumire C(100),cante N(20,4),pret N(20,4),data T,id N(20)] + + lcFiltru=[1=2] + lcOrder=[datai,nrord] + llAfiseaza=.F. + lcSchema = [] + llAfiseaza = .F. + lcgroup = [] + llModParam = .T. + lcFiltruOriginal = [] + + gencursor('poDateComenzi','crsDateComenzi', lcSelect, lcFiltru, lcSchema, lcOrder, llAfiseaza, lcgroup, llModParam, lcFiltruOriginal) + poDateComenzi.ca_baza1.afisare() + + + loFrmDate = CREATEOBJECT("frm_viz_date_comenzi") + loFrmDate.show(1) + + USE IN (SELECT('crsDateComenzi')) + USE IN (SELECT('commandes')) +ENDPROC && viz_date_comenzi \ No newline at end of file diff --git a/Programe/oproceduri_devize.prg b/Programe/oproceduri_devize.prg new file mode 100644 index 0000000..5ba69ef --- /dev/null +++ b/Programe/oproceduri_devize.prg @@ -0,0 +1,1795 @@ +*!* 12.06.2014 +*!* marius.mutu +*!* listeaza_bon_fiscal, listeaza_bon_fiscal_det - adaugat suma achitata prin CARD POS. suma achitata anterior se considera numerar + +*!* 24.08.2015 +*!* marius.mutu +*!* normare_comanda - vizualizare doar comenzi active (nearhivate) + +*!* 31.08.2015 +*!* marius.mutu +*!* generare_com, factureaza_comanda - salvare id partener care a referit comanda + +*!* 27.01.2016 +*!* marius.mutu +*!* factureaza_deviz - stornare avans se preiau proc_tvav si id_jtva_coloana din avansurile anterioare, in loc de cele standard din luna curenta + +*!* 29.01.2016 +*!* marius.mutu +*!* factureaza_deviz - listare cumulata articol REPARATII AUTO in loc de MANOPERA si MATERIALE + +*!* 23.11.2017 +*!* marius.mutu +*!* factureaza_deviz - tratare factura cu valoare 0 materiale si 0 manopera. se inregistreaza in scopul listarii. + +*!* 12.04.2021 +*!* marius.mutu +*!* generare_com + numarul de zile termen de executie comanda service + +*!* 08.07.2024 +*!* marius.mutu +*!* actualizare listare factura + lot C(20) + +*!* 18.10.2024 +*!* marius.mutu +*!* factureaza_deviz > pack_facturare.initializeaza_date_Factura + poDate.tip_saft + +******************************************* +* PROCEDURE generare_com( ) +* Data/ora : 01/05/05, 08:58:28 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure generare_com() + Parameters tnTipFactura + Private pnTipFactura, poGeneratorNumere + poGeneratorNumere = Createobject('oGeneratorNumere') + Local lcMesaj, lnTermenZile + + If Empty(tnTipFactura) + pnTipFactura=0 && 0 - daca vine din meniul de generare comenzi, 1 - ITP, 2 - spalare auto, 3 - diverse + lcMesaj="Nu puteti genera comenzi,deoarece aceasta luna este inchisa!" + Else + pnTipFactura=tnTipFactura + lcMesaj="Nu puteti emite facturi,deoarece aceasta luna este inchisa!" + Endif + + If glLunaInchisa + amessagebox(lcMesaj,0+48,"Luna inchisa") + Return + Endif + + Private pntipcom,pnNrCom + pntipcom = 1 + + If pnTipFactura=0 + ofrmtipcom = Createobject('frm_alegtipcom',@pntipcom) + *!* ofrmtipcom.ogtipcom.controlsource = "pntipcom" + ofrmtipcom.Show(1) + + If buton = 2 + Return + Endif + Endif + + *!* modificare v 2.0.28 + *!* lcSql = [select ] + gcS + [.getdev_comanda() as nrcom from dual] + *!* lcCursor = [crsNrCom] + *!* lnSucces = goExecutor.oExecute(lcSql,lcCursor) + *!* If lnSucces < 0 + *!* amessagebox(goExecutor.cEroare,0+16,"Eroare") + *!* Return + *!* Endif + *!* Select crsNrCom + *!* *!* modificare 31.10 + *!* Scatter Name ocomlistare + *!* *!* + *!* pnNrCom = Round(crsNrCom.nrcom,0) + Private poGeneratorNumere + poGeneratorNumere = Createobject('oGeneratorNumere') + ocomlistare = Createobject("Custom") + lnRezultat = poGeneratorNumere.creeaza_cursor_serii(20) + pnNrCom = poGeneratorNumere.aloca_numar(20,Null) + *!* modificare v 2.0.28 ^ + Do update_asigurator In update_devize.prg + Do update_inspector In update_devize.prg + + Private ofrmGencom,pcNr,pnIdInsp,pnIdAsig,pnIdMC,pnIdClie,pnIdOrdl,pnid_masina,pnKmInt,pnOreFct,pcNrDosar,pcSirIDOperatiiClient,pcObservatii,pcDefectiuni,pnIdPartRef + Store '' To pcNr,pcNrDosar,pcSirIDOperatiiClient, pcObservatii,pcDefectiuni + Store 0 To pnIdInsp,pnIdAsig,pnIdMC,pnIdClie,pnIdOrdl,pnid_masina,pnKmInt,pnOreFct,pdTermen, pnIdPartRef + + lnTermenZile = IIF(TYPE('gnTermenZileService') = 'N', m.gnTermenZileService, 10) && termenul implicit, daca nu exista optiune este de 10 zile + pdTermen = DATE() + m.lnTermenZile && termenul de pe comanda este data curenta + optiunea TermenZile + + pcNr = Alltrim(Str(pnNrCom)) + Do Case + Case pntipcom = 2 + pcNr = 'G' + Alltrim(Str(pnNrCom)) + Case pntipcom = 3 + pcNr = 'R' + Alltrim(Str(pnNrCom)) + Case pntipcom = 4 + pcNr = 'P' + Alltrim(Str(pnNrCom)) + Case pntipcom = 6 + pcNr = 'PR' + Alltrim(Str(pnNrCom)) + CASE pntipcom = 7 + pcNr = 'C' + Alltrim(Str(pnNrCom)) + Endcase + + Private pniesire + pniesire=0 + + If pnTipFactura=0 + *!* modificare 31.10 + *!* modificare v 2.0.9 + =update_norme([1=2]) && 1=2 > modificare v 2.0.18 + *!* modificare v 2.0.9 ^ + ofrmGencom = Createobject('frm_gencom',1,@pcNr,@pnIdInsp,@pnIdAsig,@pnIdMC,@pnIdClie,@pnid_masina,@pnKmInt,@pnOreFct,@pdTermen,@pcNrDosar,,,,@pcObservatii,@pcDefectiuni) + ofrmGencom.Show(1) + If pniesire!=1 + *!* modificare v 2.0.28 + poGeneratorNumere.dezaloca_numar(20) + Release poGeneratorNumere + *!* modificare v 2.0.28 ^ + Return + Endif + *!* modificare v 2.0.28 + poGeneratorNumere.verifica_numar(20,Val(Substr(pcNr,Iif(pntipcom=6,3,Iif(pntipcom=1,1,2)),At([/],pcNr,1)-Iif(pntipcom=6,3,Iif(pntipcom=1,1,2))))) + Release poGeneratorNumere + *!* modificare v 2.0.28 ^ + + pnIdOrdl = 0 + lcTermen = Iif(Empty(pdTermen) Or Isnull(pdTermen),'NULL',[']+Dtoc(pdTermen)+[']) + + lcSql = [begin pack_auto.dev_adauga_lucrare(?gcS,?gnAn,?gnLuna,?gnIdUtil,?pcNr,?pnIdInsp,] + ; + [?pnIdAsig,?pcNrDosar,?pnIdMC,?pnKmInt,?pnOreFct, to_date(]+lcTermen+[,'DD/MM/YYYY'),?pntipcom,?pcSirIDOperatiiClient, ?pcObservatii, ?pcDefectiuni, ?pnIdPartRef, ?@pnIdOrdl); end;] + + *!* lcSql = [begin pack_devize.dev_adauga_lucrare('] + gcS +[',] + Alltrim(Str(gnAn)) + [,] + Alltrim(Str(gnLuna))+; + *!* [, ]+ Alltrim(Str(gnIdUtil)) + [,'] + Alltrim(pcNr) + [',]+ Alltrim(Str(pnIdInsp)) + [,]; + *!* +Alltrim(Str(pnIdAsig))+[,]+Alltrim(Str(pnIdMC)) + [,] + Alltrim(Str(pnKmInt)) + [,to_date(]; + *!* +lcTermen+[,'DD/MM/YYYY'),?pntipcom,?@pnIdOrdl); end;] + lnSucces = goExecutor.oExecute(lcSql) + + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,'Eroare') + Return + Endif + *!* + + * Do listare_comanda With pntipcom && 22.06.2021 + DO listare_precomanda WITH m.pnIdOrdl + + Else + *!* modificare 31.10 + *!* nu se fac verificari ptr. km la bord pentru facturile de itp,de spalare si diverse + *!* modificare v 2.0.9 + =update_norme([1=2]) + *!* modificare v 2.0.9 ^ + ofrmGencom = Createobject('frm_gencom',2,@pcNr,@pnIdInsp,@pnIdAsig,@pnIdMC,@pnIdClie,@pnid_masina,@pnKmInt,@pnOreFct,@pdTermen,@pcNrDosar,,,,@pcObservatii,@pcDefectiuni) + With ofrmGencom + .lverificari=.F. + .clb_kmint.teXT_SIMPLU1.ReadOnly=.T. + .clb_termen.teXT_SIMPLU1.ReadOnly=.T. + Endwith + ofrmGencom.Show(1) + If pniesire!=1 + *!* modificare v 2.0.28 + poGeneratorNumere.dezaloca_numar(20) + Release poGeneratorNumere + *!* modificare v 2.0.28 ^ + Return + Endif + *!* + *!* modificare v 2.0.28 + poGeneratorNumere.verifica_numar(20,Val(Substr(pcNr,Iif(pntipcom=6,3,Iif(pntipcom=1,1,2)),At([/],pcNr,1)-Iif(pntipcom=6,3,Iif(pntipcom=1,1,2))))) + Do factureaza_comanda With pnTipFactura + Release poGeneratorNumere + *!* Do factureaza_comanda With pnTipFactura + *!* modificare v 2.0.28 ^ + Endif + Release poGeneratorNumere + +Endproc + +**********************sfarsit procedura generare_com******************* + +******************************************* +* PROCEDURE normare_comanda( ) +* Data/ora : 01/10/05, 11:50:13 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure normare_comanda( ) + If glLunaInchisa + amessagebox("Nu puteti norma comenzi,deoarece aceasta luna este inchisa!",0+48,"Luna inchisa") + Return + Endif + + Private pcValoare1,pcValoare2,pcIntre,pnCriteriu, pnCriteriu2, pcFiltruOra, pcFiltruVFP + Private pcselect,pcschema,pcfiltru,pcorder,pocomenzi,llAfiseaza + Store '' To pocomenzi + pcValoare1 = "" + pcValoare2 = "" + pnCriteriu = 1 + pnCriteriu2 = 1 + pcIntre = "" + pcFiltruOra = "" + pcFiltruVFP = "" + Do Form frm_filtru_text With "nrord","Nr. comanda",pnCriteriu,pnCriteriu2 To pcFiltruOra + + buton=2 + Private poordl,pcschema1,pcselect1 + Store '' To poordl + *!* pcschema1=['DATAI d,NRORD c(30),VALIDAT n(1),NUME c(50),NRINMAT c(10),ID_LUCRARE n(10),ID_ORDL n(10)'] + *!* pcselect1=['select datai,nrord,validat,nume,nrinmat,id_lucrare,id_ordl from ] + gcS + [.dev_vordl where 1=2'] + pcschema1=[''] + pcselect1=['select * from ] + gcS + [.auto_normare_comenzi a where 1=2'] + pcorder1=[datai] + If !Empty(pcFiltruOra) + pcFiltru1 = gcCondLuna + [ and a.inchis_fortat = 0 and a.validat=0 ] + pcFiltruOra + Else + pcFiltru1 = [1=2] + Endif + llAfiseaza = .F. + gencursor('poordl','cliord',pcselect1,pcFiltru1,pcschema1,pcorder1,llAfiseaza) + poordl.ca_baza1.afisare() + + ovs=Createobject('FRM_NOM_COM') + If !Empty(pcFiltruOra) + ovs.gcliord.SetAll('DynamicFontItalic','IIF(validat=1,.T.,.F.)','Column') + ovs.gcliord.SetAll('DynamicForeColor','IIF(validat=1,RGB(128,128,128),RGB(0,0,0))','Column') + *!* modificare v 2.0.17 + With ovs.ck_nrord + .cValoare1 = pcValoare1 + .cValoare2 = pcValoare2 + .criteriu = pnCriteriu + .criteriu2 = pnCriteriu2 + .cIntre = pcIntre + .filtru = pcFiltruOra + .filtru_vfp = pcFiltruVFP + .Value = 1 + Endwith + *!* modificare v 2.0.17 ^ + Endif + ovs.Show(1) + +Endproc +**********************sfarsit procedura normare_comanda******************* +******************************************* +* PROCEDURE dec2rgb( ) +* Data/ora : 02/11/05, 16:29:34 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure dec2rgb + Lparameters lnValue + + lTalk=Iif(Set('TALK')='ON',.T.,.F.) + Set Talk Off + + * Determine the hexadecimal equivalent of the decimal parameter passed + lcHex = "" + lnFactor = 24 && set up factor value one exponent greater than used + + For lnPos = 6 To 1 Step -1 + lnFactor = lnFactor - 4 && decrement factorial + lnExp = 2 ^ lnFactor && extrapolate next least power of two + For lnOrd = 15 To 1 Step -1 + If lnValue < lnExp && no value greater than current one, + lcHex = lcHex + "0" && so store a zero in this position + Exit && go back for the next value + Endif + If lnValue >= lnExp * lnOrd && is value greater than or equal to? + * find the matching hex value from its ordinal position + lcHex = lcHex + Substr('123456789ABCDEF', lnOrd, 1) + Exit + Endif + Endfor + lnValue = lnValue % lnExp && leave remainder of exponential division + Endfor + + * reverse the order of the individual color indicators + lcHex = Right(lcHex, 2) + Substr(lcHex, 3, 2) + Left(lcHex, 2) + + * convert the pairs into decimal values + lnPick = 2 && offset to determine which pair to convert + lcRGB = "" && start of string delineator + + * parse each color indicator and convert to decimal + For lnColor = 1 To 3 + lcHue = Substr(lcHex, (lnPick * lnColor) - 1, 2) && pull out color + lnMSB = Asc(Left(lcHue, 1)) && "Most Significant Bit" + lnLSB = Asc(Right(lcHue, 1)) && "Least Significant Bit" + + * subtract appropriate value from each to get decimal equivalent + lnMSB = lnMSB - Iif(lnMSB > 57, 55, 48) + lnLSB = lnLSB - Iif(lnLSB > 57, 55, 48) + + * then add decimals together + lcRGB = lcRGB + Transform( lnMSB * 16 + lnLSB, '999') + ", " + Endfor + lcRGB = Left(lcRGB, Len(lcRGB) - 2) + Return Alltrim(lcRGB) + +Endproc + +**********************sfarsit procedura dec2rgb******************* + + +*------------------------------inceput procedura calc_analitic----------------------------------------- +* PROCEDURE calc_analitic( tcCont, pcAct, ) +* Data : 03/15/05, 14:52:49 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parameters : 3 +* Parameter 1: +* Parameter 2: pcRul +* Parameter 3: +* +******************************************* +Procedure calc_analitic + Parameters tcCont,pcAct,pcRul + + Private pcCont,pcAct,pcRul,pParamP,pParamS + Store 0 To pParamP,pParamS + + lcAlias = Alias() + + pcCont = Alltrim(tcCont) + + lcSel = [SELECT * from ] + gcS + [.config_analitice WHERE cont = ?pcCont] + lcCursor = 'crs_cfg_ana' + lnSucces = goExecutor.oExecute(lcSel,lcCursor) + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,"Eroare") + Endif + + If lnSucces > 0 + If Reccount('crs_cfg_ana')=0 + Use In crs_cfg_ana + lnSucces = -1 + Endif + Endif + + If lnSucces > 0 + Select crs_cfg_ana + Scatter Name ocfg + lcCampPrefix = Nvl(Alltrim(ocfg.camp_leg_prefix),'') + lcCampSufix = Nvl(Alltrim(ocfg.camp_leg_sufix),'') + + + If !Empty(lcCampPrefix) + If Type('&pcRul..'+lcCampPrefix) # 'U' + pParamP = &pcRul..&lcCampPrefix + Else + If Type('&pcAct..'+lcCampPrefix) # 'U' + pParamP = &pcAct..&lcCampPrefix + Endif + Endif + Endif + + + If !Empty(lcCampSufix) + If Type('&pcRul..'+lcCampSufix) # 'U' + pParamS = &pcRul..&lcCampSufix + Else + If Type('&pcAct..'+lcCampSufix) # 'U' + pParamS = &pcAct..&lcCampSufix + Endif + Endif + Endif + + lcSel = [{call fconturi_analitice(?gcs,?pcCont,0,?pParamP,?pParamS)}] + lcCursor = 'crs_analitice' + lnSucces = goExecutor.oExecute(lcSel,lcCursor) + + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,"Eroare") + Endif + + Endif + + && iau Primul Simbol Analitic din Tabel - ordonat pt ca e selectat cu Distinct + If lnSucces > 0 + Select crs_analitice + Go Top + lcAnalitic = Alltrim(Left(acont,4)) + Endif + + && verificare analiticului cu Planul de Conturi + If lnSucces > 0 + lcSel = [SELECT cont,acont from ] + gcS + [.vplcont_analitic WHERE cont = ?pcCont and acont = ?lcAnalitic and an = ?gnAn ] + lcCursor = 'crs_verific' + lnSucces = goExecutor.oExecute(lcSel,lcCursor) + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,"Eroare") + Endif + Endif + + If lnSucces > 0 + If Reccount('crs_verific')=0 + lnSucces = -1 + Endif + Endif + + If Used('crs_cfg_ana') + Use In crs_cfg_ana + Endif + If Used('crs_verific') + Use In crs_verific + Endif + If Used('crs_analitice') + Use In crs_analitice + Endif + If Used('crs_verific') + Use In crs_verific + Endif + + If lnSucces < 0 + lcAnalitic = '' + Endif + + Select (lcAlias) + Return lcAnalitic + + + +Endproc +*------------------------------sfarsit procedura calc_analitic----------------------------------------- + +*------------------------------inceput procedura factureaza_deviz ----------------------------------------- +* PROCEDURE factureaza_deviz( ) +* Data : 03/16/05, 14:07:08 +* autor : liana.macinic +* descriere: facturare + +****** PARAMETER BLOCK ************** +* Parameters : 0 +* +******************************************* +Procedure factureaza_comanda + Lparameters tnTipFactura + Local lcTip,lnIdSet,lnTipFactura,lnTipListare + Local ofrmincasare As 'frm_incasare_avans' + Local ofrmnormsect As 'frm_aleg_operatie' + Local lcSql, lcTermen, lcTipJ, llTaxareInversa, lnLungime, lnProcTVA, lnSucces, loJtva + *:Global oCautare, oactan, ocomanda, oincasare, otva, pnid_norme, pnore, pntimpn, poactan + *:Global taValori[1], x + + Private pnid_norma,pnid_sectie,pcsectie,pcdenop,pnProcTva,pnTipIncasare,pnIdJtvaColoana,pnIdTva + Private pniesire,pnid_mecanic,pcnume,pocomenzi + Private pcselect,pcschema,pcfiltru,pcorder,llAfiseaza + Private pnIdOrdl + Store "" To oCautare,pocomenzi + Store 1 To pnTipIncasare + lnTipFactura=tnTipFactura + pnProcTva = 0 + pnIdTva = 0 + pnIdJtvaColoana = 0 + optiuni_firma() && reinitializare optiuni firma + Do Case + Case lnTipFactura = 1 + lcTip = 'ITP' + lnIdSet = 31003 + pnid_sectie=Nvl(gnid_sectie_itp,0) + If Empty(gnid_norme_itp) Or Isnull(gnid_norme_itp) + pnid_norme=0 + =ccnorme() + Else + pnid_norme=gnid_norme_itp + =ccnorme('NORMA',pnid_norme) + Endif + Case lnTipFactura = 2 + lcTip = 'SPALARE AUTO' + lnIdSet = 31004 + pnid_sectie=Nvl(gnid_sectie_spalare,0) + If Empty(gnid_norme_spalare) Or Isnull(gnid_norme_spalare) + pnid_norme=0 + =ccnorme() + Else + pnid_norme=gnid_norme_spalare + =ccnorme('NORMA',pnid_norme) + Endif + Case lnTipFactura = 3 + lcTip = 'DIVERSE' + lnIdSet = 31005 + pnid_sectie=0 + pnid_norme=0 + =ccnorme() + Endcase + pcdenop="" + pnid_mecanic=0 + pcsectie="" + pntimpn=1 + pnore=1 + Do ccsectii In update_devize.prg + =ccmecanici() + *!* If lnTipFactura = 1 + *!* pnid_norma = gnId_itp + *!* ofrmnormsect=Createobject('frm_aleg_sectie') + *!* ofrmnormsect.Show(1) + *!* Else + ****************************************** + && alegere denumire operatie + sectie + mecanic + timpn + ore + pniesire=0 + ofrmnormsect=Createobject('frm_aleg_operatie') + ofrmnormsect.Show(1) + *!* pnid_norma = gnid_spalare + *!* ofrmnormsect=Createobject('frm_aleg_sectie') + *!* ofrmnormsect.Show(1) + *!* Else + + *!* Endif + If pniesire !=1 + Return + Endif + ****************************************** + ****************************************** + *!* 27.07.2007 + *!* marius.mutu + *!* lnNumarFactura = aloca_numar_fact() + + && adaugare lucrare + SQLSetprop(gnHandle,"Transactions",2) + pnIdOrdl = 0 + *!* modificare v 2.0.14 + *!* lcSql = [begin pack_devize.dev_adauga_lucrare(?gcS,?gnAn,?gnLuna,?gnIdUtil,?pcNr,?pnIdInsp,] + ; + *!* [?pnIdAsig,?pcNrDosar,?pnIdMC,?pnKmInt,to_date(NULL,'DD/MM/YYYY'),?pntipcom,?@pnIdOrdl); end;] + lcTermen = Iif(Empty(pdTermen) Or Isnull(pdTermen),'NULL',[']+Dtoc(pdTermen)+[']) + lcSql = [begin pack_auto.dev_adauga_lucrare(?gcS,?gnAn,?gnLuna,?gnIdUtil,?pcNr,?pnIdInsp,] + ; + [?pnIdAsig,?pcNrDosar,?pnIdMC,?pnKmInt,?pnOreFct,to_date(]+lcTermen+[,'DD/MM/YYYY'),?pntipcom,?pcSirIDOperatiiClient, ?pcObservatii, ?pcDefectiuni, ?pnIdPartRef, ?@pnIdOrdl); end;] + *!* modificare v 2.0.14 ^ + lnSucces = goExecutor.oExecute(lcSql) + + If lnSucces < 0 + Sqlrollback(gnHandle) + SQLSetprop(gnHandle,"Transactions",1) + amessagebox(goExecutor.cEroare,0+16,'Eroare') + Return + Endif + + ****************************************** + + ****************************************** + If Used('crscomenzi') + Use In crsComenzi + Endif + pcschema=[''] + pcselect=['select * from ] + gcS + [.auto_ordl_facturare where 1=2'] + pcfiltru = [ id_ordl = ] + Alltrim(Str(pnIdOrdl)) + pcorder=[datai,nrord] + llAfiseaza=.F. + gencursor('pocomenzi','crscomenzi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza) + pocomenzi.ca_baza1.afisare() + Select crsComenzi + Scatter Name ocomanda + Use In crsComenzi + ****************************************** + + ****************************************** + && date factura + lnLungime=4 + Dimension taValori[lnLungime,3] + taValori[1,1]="poAct.v4111" + taValori[1,2]=Alltrim(ocomanda.nume) + taValori[1,3]=.T. + taValori[2,1]="poAct.nrord" + taValori[2,2]=Alltrim(ocomanda.nrord) + taValori[2,3]=.T. + taValori[3,1]="poAct.id_lucrare" + taValori[3,2]=Alltrim(Str(ocomanda.id_lucrare)) + taValori[3,3]=.T. + taValori[4,1]="poAct.id_vv4111" + taValori[4,2]=Alltrim(Str(ocomanda.id_partener)) + taValori[4,3]=.T. + + *!* taValori[5,1]="poAct.nract" + *!* taValori[5,2]=Alltrim(Str(lnNumarFactura)) + *!* taValori[5,3]=.F. + + If !Empty(pnid_sectie) + Dimension taValori[lnLungime+2,3] + taValori[lnLungime+1,1]="poAct.id_sectie" + taValori[lnLungime+1,2]=Alltrim(Str(pnid_sectie)) + taValori[lnLungime+1,3]=.T. + taValori[lnLungime+2,1]="poAct.sectie" + taValori[lnLungime+2,2]=Alltrim(pcsectie) + taValori[lnLungime+2,3]=.T. + lnLungime = lnLungime+2 + Endif + + Dimension taValori[lnLungime+2,3] + taValori[lnLungime+1,1]="poAct.id_fdoc" + *!* modificare v 2.0.28 + *!* taValori[lnLungime+1,2]=Alltrim(Str(gnid_fdoc_factura)) + taValori[lnLungime+1,2] = Iif(Empty(Nvl(pnIdAsig,0)),Alltrim(Str(gnid_fdoc_fact)),Alltrim(Str(gnid_fdoc_factasig))) + *!* modificare v 2.0.28 ^ + taValori[lnLungime+1,3]=.T. + taValori[lnLungime+2,1]="poAct.fdoc" + taValori[lnLungime+2,2]='FACTURA' + taValori[lnLungime+2,3]=.T. + lnLungime=lnLungime+2 + + lans(lnIdSet,.F.,.T.,@taValori) + + If buton=2 + Do deschid_actc + Sqlrollback(gnHandle) + SQLSetprop(gnHandle,"Transactions",1) + *!* Do dezaloca_numar_fact In oserii_numere.prg + poGeneratorNumere.dezaloca_numere() + Return + Endif + + *!* SELECT actactan + *!* GO TOP + *!* lnNumarFacturaAct = nract + *!* IF lnNumarFacturaAct <> lnNumarFactura + *!* DO dezaloca_numar_fact In oserii_numere.prg + *!* ENDIF + ****************************************** + + + ****************************************** + && introducere suma factura + incasare + Use In (SELECT('v_nom_casa')) + lcSql=[select id_part,nume from vcoresp_tip_part where tip_partener IN ('BANCA LEI', 'CASA LEI')] + lnSucces=goExecutor.oExecute(lcSql,'v_nom_casa') + If lnSucces < 0 + Sqlrollback(gnHandle) + SQLSetprop(gnHandle,"Transactions",1) + *!* Do dezaloca_numar_fact In oserii_numere.prg + poGeneratorNumere.dezaloca_numere() + amessagebox(goExecutor.cEroare,0+16,'Eroare') + Return + Endif + + local lnTvaIncasare, lcContTVA + Select actactan + Calculate Max(tva_incasare) To lnTvaIncasare && 0/1 + + lnProcTVA = GetProcTvaStandard() && 21 + lcTipJ = "JV" + llTaxareInversa = .F. + + pnIdJtvaColoana = ProcentTva2IdJtva(m.lnProcTVA, m.lcTipJ, m.llTaxareInversa, m.lnTvaIncasare) + loJtva = GeJtvaColoana(m.pnIdJtvaColoana, m.lnTVAIncasare, m.lcTipJ) + pnIdTva = loJtva.id_tva + pnProcTva = 1 + m.lnProcTVA / 100 + + lcContTVA = IIF(lnTvaIncasare = 1, [4428], [4427]) + + Private pnTotalfTva,pnTotalTva,pnTotalcTva,pnNrChit,pnIdCasa,pcCasa, pcSerieChit,pnPretCuTva, pnPOS + Store 0 To pnTotalfTva,pnTotalTva,pnTotalcTva,pnIdCasa,pnNrChit,pnPretCuTva, pnPOS + Store [] To pcSerieChit, pcCasa && modificare v 2.0.28 + pniesire=1 + *!* modificare v 2.0.42 : IIF(lnTipFactura=3,1,2) in loc de 1 + ofrmincasare=Createobject('frm_incasare_avans',lnTvaIncasare,IIF(lnTipFactura=3,1,2)) + ofrmincasare.lb_titlu_alb_b121.Caption=Upper(Alltrim("FACTURA "+lcTip)) + ofrmincasare.Show(1) + If pniesire!=1 + Sqlrollback(gnHandle) + SQLSetprop(gnHandle,"Transactions",1) + *!* Do dezaloca_numar_fact In oserii_numere.prg + poGeneratorNumere.dezaloca_numere() + Return + Endif + Use In v_nom_casa + ****************************************** + + Select actactan + Replace suma With pnTotalfTva,explicatia With "MANOPERA "+lcTip,id_jtva_coloana With pnIdJtvaColoana,proc_tva With pnProcTva For Alltrim(scc)='704' Or Alltrim(scc)='419' + Replace suma With pnTotalTva,explicatia With "TVA MANOPERA "+lcTip,id_sectie With pnid_sectie,sectie With pcsectie,id_jtva_coloana With pnIdTva,proc_tva With pnProcTva For scc=lcContTVA + *!* Replace proc_tva With m.ctvam,explicatia With "MANOPERA "+lcTip For Alltrim(scd)='411' + *!* modificare v 2.1.0 : am adaugat Alltrim(scd) = lcContTva + Replace proc_tva With pnProcTva For Alltrim(scd)='4111' or alltrim(scd) = lcContTva + + If pnTipIncasare>1 + *!* If !Empty(pnNrChit) + *!* incasare = 5311 + Select actactan + Go Top + Scatter Name oactan + Append Blank + Gather Name oactan Fields Except id_jtva_coloana,proc_tva && Fields Except suma, ascc, scc, id_partc + Replace nr_nota With Recno(),partc With partd, id_partc With id_partd, suma With pnTotalcTva + Replace scc With Alltrim(scd), ascc With ascd, scd With '5311', ascd With '', perecheC With nract,nract With pnNrChit + Replace id_partd With pnIdCasa,partd With m.pcCasa,neimpozab With 0, explicatia With 'INCASARE '+lcTip, id_factd With id_fact, datascad With {} + Do Case + Case pnTipIncasare=2 + Replace id_fdoc With gnid_fdoc_bonfiscal,fdoc With 'BON FISCAL' + Case pnTipIncasare=3 + Replace id_fdoc With gnid_fdoc_chitanta,fdoc With 'CHITANTA' && modificare v 2.0.29 : am inlocuit gnid_fdoc_incasare + Endcase + *!* modificare v 2.1.0 + If lnTvaIncasare = 1 + local lnTotalTvaNeex + Select actactan + calculate sum(suma) for scc = lcContTva to lnTotalTvaNeex + Locate For scc = lcContTVA + If Found() + Scatter Name otva + Locate For scd = '5311' + If Found() + Scatter Name oincasare + Append Blank + Gather Name oincasare Fields Except id_partc,id_partd,partc,partd,scc,scd,id_fact,pereched,perechec,id_jtva_coloana,suma + Replace suma with lnTotalTvaNeex,scd With '4428',scc With '4427',id_fact With -5,; + perechec With otva.nract,id_jtva_coloana With getIdTva(pnIdTva,0),proc_tva with otva.proc_tva + Endif + Endif + release lnTotalTvaNeex + Endif + *!* modificare v 2.1.0 ^ + + IF m.pnTipIncasare = 2 AND m.pnPOS = 1 + SELECT actactan + Locate For scd = '5311' + If Found() + REPLACE explicatia4 WITH partd && numele bancii + REPLACE scd WITH '5125', id_partd WITH id_partc, partd WITH partc + ENDIF + ENDIF + Endif + + Select actactan + Scan + Scatter Name poactan + If Type('poActan.cont') = 'U' + x = AddProperty(poactan,'cont',poactan.scc) + Endif + poactan.ascc = calc_analitic(poactan.scc,'poActan','poActan') + Select actactan + Replace ascc With poactan.ascc + + Release poactan + Select actactan + Scatter Name poactan + If Type('poActan.cont') = 'U' + x = AddProperty(poactan,'cont',poactan.scd) + Endif + poactan.ascd = calc_analitic(poactan.scd,'poActan','poActan') + Select actactan + Replace ascd With poactan.ascd + Endscan + + ****************************************** + *!* modificare 09.07 + *!* AddProperty(ocomanda,'delegat','') + *!* AddProperty(ocomanda,'eliberatde','') + *!* AddProperty(ocomanda,'bi','') + *!* AddProperty(ocomanda,'nrinmat_exp',ocomanda.nrinmat) + *!* ofrmdelegat=Createobject("frm_delegat_factura") + *!* ofrmdelegat.nidpartener=ocomanda.id_partener + *!* ofrmdelegat.cclient=ocomanda.nume + *!* ofrmdelegat.cnrinmat_exp=ocomanda.nrinmat_exp + *!* ofrmdelegat.Show(1) + ****************************************** + + Private buton + buton=1 + Select actactan + Replace all tva_incasare with lnTvaIncasare && modificare v 2.1.0 + Go Top + *!* modificare v 2.0.17 + *!* Do Form verificare With .T. + If !verificare_note_contabile('actactan', .T.,.T., .F.) + Do Form verificare With .T. + Endif + *!* modificare v 2.0.17 ^ + If buton=2 + Sqlrollback(gnHandle) + SQLSetprop(gnHandle,"Transactions",1) + *!* Do dezaloca_numar_fact In oserii_numere.prg + poGeneratorNumere.dezaloca_numere() + Return + Endif + + lcSql = [begin pack_auto.dev_adauga_oper_fact(?gcS,?pnIdOrdl,?pnid_sectie,?pnid_norme,?pnTotalFTva,?pntimpn,?pnore,]+; + [?gnIdUtil,?pnid_mecanic); end;] + lnSucces = goExecutor.oExecute(lcSql) + If lnSucces < 0 + Sqlrollback(gnHandle) + SQLSetprop(gnHandle,"Transactions",1) + *!* Do dezaloca_numar_fact In oserii_numere.prg + poGeneratorNumere.dezaloca_numere() + amessagebox(goExecutor.cEroare,0+16,'Eroare') + Return + Endif + + *!* modificare v 2.0.28 + *!* Select actactan + *!* Do oscrie_in_fisiere + *!* *!* Sqlrollback(gnHandle) + *!* Sqlcommit(gnHandle) + *!* SQLSetprop(gnHandle,"Transactions",1) + *!* amessagebox("Factura a fost inregistrata!",0+64,"Confirmare facturare") + *!* modificare v 2.0.28 ^ + ****************************************** + && listari + *!* DO listare_precomanda WITH pnIdOrdl + *!* modificare v 2.0.28 + *!* Do listare_FACTURA With ocomanda.id_partener,'actactan',ocomanda.nrord,ocomanda.nrinmat,Iif(lnTipFactura=2,lnTipFactura,3),0,0,0,0,0,0,pcdenop,lnTipFactura In oproceduri_listari +*!* modificare v 2.0.35 +*!* If factureaza_deviz(ocomanda.id_lucrare,ocomanda.nrord,ocomanda.nrinmat,pcdenop) + *!* modificare v 2.0.41 : am adaugat Alltrim(Str(ocomanda.id_lucrare)) + If factureaza_deviz(ocomanda.id_lucrare,ocomanda.nrord,ocomanda.nrinmat,pcdenop,,,,,,,ALLTRIM(STR(pnIdOrdl)),Alltrim(Str(ocomanda.id_lucrare))) +*!* modificare v 2.0.35 ^ + Sqlcommit(gnHandle) + Else + poGeneratorNumere.dezaloca_numere() + Sqlrollback(gnHandle) + Endif + SQLSetprop(gnHandle,"Transactions",1) + *!* modificare v 2.0.28 ^ + Release ocomanda + *!* toClient : id-ul de client + *!* tcCursor : Alias'ul cursorului + *!* tnTipfact : 1 - finala, 2 - spalare , 3 - restul + *!* tnProcDiscM,tnProcDiscN,tnProcDiscM,tnDiscountN,tnDiscountM,tnDiscountTvaM,tnDiscountTvaN,tcdenop +Endproc +*------------------------------sfarsit procedura factureaza----------------------------------------- +****************************************************************************************************************************** +Procedure factureaza_deviz + Lparameters tnIdComanda,tcNrOrd,tcNrInmat,tcDenop,tnMultiple,tnDiscountM,tnDiscountN,tnProcDiscM,tnProcDiscN,tnIdOrdl,tcSirIdOrdl,tcSirIdLucrare,tnPretCuTva + *!* Parameters tnIdClient,tcCursor,tcSirNrord,tcNrInmat,tnTipfact,tnProcDiscM,tnProcDiscN,tnDiscountM,tnDiscountN,tnDiscountTvaM,tnDiscountTvaN,tcdenop,tnTipFactura + Local lnProcTvav,lnIdJTvaColoana,lnIdSet,llScris,ltDataOra,lnPretCuTva + LOCAL llArticolCumulat, llFacturaZero, lnTaxCode + lnProcTvav = 0 + lnIdJTvaColoana = Null + lnTaxCode = NULL + lnIdSet = 0 + lnDiscountM = Iif(Empty(tnDiscountM),0,tnDiscountM) + lnDiscountN = Iif(Empty(tnDiscountN),0,tnDiscountN) + lnProcDiscM = Iif(Empty(tnProcDiscM),0,tnProcDiscM) + lnProcDiscN = Iif(Empty(tnProcDiscN),0,tnProcDiscN) + lnMultiple = Iif(Empty(tnMultiple),0,tnMultiple) + lcDenop = Iif(Empty(tcDenop),[],Alltrim(Upper(tcDenop))) + lnPretCuTva = IIF(EMPTY(tnPretCuTva),0,tnPretCuTva) && modificare v 2.0.41 + lcCursorDeviz = [crsdeviz] && modificare v 2.0.41 + llFacturaZero = .F. + + If Used('crsvanztemp') + Use In crsvanztemp + Endif + If Used('crsfactura') + Use In crsfactura + Endif + If Used(lcCursorDeviz) + Use In (lcCursorDeviz) + Endif + + creeaza_facturacrs([crsfactura]) +*!* modificare v 2.0.41 +*!* Create Cursor (lcCursorDeviz)(denumire c(100),explicatie c(240),cante N(20,4),pretv N(20,4),proc_tvav N(7,3),discunitar N(20,4),id_jtva_coloana N(10),; +*!* pretvval N(20,4),id_articol N(10),um c(10) Null,serie c(10) Null Default Null,codmat c(50) Null Default Null,Pret N(7,3),pretd N(7,3),; +*!* id_valuta N(10) Null Default Null) + CREATE CURSOR (lcCursorDeviz)(id_vanzare_det n(10) DEFAULT RECNO(),id_articol N(10),explicatie c(240),denumire c(100),; + lot C(20) NULL DEFAULT null, serie c(10) NULL DEFAULT null,codmatf c(50) NULL DEFAULT null,codmat c(50) NULL DEFAULT null,; + codbare c(50) NULL DEFAULT null,id_jtva_coloana N(10),ID_JTVA_COLOANA_EX N(10) null,taxcode N(6) null, pret_achizitie N(20,4) DEFAULT 0,cantitate N(20,4),; + proc_Tvav N(7,3),um c(10) null,pret_cu_tva N(1) DEFAULT 0,pret N(20,4),; + pret_val N(20,4) DEFAULT 0,discount_unitar N(20,4),discount_unitar_val N(20,4) DEFAULT 0,; + id_vanzare_set N(10) NULL DEFAULT null,id_gestiune N(10) NULL DEFAULT null,id_ctr N(20) NULL DEFAULT null,; + numar_contract c(10) NULL DEFAULT null,id_valuta N(10) DEFAULT 0,tip_valuta N(1) DEFAULT 0,; + CURS N(10,4) DEFAULT 0,multiplicator n(1) DEFAULT 1,nume_val c(50) DEFAULT " ") +*!* modificare v 2.0.41 ^ + + Select actactan + Locate For proc_tva <> 0 + If Found() + lnProcTvav = proc_tva + lnIdJTvaColoana = id_jtva_coloana + lnTaxCode = taxcode + ENDIF + + * Verific daca factura are toate sumele 0. Daca are toate sumele 0, inregistrez totusi factura in vanzari, in scopul listarii. + Select actactan + LOCATE FOR suma <> 0 + llFacturaZero = !FOUND() + + Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = '707' And Left(Alltrim(explicatia),3) = "MAT" To lnMaterialeFTva + Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = '704' And Left(Alltrim(explicatia),3) = "MAN" To lnManoperaFTva + Sum suma For Alltrim(explicatia)='STORNARE AVANS' And !Inlist(Alltrim(scc),'4427','4428') To lnStornareAvansFTva + Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = Iif(gnAvans419=1,[419],[707]) And Like([AVANS*],Upper(Alltrim(explicatia))) To lnAvansFTva + *!* modificare v 2.0.41 + Sum suma For Alltrim(scd) = '4111' And Like([AVANS*],Upper(Alltrim(explicatia))) To lnAvansCTva + Sum suma For Alltrim(scd) = '4111' AND (Left(Alltrim(explicatia),3) = "MAT" OR Left(Alltrim(explicatia),7) = "TVA MAT") To lnMaterialeCTva + *!* modificare v 2.1.12 : am pus (-1)*SIGN(...)*ABS(suma) in loc de suma + SUM (-1)*SIGN(lnMaterialeFTVA)*ABS(suma) FOR LEFT(ALLTRIM(explicatia),12) = "DISCOUNT MAT" TO lnDiscountNCTva + SUM (-1)*SIGN(lnManoperaFTva)*ABS(suma) FOR LEFT(ALLTRIM(explicatia),12) = "DISCOUNT MAN" TO lnDiscountMCTva + *!* modificare v 2.0.41 ^ + *!* modificare v 2.0.42 + Sum suma For Alltrim(scd) = '4111' And (Left(Alltrim(explicatia),3) = "MAN" OR Left(Alltrim(explicatia),7) = "TVA MAN") To lnManoperaCTva + *!* modificare v 2.0.42 ^ + Locate For id_set <> 0 + If Found() + lnIdSet = id_set + Endif + Private poDate + poDate = Createobject("oDateFactura",lnIdSet,-12) + *!* modificare ROAAUTO v 2.1.0 : tva_incasare + Select Distinct dataireg,id_fdoc,dataact,datascad,serie_act,nract,id_partd As id_part,nume_val,id_valuta,id_lucrare,tva_incasare ; + From actactan ; + WHERE Alltrim(scd) = '4111' ; + Into Cursor crstemp + +*!* modificare v 2.0.41 +*!* If lnAvansFTva <> 0 +*!* Insert Into crsdeviz(denumire,cante,pretv,proc_tvav,discunitar,id_jtva_coloana,pretvval,id_articol,Pret,pretd) ; +*!* values("AVANS",1,lnAvansFTva,lnProcTvav,0,lnIdJTvaColoana,0,-10002,0,0) + IF (lnAvansFTva<>0 AND lnPretCuTva = 0) OR (lnAvansCTva<>0 AND lnPretCuTva = 1) +*!* Insert Into (lcCursorDeviz)(denumire,cante,pretv,proc_tvav,discunitar,id_jtva_coloana,pretvval,id_articol,Pret,pretd,cu_tva) ; +*!* values("AVANS",1,IIF(lnAvansPretCTva=1,lnAvansCTva,lnAvansFTva),lnProcTvav,0,lnIdJTvaColoana,0,-10002,0,0,lnAvansPretCTva) + Insert Into (lcCursorDeviz)(id_articol,denumire,explicatie,cantitate,um,id_jtva_coloana,proc_Tvav,taxcode,pret,discount_unitar,pret_cu_tva) ; + values(-100005,"AVANS","",1,"",lnIdJTvaColoana,lnProcTvav,lnTaxCode,IIF(lnPretCuTva=1,lnAvansCTva,lnAvansFTva),0,lnPretCuTva) +*!* modificare v 2.0.41 ^ + Endif + +*!* modificare v 2.0.41 +*!* If lnMaterialeFTva <> 0 +*!* Insert Into (lcCursorDeviz)(denumire,cante,pretv,proc_tvav,discunitar,id_jtva_coloana,pretvval,id_articol,Pret,pretd) ; +*!* values ("MATERIALE",1,lnMaterialeFTva,lnProcTvav,ABS(lnDiscountN),lnIdJTvaColoana,0,-10001,0,0) + IF (lnMaterialeFTva<>0 AND !glAutoBonDet) OR (lnMaterialeCTva <> 0 AND glAutoBonDet) OR m.llFacturaZero + *!* modificare v 2.1.12 : am pus SIGN(lnMaterialeFTVA) pentru ca discountul trebuie sa aiba acelasi semn ca totalul de la materiale + Insert Into (lcCursorDeviz)(id_articol,denumire,explicatie,cantitate,um,id_jtva_coloana,proc_Tvav,taxcode,pret,discount_unitar,pret_cu_tva) ; + values (-100003,"MATERIALE","",1,"",lnIdJTvaColoana,lnProcTvav,lnTaxCode,IIF(glAutoBonDet,lnMaterialeCTva,lnMaterialeFTva),; + SIGN(lnMaterialeFTva)*IIF(glAutoBonDet,ABS(lnDiscountNCTva),ABS(lnDiscountN)),IIF(glAutoBonDet,1,0)) +*!* modificare v 2.0.41 ^ + Endif + +*!* modificare v 2.0.42 +*!* If lnManoperaFTva <> 0 +*!* *!* modificare v 2.0.41 +*!* *!* Insert Into (lcCursorDeviz)(denumire,cante,pretv,proc_tvav,discunitar,id_jtva_coloana,pretvval,id_articol,Pret,pretd,explicatie) ; +*!* *!* values(Iif(lnIdSet=31003,"INSPECTIE TEHNICA PERIODICA",Iif(lnIdSet=31004,"SPALARE AUTO","MANOPERA")),1,lnManoperaFTva,lnProcTvav,ABS(lnDiscountM),lnIdJTvaColoana,0,Iif(lnIdSet=31003,-10004,Iif(lnIdSet=31004,-10005,-10000)),0,0,Iif(lnIdSet=31005,lcDenop,[])) +*!* Insert Into (lcCursorDeviz)(id_articol,denumire,explicatie,cantitate,um,id_jtva_coloana,proc_Tvav,pret,discount_unitar) ; +*!* values(Iif(lnIdSet=31003,-100007,Iif(lnIdSet=31004,-100008,-100000)),; +*!* Iif(lnIdSet=31003,"INSPECTIE TEHNICA PERIODICA",Iif(lnIdSet=31004,"SPALARE AUTO","MANOPERA")),; +*!* Iif(lnIdSet=31005,lcDenop,[]),1,"",; +*!* lnIdJTvaColoana,lnProcTvav,lnManoperaFTva,IIF(glAutoBonDet,0,ABS(lnDiscountM))) + IF (lnManoperaFTva <> 0 AND !INLIST(lnIdSet,31003,31004)) OR m.llFacturaZero + *!* modificare v 2.1.12 : am pus SIGN(lnManoperaFTva) pentru ca discountul trebuie sa aiba acelasi semn ca totalul de la manopera + Insert Into (lcCursorDeviz)(id_articol,denumire,explicatie,cantitate,um,id_jtva_coloana,proc_Tvav,taxcode,pret,discount_unitar) ; + values(-100000,"MANOPERA",Iif(lnIdSet=31005,lcDenop,[]),1,"",; + lnIdJTvaColoana,lnProcTvav,lnTaxCode,lnManoperaFTva,IIF(glAutoBonDet,0,SIGN(lnManoperaFTva)*ABS(lnDiscountM))) +*!* modificare v 2.0.42 ^ + If glAutoBonDet AND lnDiscountMCTva <> 0 + *!* modificare v 2.1.12 : am pus SIGN(lnManoperaFTva) pentru ca discountul trebuie sa aiba acelasi semn ca totalul de la manopera + Insert Into (lcCursorDeviz)(id_articol,denumire,explicatie,cantitate,um,id_jtva_coloana,proc_Tvav,taxcode,Pret,pret_cu_tva) ; + values(-100001,"DISCOUNT MANOPERA","Discount "+ALLTRIM(STR(lnProcDiscM,5,2))+" %",1,"",lnIdJTvaColoana,lnProcTvav,lnTaxCode,(-1)*SIGN(lnManoperaFTva)*Abs(lnDiscountMCTva),1) + Endif +*!* modificare v 2.0.41 ^ + Endif + +*!* modificare v 2.0.42 + If (m.lnManoperaCTva <> 0 And Inlist(lnIdSet,31003,31004)) + Insert Into (lcCursorDeviz)(id_articol,denumire,cantitate,um,id_jtva_coloana,proc_Tvav,taxcode,Pret,pret_cu_tva) ; + values(Iif(lnIdSet=31003,-100007,-100008),; + Iif(lnIdSet=31003,"INSPECTIE TEHNICA PERIODICA","SPALARE AUTO"),1,"",; + lnIdJTvaColoana,lnProcTvav,lnTaxcode,lnManoperaCTva,1) + Endif +*!* modificare v 2.0.42 ^ + + *** Cumulez MATERIALE + MANOPERA pentru optiunea REPARATII AUTO (in loc de materiale + manopera) + *** doar in cazul in care nu doresc detaliat materialele pe bonul fiscal si pe factura, fara facturi ITP, spalare auto + llArticolCumulat = .F. + IF !m.glAutoBonDet AND !Inlist(lnIdSet,31003,31004) AND TYPE('gnAUTOIdArticolReparatii') = 'N' AND !EMPTY(NVL(m.gnAUTOIdArticolReparatii, 0)) + PRIVATE pcArticolReparatii + pcArticolReparatii = '' + lnSucces = goExecutor.oSelect2Value('select denumire from nom_articole where id_articol = ?gnAUTOIdArticolReparatii',@pcArticolReparatii) + IF lnSucces < 0 + aMESSAGEBOX(goExecutor.cEroare, 0+48,_screen.Caption) + ENDIF + IF EMPTY(m.pcArticolReparatii) + pcArticolReparatii = 'REPARATII AUTO' + ENDIF + SELECT m.gnAUTOIdArticolReparatii as id_articol, m.pcArticolReparatii as denumire, MAX(explicatie) as explicatie, ; + 1 as cantitate, '' as um, id_jtva_coloana, proc_Tvav, taxcode, SUM(pret) as pret, SUM(discount_unitar) as discount_unitar, pret_cu_tva ; + FROM (lcCursorDeviz) ; + WHERE INLIST(id_articol,-100003, -100000, -100002, -100001) ; + GROUP BY id_jtva_coloana, proc_Tvav, taxcode, pret_cu_tva ; + INTO CURSOR crsArtCumulat + + DELETE FROM (lcCursorDeviz) WHERE INLIST(id_articol,-100003, -100000, -100002, -100001) + + Insert Into (lcCursorDeviz)(id_articol,denumire,explicatie,cantitate,um,id_jtva_coloana,proc_Tvav,taxcode, pret,discount_unitar,pret_cu_tva) ; + SELECT id_articol,denumire,explicatie,cantitate,um,id_jtva_coloana,proc_Tvav,taxcode,pret,discount_unitar,pret_cu_tva ; + FROM crsArtCumulat + llArticolCumulat = .T. + USE IN (SELECT('crsArtCumulat')) + ENDIF + + IF lnStornareAvansFTva <> 0 +*!* modificare v 2.0.41 +*!* Insert Into (lcCursorDeviz)(denumire,cante,pretv,proc_tvav,discunitar,id_jtva_coloana,pretvval,id_articol,Pret,pretd) ; +*!* values("STORNARE AVANS",1,lnStornareAvansFTva,lnProcTvav,0,lnIdJTvaColoana,0,-10003,0,0) + Local loStornare + lcSql = [{call pack_auto.citeste_sume_stornare(']+tcSirIdLucrare+[',',')}] + lcCursorStornare = [crsstornari] + If goExecutor.oExecuta(lcSql,lcCursorStornare) + Select (lcCursorStornare) + Scan + Scatter Name loStornare + Insert Into (lcCursorDeviz)(id_articol,denumire,explicatie,cantitate,um,id_jtva_coloana,proc_Tvav,taxcode,Pret,discount_unitar,pret_cu_tva) ; + values(-100006,"STORNARE AVANS","",1,"",loStornare.id_jtva_coloana, loStornare.proc_tvav,loStornare.taxcode,loStornare.Pret,0,loStornare.pret_cu_tva) + Select (lcCursorStornare) + Endscan + Endif + Use In (lcCursorStornare) + Release loStornare +*!* modificare v 2.0.41 ^ + Endif + + If Used('crsalteserv') +*!* modificare v 2.0.41 +*!* Insert Into (lcCursorDeviz)(denumire,um,cante,pretv,proc_tvav,discunitar,id_jtva_coloana,pretvval,id_articol,Pret,pretd) ; +*!* Select denumire,um,cantitate,pretftva,lnProcTvav,0,lnIdJTvaColoana,0,id_articol,0,0 From crsalteserv Where !Deleted() + Insert Into (lcCursorDeviz)(id_articol,denumire,explicatie,cantitate,um,id_jtva_coloana,proc_Tvav,taxcode,pret,discount_unitar) ; + Select id_articol,denumire,"",cantitate,um,CAST(lnIdJTvaColoana as N(6) null) as id_jtva_coloana,CAST(lnProcTvav as N(7,2) null) as proc_tvav,CAST(lnTaxCode as N(6) null) as taxcode,pretftva,0 From crsalteserv Where !Deleted() +*!* modificare v 2.0.41 ^ + Endif + + * In xml eFactura nu este permis pret unitar negativ. Cantitate negativa si pret pozitiv + SELECT (m.lcCursorDeviz) + SCAN FOR pret < 0 + REPLACE cantitate WITH -cantitate, pret WITH -pret, discount_unitar WITH discount_unitar + ENDSCAN + + Select crstemp + poDate.dataireg = dataireg + poDate.id_fdoc = id_fdoc + poDate.dataact = dataact + poDate.datascad = datascad + poDate.nract = nract + poDate.serie_act = Alltrim(serie_act) + poDate.id_client = id_part + poDate.nume_valuta = nume_val + poDate.id_valuta = id_valuta + poDate.id_lucrare = id_lucrare + poDate.zi_curs = dataact + poDate.id_ordl = IIF(EMPTY(NVL(tnIdOrdl,0)),NULL,tnIdOrdl) && modificare v 2.0.33 + poDate.tva_incasare = tva_incasare && modificare v 2.1.0 + *!* poDate.id_sectie = id_sectie + Use In crstemp + + *!* ofrmdelegat=Createobject("frm_delegat_factura") + *!* ofrmdelegat.nidpartener = poDate.id_client + *!* ofrmdelegat.cclient = poDate.nume_client + *!* ofrmdelegat.cnrinmat_exp = tcNrInmat && poDate.nrinmat_del + *!* ofrmdelegat.Show(1) + *!* Release ofrmdelegat + Private ofrmdatesupl + ltDataOra = Get_Ora() + + * Daca initializez vanzari.tip_saft cu cod 751 (factura in scop informativ) in loc de 380 (factura initiala) + * pentru facturile incasate cu bon fiscal, initializez cu tip 751 ca sa nu apara duplicate in decontul TVA precompletat + IF TYPE('gnEFactura_tip_saft_bf') = 'N' AND !EMPTY(NVL(m.gnEFactura_tip_saft_bf, 0)) + IF pnTipIncasare = 2 && incasare bon fiscal + poDate.tip_saft = m.gnEFactura_tip_saft_bf && 751/380 + ENDIF + ENDIF + + poDate.dataora_exp = ltDataOra + ofrmdatesupl = Createobject("frm_alte_date") + ofrmdatesupl.Show(1) + Release ofrmdatesupl + If gnButon = 2 + lnSucces = -1 + llScris = .F. + Else + Select actactan + Locate For Alltrim(scd) = '5311' + Do Case + Case Found() And pnTipIncasare=2 && bon fiscal + poDate.ntip_incasare = 2 + poDate.nr_incasare = actactan.nract + poDate.incasat = actactan.suma + Case Found() And pnTipIncasare=3 && chitanta + poDate.ntip_incasare = 11 + poDate.nr_incasare = actactan.nract + poDate.serie_chit = actactan.serie_act + poDate.incasat = actactan.suma + Otherwise + poDate.ntip_incasare = 0 + ENDCASE + + SELECT actactan + LOCATE For Alltrim(scd) = '5125' && efecte de incasat + IF Found() And m.pnTipIncasare=2 AND m.pnPos = 1 && bon fiscal incasat prin CARD POS + poDate.ntip_incasare = 2 + poDate.nr_incasare = actactan.nract + poDate.incasatCARD = actactan.suma + ENDIF + + *!* modificare v 2.0.35 : am adaugat STRTRAN(tcNrOrd,[,],[, ]) in loc de tcNrOrd + Do Case +*!* modificare v 2.0.43 + Case (lnAvansFTva<>0 And lnPretCuTva = 0) Or (lnAvansCTva<>0 And lnPretCuTva = 1) ; + OR (lnStornareAvansFTva <> 0 And lnManoperaFTva = 0 And lnMaterialeFTva = 0) + poDate.text_aditional = [LA ]+Iif(lnMultiple=0,[COMANDA ],[COMENZILE ])+STRTRAN(tcNrOrd,[,],[, ]) + ; + IIF(!Empty(poDate.text_aditional),Chr(13)+Chr(10)+poDate.text_aditional,[]) +*!* *!* modificare v 2.0.41 +*!* *!* Case lnAvansFTva <> 0 +*!* Case (lnAvansFTva<>0 And lnPretCuTva = 0) Or (lnAvansCTva<>0 And lnPretCuTva = 1) +*!* Update (lcCursorDeviz) Set explicatie = [LA ]+Iif(lnMultiple=0,[COMANDA ],[COMENZILE ])+STRTRAN(tcNrOrd,[,],[, ]) Where id_articol = -100005 +*!* *!* modificare v 2.0.41 ^ +*!* Case lnStornareAvansFTva <> 0 And lnManoperaFTva = 0 And lnMaterialeFTva = 0 +*!* Update (lcCursorDeviz) Set explicatie = [LA ]+Iif(lnMultiple=0,[COMANDA ],[COMENZILE ])+STRTRAN(tcNrOrd,[,],[, ]) Where id_articol = -100006 +*!* modificare v 2.0.43 ^ + Otherwise + Do Case + Case (!Between(lnIdSet,31003,31005) And lnManoperaFTva <> 0 And lnMaterialeFTva <> 0) OR m.llFacturaZero + lcExplicatie = [MANOPERA SI MATERIALE ] + Case !Between(lnIdSet,31003,31005) And lnManoperaFTva <> 0 + lcExplicatie = [MANOPERA ] + Case !Between(lnIdSet,31003,31005) And lnMaterialeFTva <> 0 + lcExplicatie = [MATERIALE ] + Otherwise + lcExplicatie = [] + Endcase + + IF m.llArticolCumulat && REPARATII AUTO in loc DE MANOPERA + MATERIALE + poDate.text_aditional = Iif(lnMultiple=0,[COMANDA/DEVIZ ],[COMENZI/DEVIZE ])+STRTRAN(tcNrOrd,[,],[, ]) + ; + IIF(!Empty(poDate.text_aditional),Chr(13)+Chr(10)+poDate.text_aditional,[]) + ELSE + *!* modificare v 2.0.41 : am adaugat Between(lnIdSet,31003,31005) + If !Empty(lcExplicatie) OR Between(lnIdSet,31003,31005) + poDate.text_aditional = lcExplicatie + [CF. ]+Iif(lnMultiple=0,[COMENZII/DEVIZULUI ],[COMENZILOR/DEVIZELOR ])+STRTRAN(tcNrOrd,[,],[, ]) + ; + IIF(!Empty(poDate.text_aditional),Chr(13)+Chr(10)+poDate.text_aditional,[]) + ENDIF + ENDIF + + Endcase + +*!* modificare v 2.0.41 +*!* Insert Into ([crsfactura]) (id_temp,id_articol,denumire,explicatie,cantitate,cu_tva,pretftva,pretctva,; +*!* valftva,valtva,valctva,discountftva,discountctva,valdiscountftva,; +*!* valdiscounttva, valdiscountctva, valdiminuatftva, valdiminuattva, valdiminuatctva, proc_tvav,id_jtva_coloana,um,; +*!* vpretftva,vvalftva,vvaltva,vdiscountftva,vvaldiscountftva,vvaldiscounttva,; +*!* vvaldiminuatftva,vvaldiminuattva,vvaldiminuatctva,gestionabil) ; +*!* Select Recno() As id_temp,id_articol,denumire,explicatie, 1 As cantitate,cu_tva,; +*!* Round(pretv,gnPc) As pretftva,; +*!* Round(pretv,gnPc) + Round(Round(pretv,gnPc) * (proc_tvav-1),gnPc) As pretctva,; +*!* Round(Round(pretv,gnPc)*cante,gnPc) As valftva,; +*!* ROUND(Round(pretv*cante,gnPc)*(proc_tvav-1),gnPc) As valtva, ; +*!* Round(Round(pretv,gnPc)*cante,gnPc) + Round(Round(pretv*cante,gnPc)*(proc_tvav-1),gnPc) As valctva, ; +*!* ROUND(discunitar,gnPc) As discountftva,; +*!* ROUND(discunitar,gnPc)+Round(Round(discunitar,gnPc)*(proc_tvav-1),gnPc) As discountctva,; +*!* Round(Round(discunitar,gnPc)*cante,gnPc) As valdiscountftva, ; +*!* ROUND(Round(discunitar*cante,gnPc)*(proc_tvav-1),gnPc) As valdiscounttva, ; +*!* Round(Round(discunitar,gnPc)*cante,gnPc) + Round(Round(discunitar*cante,gnPc)*(proc_tvav-1),gnPc) As valdiscountctva,; +*!* Round(Round(pretv-discunitar,gnPc)*cante,gnPc) As valdiminuatftva,; +*!* ROUND(Round((pretv-discunitar)*cante,gnPc)*(proc_tvav-1),gnPc) As valdiminuattva,; +*!* ROUND(Round(Round(pretv-discunitar,gnPc)*cante,gnPc)*proc_tvav,gnPc) As valdiminuatctva,; +*!* proc_tvav,id_jtva_coloana, Nvl(um,Space(50)) As um, ; +*!* Round(pretvval,gnPVal) As vpretftva,; +*!* ROUND(Round(pretvval,gnPVal)*cante,gnPVal) As vvalftva,; +*!* ROUND(Round(Round(pretvval,gnPVal)*cante,gnPVal)*(proc_tvav-1),gnPVal) As vvaltva,; +*!* 0 As vdiscountftva,0 As vvaldiscountftva,0 As vvaldiscounttva,; +*!* Round(Round(pretvval-0,gnPc)*cante,gnPc) As vvaldiminuatftva,; +*!* ROUND(Round((pretvval-0)*cante,gnPc)*(proc_tvav-1),gnPc) As vvaldiminuattva,; +*!* ROUND(Round(Round(pretvval-0,gnPc)*cante,gnPc)*proc_tvav,gnPc) As vvaldiminuatctva,; +*!* 0 As gestionabil From (lcCursorDeviz) Where cante <> 0 + + prelucreaza_facturacrs(lcCursorDeviz,[crsfactura],lnProcTvav,0,0) +*!* modificare v 2.0.41 ^ + + Create Cursor crsvanztemp(id_articol N(20),explicatie c(240),Pret N(20,4),proc_tvav N(7,3),id_jtva_coloana N(10),taxcode N(6) NULL,cantitate N(20,4),discount_unitar N(20,4),; + id_gestiune N(20),Cont c(4),pret_cu_tva N(1),serie c(100),id_valuta N(10),codmat c(50),Curs N(20,6),multiplicator N(10),pret_achizitie N(20,4),; + pretd N(20,4),id_valuta_d N(10)) + +*!* modificare v 2.0.41 +*!* Insert Into crsvanztemp(id_articol,explicatie,Pret,proc_tvav,id_jtva_coloana,cantitate,discount_unitar,pret_cu_tva,; +*!* serie,codmat,id_valuta,Curs,multiplicator,pret_achizitie,pretd,id_valuta_d) ; +*!* SELECT id_articol,explicatie,pretv As Pret,proc_tvav,id_jtva_coloana,cante As cantitate,; +*!* discunitar As discount_unitar,cu_tva As pret_cu_tva,Nvl(serie,Space(100)) As serie,Nvl(codmat,Space(50)) As codmat,; +*!* 0 As id_valuta,0 As Curs,1 As multiplicator,Pret,pretd,Cast(Nvl(id_valuta,0) As N(5)) As id_valuta_d From (lcCursorDeviz) Where cante <> 0 + + Insert Into crsvanztemp(id_articol,explicatie,Pret,proc_tvav,id_jtva_coloana,taxcode,cantitate,discount_unitar,pret_cu_tva,; + serie,codmat,id_valuta,Curs,multiplicator,pret_achizitie,pretd,id_valuta_d) ; + SELECT id_articol,explicatie,Pret,proc_tvav,id_jtva_coloana,taxcode,cantitate,; + discount_unitar,pret_cu_tva,Nvl(serie,Space(100)) As serie,Nvl(codmat,Space(50)) As codmat,; + id_valuta,Curs,multiplicator,pret_achizitie,0 as pretd,Cast(Nvl(id_valuta,0) As N(5)) As id_valuta_d ; + From (lcCursorDeviz) Where cantitate <> 0 OR m.llFacturaZero +*!* modificare v 2.0.41 ^ + + lnSucces = SQLSetprop(gnHandle,"Transactions",2) + If lnSucces >= 0 + lcSql = [begin ] + gcS +[.pack_facturare.initializeaza_date_factura(] + ; + [to_date('] + Alltrim(Dtoc(poDate.dataireg,2)) + [','YYYYMMDD'),] + ; + Nvl(Alltrim(Str(poDate.id_fdoc)),[NULL]) + [,to_date('] + Alltrim(Dtoc(poDate.dataact,2)) + [','YYYYMMDD'),] + ; + [to_date('] + Alltrim(Dtoc(poDate.datascad,2)) + [','YYYYMMDD'),'] + Nvl(poDate.serie_act,[]) + [',] + ; + Alltrim(Str(poDate.nract,14,0)) + [,] + ; + Iif(Isnull(poDate.id_client),[NULL],Alltrim(Str(poDate.id_client))) + [,] + ; + Iif(Isnull(poDate.id_lucrare),[NULL],Alltrim(Str(poDate.id_lucrare))) + [,] + ; + Iif(Isnull(poDate.id_sectie),[NULL],Alltrim(Str(poDate.id_sectie))) + [,] + ; + Iif(Isnull(poDate.id_venchelt),[NULL],Alltrim(Str(poDate.id_venchelt))) + [,] + ; + Iif(Isnull(poDate.id_responsabil),[NULL],Alltrim(Str(poDate.id_responsabil))) + [,] + ; + IIF(EMPTY(nvl(poDate.explicatia4,[])),[NULL],['] + STRTRAN(ALLTRIM(poDate.explicatia4),['],['']) + [']) + [,] + ; && modificare v 2.0.33 + IIF(EMPTY(NVL(poDate.id_ordl,0)),[NULL],ALLTRIM(STR(poDate.id_ordl))) + [,NULL,] + ; + ['] + Strtran(Alltrim(Nvl(poDate.descriere,[])),['],['']) + [',] + ; + Alltrim(Str(poDate.tip)) + [,] + Alltrim(Str(poDate.id_set)) + [,] + ; + [to_date('] + Dtoc(poDate.zi_curs,2) + [','YYYYMMDD'),] + Alltrim(Str(poDate.id_valuta)) + [,] + ; + Alltrim(Str(poDate.in_valuta)) + [,] + ; + alltrim(str(poDate.tva_incasare)) + [,] + ; && modificare ROAAUTO v 2.1.0 + Iif(Isnull(gnIdSucursala),[NULL],Alltrim(Str(gnIdSucursala))) + [,] + ; + Alltrim(Str(gnIdUtil)) + [,NULL,NULL,] + ; + IIF(EMPTY(NVL(poDate.tip_saft,0)), [NULL], ALLTRIM(STR(poDate.tip_saft))) + [); end;] + lnSucces = goExecutor.oExecute(lcSql) + If lnSucces < 0 + amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare") + ELSE + + Private poArticol + Select crsvanztemp + Scan + Scatter Name poArticol + lcSql = [begin ] + gcS + [.pack_facturare.adauga_articol_factura_deviz(] + ; + Alltrim(Str(poArticol.id_articol)) + [,] + ; + ['] + Strtran(Alltrim(Nvl(poArticol.explicatie,[])),['],['']) + [',] + ; + ['] + Strtran(Alltrim(Nvl(poArticol.serie,[])),['],['']) + [',] + ; + Alltrim(Str(poArticol.pret_achizitie,18,gnPPret)) + [,] + ; + Alltrim(Str(poArticol.pretd,18,gnPVal)) + [,] + ; + Alltrim(Str(poArticol.id_valuta_d)) + [,] + ; + Alltrim(Str(poArticol.Pret,18,Iif(poDate.in_valuta = 1,gnPVal,gnPPretV))) + [,] + ; + Iif(poDate.in_valuta=1,Alltrim(Str(poArticol.id_valuta)),[NULL]) + [,] + ; + Alltrim(Str(poArticol.Curs,18,6)) + [,] + ; + Alltrim(Str(poArticol.multiplicator)) + [,] + ; + Alltrim(Str(poArticol.proc_tvav,18,2)) + [,] + ; + Alltrim(Str(poArticol.id_jtva_coloana)) + [,] + ; + Alltrim(Str(poArticol.cantitate,18,gnPCant)) + [,] + ; + Alltrim(Str(poArticol.discount_unitar,18,gnPPretV)) + [,] + ; + Alltrim(Str(poArticol.id_gestiune)) + [,] + ; + ['] + Alltrim(Nvl(poArticol.Cont,'')) + [',] + ; + Alltrim(Str(poArticol.pret_cu_tva)) + [,NULL,NULL,] + IIF(ISNULL(poArticol.taxcode), [NULL], ALLTRIM(TRANSFORM(poArticol.taxcode))) + [); end;] + lnSucces = goExecutor.oExecute(lcSql) + If lnSucces < 0 + amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare") + Exit + Endif + Endscan + If !Used('INFISIERE') + lcCaleDateMenu = gcAppPath+[\COMUN\DATEMENU\] + Use &lcCaleDateMenu.INFISIERE In 0 Alias INFISIERE + Endif + If lnSucces >= 0 + lnSucces = oscrie_in_fisiere(0,.F.,.T.) && ? + If lnSucces >= 0 +*!* modificare v 2.0.47 : am adaugat lnIdSet la pack_devize.actualizeaza_deviz + lcSql = [begin ] + gcS + [.pack_facturare.scrie_in_vanzari(0,] + ; + IIF(Isnull(poDate.id_delegat),[NULL],Alltrim(Str(poDate.id_delegat))) + [,] + ; + IIF(Isnull(poDate.id_masina),[NULL],Alltrim(Str(poDate.id_masina))) + [,] + ; + IIF(Isnull(poDate.id_facturare),[NULL],Alltrim(Str(poDate.id_facturare))) + [,] + ; + IIF(Isnull(poDate.nListareDetaliata),[0],Alltrim(Str(poDate.nListareDetaliata))) + [,] + ; + [?poDate.dataora_exp,] + ; + IIF(Isnull(poDate.id_agent),[NULL],Alltrim(Str(poDate.id_agent))) + [,] + ; + ['] + Strtran(Alltrim(Nvl(poDate.text_aditional,[])),['],['']) + [',?@poDate.nid_vanzare); ] + ; + [pack_auto.actualizeaza_deviz(] + ALLTRIM(STR(lnProcTvav,10,4)) + [,'] + ALLTRIM(tcSirIdOrdl) + [',] + ALLTRIM(STR(lnIdSet)) + [); end;] +*!* modificare v 2.0.35 : am scos apelul catre pack_devize.dev_completeaza_rul; e inclus in actualizeaza_deviz + lnSucces = goExecutor.oExecute(lcSql) + If lnSucces < 0 + amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare") + ELSE + * Completare vanzari.id_fact cu act.id_fact + TEXT TO lcSql TEXTMERGE NOSHOW +merge into vanzari a using + (SELECT v.cod, (select min(id_fact) from act where cod = v.cod and scd = '4111') as id_fact from vanzari v where v.id_vanzare=?poDate.nid_vanzare) b on (a.cod = b.cod) + when matched then + update set id_fact = b.id_fact; + endtext + llSucces = goExecutor.oExecuta(m.lcSql) + Endif + Endif + Endif + Endif + Endif + + If lnSucces < 0 + amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare") + lcSql = "ROLLBACK" + llScris = .F. + Else + lcSql = "COMMIT" + llScris = .T. + Endif + lnSucces2 = goExecutor.oExecute(lcSql) + + Do Case + Case lnSucces2 < 0 + amessagebox(lcSql + Chr(13) + goExecutor.cEroare,0+16,"Eroare") + llScris = .F. + Case lnSucces2 >=0 And lcSql = "COMMIT" + listeaza_ofacturare() + If poDate.ntip_incasare = 2 && bon fiscal + If glAutoBonDet And !Inlist(lnIdSet,31001,31002) + listeaza_bon_fiscal_det(ltDataOra,poDate.nr_incasare,poDate.incasat,poDate.incasatCARD,poDate.proc_tva,lnProcDiscN,lnProcDiscM) + Else + listeaza_bon_fiscal(ltDataOra,poDate.nr_incasare,poDate.incasat,poDate.incasatCARD,poDate.proc_tva,poDate.nract) + Endif + Endif + Endcase + + lnSucces2 = SQLSetprop(gnHandle,"Transactions",1) + If lnSucces2 < 0 + amessagebox('Programul nu a reusit sa treaca pe tranzactie automata. Iesiti din program si intrati din nou!',48,'Atentie!') + Endif + Endif + + If Used('crsvanztemp') + Use In crsvanztemp + Endif + If Used('crsfactura') + Use In crsfactura + Endif + Release poDate + Return llScris +Endproc +******************************************************************************************************************* +Procedure listeaza_bon_fiscal_det + Lparameters ttDataOra,tnNrBon,tnSumaAchitNumerar,tnSumaAchitCARD,tnProcentTva,tnProcDiscMat,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) + 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 + If tnProcDiscMat <> 0 + Select (lcCursor) + 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 + Select crsfactura + Locate For id_articol = -100000 && Manopera + If Found() + lnSumaManopera = valctva + Select (lcCursor) + Append Blank + Replace denumire With 'MANOPERA',um With 'BUC',CANT With 1,Pret With lnSumaManopera,; + DEPARTAMENT With 1,proc_tvav With 1+(tnProcentTva/100) + Endif + If tnProcDiscMan <> 0 + Select (lcCursor) + 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 + Select crsfactura + Scan For !Inlist(id_articol,-100000,-100001,-100003) && fara manopera, discount manopera, materiale + lcDenumire = denumire + lcUM = Nvl(um,'BUC') + lnCantitate = cantitate + lnPret = pretctva + Select (lcCursor) + Append Blank + Replace denumire With lcDenumire,um With lcUM,CANT With lnCantitate,Pret With lnPret,; + DEPARTAMENT With 1,proc_tvav With 1+(tnProcentTva/100) + Select crsfactura + Endscan + loHash = GetHash() + loHash.SetValue("cTip", "1;") + loHash.SetValue("nNumarBon", tnNrBon) + loHash.SetValue("nValoareNumerar", m.tnSumaAchitNumerar) + loHash.SetValue("nValoareCARD", m.tnSumaAchitCard) + loHash.SetValue("nValoareTotal", m.tnSumaAchitNumerar + m.tnSumaAchitCard) + loHash.SetValue("cCursor",lcCursor) + loHash.SetValue("tDataOra",ttDataOra) + goControllerEcr.imprima(loHash) + Use In (lcCursor) + Release loHash +Endproc && listeaza_bon_fiscal_det +******************************************************************************************************************* +Procedure listeaza_bon_fiscal + Lparameters ttDataOra,tnNrBon,tnSumaAchitNumerar,tnSumaAchitCARD,tnProcentTva,tnNrFact + *!* 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 m.tnSumaAchitNumerar + m.tnSumaAchitCARD,proc_tvav With 1+(tnProcentTva/100),DEPARTAMENT With 1 + + loHash = GetHash() + loHash.SetValue("cTip", "1;") + loHash.SetValue("nNumarBon", tnNrBon) + loHash.SetValue("nValoareNumerar", m.tnSumaAchitNumerar) + loHash.SetValue("nValoareCARD", m.tnSumaAchitCard) + loHash.SetValue("nValoareTotal", m.tnSumaAchitNumerar + m.tnSumaAchitCard) + loHash.SetValue("cCursor",lcCursor) + loHash.SetValue("tDataOra",ttDataOra) + goControllerEcr.imprima(loHash) + Use In (lcCursor) + Release loHash +Endproc && listeaza_bon_fiscal +******************************************************************************************************************* +Procedure alege_facturi_relistare + LPARAMETERS tcCursorComenzi + * tcCursorComenzi cursor cu comenzile selectate pentru listare + * trebuie sa aiba coloanele: ales N(1), id_lucrare I, nrord C + + Local lnRaspuns,lcFisier,lcSql,lnSucces,lnIdLucrare,ldDataAct,lnNrAct,lcSelect,lcFiltru,lcSchema,lcOrder,llAfisare,lnnr,lnExp,lncounta,lncountb,lncountcod, lcFieldAles + Select (m.tcCursorComenzi) + lnRecno = Recno() + + If Reccount(m.tcCursorComenzi)>0 + lcFieldAles = tcCursorComenzi + '.ales' + IF TYPE(m.lcFieldAles) = 'U' + lnAlese = 0 + ELSE + Calculate Sum(ales) To lnAlese + ENDIF + If lnAlese = 0 + Select * From (tcCursorComenzi) Where Recno() = lnRecno Into Cursor crsRelistare + Else + Select * From (tcCursorComenzi) With (Buffering = .T.) Where ales = 1 Into Cursor crsRelistare + ENDIF + + Select crsRelistare + Scan + Scatter Name ocomanda + lnIdLucrare=crsrelistare.id_lucrare + If Used('crsexport') + Use In crsexport + Endif + lcSql = [Select distinct 0 as ales,cod,serie_act,nract,MAX(datascad) as datascad,dataact from act ] + ; + [where id_set between 31000 and 31020 ] + ; + [and id_lucrare = ] + Alltrim(Str(lnIdLucrare)) + [ and SUBSTR(scd,1,3) not in ('711','531') ] + ; + [and sters = 0] + gcCondSucursala + [ and cod in (select cod from vanzari where sters = 0) ] + ; + [group by cod,serie_act,nract,dataact ] + ; + [order by dataact,nract] + lnSucces = goExecutor.oExecute(lcSql,[crsexport]) + If lnSucces < 0 + amessagebox(goExecutor.cEroare,48,"Atentie") + Else + Do Case + Case Reccount([crsexport]) = 0 + amessagebox("Nu exista documente pentru comanda " + Alltrim(crsrelistare.nrord)+ " !",0+48,"Atentie") + Case Reccount([crsexport]) = 1 + Select ([crsexport]) + relisteaza_factura_deviz(cod,serie_act,nract,dataact,datascad) + Otherwise + loFrmDocLuc=Createobject('frm_documente_lucrare',crsrelistare.nrord) + loFrmDocLuc.Show(1) + Select ([crsexport]) + Scan For ales = 1 + relisteaza_factura_deviz(cod,serie_act,nract,dataact,datascad) + Select ([crsexport]) + Endscan + Endcase + Endif + Endscan + Use In (Select('crsrelistare')) + Use In (Select('crsexport')) + + SELECT (m.tcCursorComenzi) + Go Max(Min(lnRecno,Reccount(tcCursorComenzi)),1) + Else + amessagebox("Nu ati selectat nici o comanda!",0+48,"Atentie") + Endif +Endproc +******************************************************************************************************************* +Procedure relisteaza_factura_deviz + Lparameters tnCod,tcSerie,tnNrAct,tdDataAct,tdDataScad + pnCod = tnCod + poDate=Createobject("oDateFactura",0,0) + poDate.serie_act = tcSerie + poDate.nract = tnNrAct + poDate.dataact = Iif(Type('tdDataAct')='T',Ttod(tdDataAct),tdDataAct) + poDate.datascad = Iif(Type('tdDataScad')='T',Ttod(tdDataScad),tdDataScad) + + *!* modificare v 2.1.0 : am adaugat tva_incasare + lcSql = [select id_vanzare,id_comanda,dataora,dataora_exp,data_act,sters,dataoras,numar_act,serie_act,]+; + [tip,id_part,discount,disc_fara_tva,discount_evidentiat,text_aditional,facturat,data_facturat,]+; + [explicatie,altele,client,cod,utilizator,utils,utilfact,delegat,bidelegat,cnpdelegat,]+; + [nume_agent,nrinmat,total_fara_tva,total_tva,total_cu_tva,id_gestiune,serie_chit,nr_incasare,incasat,]+; + [in_valuta,sucursala,id_ruta,ruta,curs,multiplicator,nume_val,id_delegat,id_agent,id_masina,valoarea,]+; + [nume_gestiune,id_sectie,sectie,id_lucrare,lucrare,tip_incasare,afisare_scadenta,id_ordl,tva_incasare from fact_vfacturi where cod = ] + ALLTRIM(STR(m.pnCod)) + lnSucces = goExecutor.oExecute(lcSql,[crsfacturiTemp]) + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,"Eroare") + Return + Endif + + Select crsfacturiTemp + poDate.nRelistare = 1 + poDate.nid_vanzare = id_vanzare + poDate.tip = tip + poDate.discount_evidentiat = discount_evidentiat + poDate.text_aditional = Nvl(text_aditional,[]) + poDate.nrinmat = nrinmat + poDate.nume_delegat = delegat + poDate.bidelegat = bidelegat + poDate.cnpdelegat = cnpdelegat + poDate.dataora_exp = dataora_exp + poDate.afisare_scadenta = afisare_scadenta + poDate.listaid = Iif(poDate.tip = 3,Alltrim(Str(id_comanda)), [0]) + poDate.ntip_incasare = tip_incasare + poDate.serie_chit = Nvl(serie_chit,[]) + poDate.nr_incasare = nr_incasare + poDate.incasat = incasat + poDate.id_client = id_part + poDate.nume_client = client + poDate.in_valuta = in_valuta + poDate.id_ordl = id_ordl + poDate.tva_incasare = tva_incasare && modificare v 2.1.0 + lnDiscount = DISCOUNT + lnDiscountVal = 0 + Use In (SELECT('crsfacturiTemp')) + + lcSql = [select * from fact_vfacturi_detalii where id_vanzare = ] + ALLTRIM(STR(poDate.nid_vanzare)) + lnSucces = goExecutor.oExecute(lcSql,[crsdetalii]) + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,"Eroare") + Return + Endif + + Select crsdetalii + Calculate Max(proc_tvav) To lnProcTvav + creeaza_facturacrs([crsfactura]) + prelucreaza_facturacrs([crsdetalii],[crsfactura],lnProcTvav,lnDiscount,lnDiscountVal) + Use In crsdetalii + listeaza_ofacturare() + + If Used('crsfactura') + Use In crsfactura + Endif + + Release poDate +Endproc +*!* ****************************************************************************************************************************** +*!* Procedure listeaza_ofacturare_deviz +*!* listeaza_ofacturare() +*!* If poDate.nRelistare = 0 And poDate.eProforma = 0 And poDate.nSalveazaAtasamente = 1 +*!* lnSucces2 = goExecutor.oexecute([COMMIT]) +*!* Endif +*!* Endproc +*!* ****************************************************************************************************************************** + +******************************************* +* PROCEDURE export_comanda_xml( ) +* Data/ora : 08/03/13, 08:58:28 +* autor : liana.neagu +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +PROCEDURE export_comanda_xml + tlCautPlus = .t. + Store "" To loCauta + *!* tlCautPlus - daca se foloseste formularul caut_alfa_form_plus cu butonul but_start_criterii + *!* 24.07.2009 + *!* 29.01.2013 : am adaugat um2 in selectie + Local lcStringCriterii,lcCursor,lcXML,lcDateStyle,lcMark + LOCAL lcFisierXml,lcCursor ,lcCaleFisier + + PRIVATE pcCodTehnician + + lcStringCriterii = "" + + + lcStringCriterii="Lucrare\nrord\T\none\" + crlf + ; + "Client\nume\T\none"+ crlf + ; + "Nr. inmatriculare\nrinmat\T\none"+ crlf+; + "Serie sasiu\series\T\none"+ crlf+; + "Data\datai\D\none"+ crlf + + lcTitluColoane = [Nr lucrare,Data,Client,Nr. inmatriculare,Serie sasiu] + lccoloane = [nrord,TTOD(datai),nume,nrinmat,series] + + + lcFiltru = [2=2] + lcSchema = [] + lcOrder = [datai] + lcNumeProc = [] + lcTitlu = [Alege_i comenzile (mouse-click pe denumire sau apasa_i SPACE)] + lcSelect = [select nrord,datai,nume,nrinmat,series,validat,id_ordl from auto_normare_comenzi a] + lcFiltruOriginal = gcCondLuna + [ and a.validat=0 ] + pcschema1=[''] + + + llToateIreg = .t. + lcPrimaColoana = [nrord] + lnPornire = 1 + lnTipReturn = 1 + lcIdColumn = "id_ordl" + + loHash = GetHash() + loHash.SetValue("cSelect", lcSelect) + loHash.SetValue("cFiltru", lcFiltru) + loHash.SetValue("cSchema", lcSchema) + loHash.SetValue("cOrder", lcOrder) + loHash.SetValue("cColoana", lccoloane) + loHash.SetValue("cTitlu", lcTitlu) + loHash.SetValue("cTitluColoana", lcTitluColoane) + loHash.SetValue("cNumeProc", lcNumeProc) + loHash.SetValue("lToateIreg", llToateIreg) + loHash.SetValue("cFiltruOriginal", lcFiltruOriginal) + loHash.SetValue("cPrimaColoana", lcPrimaColoana) + loHash.SetValue("nPornire", lnPornire) + loHash.SetValue("nTipReturn", lnTipReturn) + loHash.SetValue("cIdColumn", lcIdColumn) + loHash.SetValue("cStringCriterii", lcStringCriterii) + loCauta = cauta_alfa_hash(loHash) +*---------------------export in xml---------------------------------------- +IF gnButon = 2 OR empty(NVL(loCauta,[])) + RETURN +ENDIF +lcCursor = [crsDateSelect] +XMLTOCURSOR(loCauta,lcCursor ) + + +lcFisierXml = m.gcFISIERXMLCOMENZI + +lcCaleFisier = JUSTPATH(lcFisierXml) + If !Directory(m.lcCaleFisier) + Md (m.lcCaleFisier) + Endif + + lcSql = [select * from DEV_UTILIZATORI_CODURI where id_util = ?gnIdutil] + lnSucces = goExecutor.oExecute(lcSql,[crscodUtil]) + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,"Eroare") + Return + Endif + + +SELECT crsCodUtil +pcCodTehnician = ALLTRIM(cod) +USE IN crsCodUtil + +IF empty(NVL(pcCodTehnician,[])) + oadaugcod = CREATEOBJECT('frm_codutilizator') +*!* oadaugcod.Clb_tx_simplu1.text_simplu1.controlsource= 'pcCodTehnician' + oadaugcod.show(1) + IF gnbuton = 2 + RETURN + ENDIF + + lcSql = [merge into DEV_UTILIZATORI_CODURI a using (select ']+ALLTRIM(pcCodTehnician)+; + [' as cod,?gnIdutil as id_util from dual) b ON (a.id_util = b.id_util) WHEN NOT MATCHED THEN insert (id_util,cod) values (?gnIdutil,']+ALLTRIM(pcCodTehnician)+; + [') WHEN MATCHED THEN UPDATE SET cod = ']+ALLTRIM(pcCodTehnician)+[' where id_util = ?gnIdutil] + lnSucces = goExecutor.oExecute(lcSql) + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,"Eroare") + Return + Endif +ENDIF +lcDateStyle = Set("Date") +lcMark = Set("Mark") + +Set Date To Dmy +Set Mark To '.' + + +Set Textmerge On To Memvar lcXML NOSHOW +\ +SELECT (lcCursor) +*!* modificare 30.07.2012 +\ +SCAN + \ + \<> + \<> + \<> + \<> + \<> + \<> + \1 + \ +ENDSCAN +\ +Set Textmerge To + +Strtofile(lcXML, m.lcFisierXml ) +Set Date To &lcDateStyle +Set Mark To &lcMark + + + +aMESSAGEBOX('S-a creat fisierul '+m.lcFisierXml ,0+64,_screen.Caption) + + + +ENDPROC +**********************sfarsit procedura export_comanda_xml******************* + +***************************************************************************** +* citeste procentele de discount pe contractul tip CLIENT AUTO +* pentru completarea procentelor de discount la facturare +***************************************************************************** +PROCEDURE citeste_discount_contract + LPARAMETERS tnIdPart, tnIdCtr, tnProcDiscountManopera, tnProcDiscountMateriale + * tnIdPart IN - id client + * tnProcDiscountManopera, tnProcDiscountMateriale OUT + + Local lcSql, llSucces + PRIVATE pnDiscountManopera, pnDiscountMateriale, pnIdCtr, pnIdPart + pnIdPart = tnIdPart + pnIdCtr = 0 + pnDiscountManopera = 0.00 + pnDiscountMateriale = 0.00 + + lcSql = [begin pack_auto.citeste_discount_contract(?pnIdPart, ?gnIdSucursala, ?@pnIdCtr, ?@pnDiscountManopera, ?@pnDiscountMateriale); end;] + llSucces = goExecutor.oExecuta(m.lcSql) + IF !m.llSucces + pnDiscountManopera = 0.00 + pnDiscountMateriale = 0.00 + ENDIF + tnIdCtr = pnIdCtr + tnProcDiscountManopera = NVL(m.pnDiscountManopera, 0.00) + tnProcDiscountMateriale = NVL(pnDiscountMateriale, 0.00) +ENDPROC && citeste_discount_contract + + +***************************************************************************** +* salveaza procentele de discount pe contractul tip CLIENT AUTO (il creeaza daca nu exista) +* in formularul onom_devize.vcx:frm_dev_clienti +***************************************************************************** +PROCEDURE salveaza_discount_contract + LPARAMETERS tnIdPart, tnIdCtr, tnProcDiscountManopera, tnProcDiscountMateriale + * tnIdPart IN - id client + * tnIdCtr IN - id contract SERVICE AUTO + * tnProcDiscountManopera, tnProcDiscountMateriale IN + + Local lcSql, llSucces + PRIVATE pnDiscountManopera, pnDiscountMateriale, pnIdCtr, pnIdPart + pnIdPart = tnIdPart + pnIdCtr = tnIdCtr + pnDiscountManopera = tnProcDiscountManopera + pnDiscountMateriale = tnProcDiscountMateriale + lcSql = [begin pack_auto.salveaza_discount_contract(?pnIdPart, ?gnIdSucursala, ?pnIdCtr, ?pnDiscountManopera, ?pnDiscountMateriale); end;] + llSucces = goExecutor.oExecuta(m.lcSql) + RETURN m.llSucces +ENDPROC && salveaza_discount_contract + +* ----------------------------------- +* Intoarce .T. daca un tip de comanda se inchide prin validare sau .F. daca se inchide in alt mod ( nota inchidere, factura) +* ----------------------------------- +FUNCTION getOptiuneInchidereValidare + LPARAMETERS tnTipComanda + * tnTipComanda: 1 = garantie, 2 = postgarantie ...(DEV_TIP_DEVIZ) + + LOCAL lnReturnValue, llReturn, llSucces + PRIVATE pnTipComanda + + pnTipComanda = m.tnTipComanda + lnReturnValue = 0 + llSucces = goExecutor.oSelecteaza2Value("Select getOptiuneInchidere(?pnTipComanda) from dual", @lnReturnValue) + llReturn = (m.lnReturnValue = 1) + + RETURN m.llReturn +ENDFUNC && getOptiuneInchidereValidare + +* ----------------------------------- +* Salveaza optiunea de inchidere prin validare pe un tip de comanda +* ----------------------------------- +FUNCTION setOptiuneInchidereValidare + LPARAMETERS tnTipComanda, tlInchidereValidare + + LOCAL lnReturnValue + PRIVATE pnTipComanda, pnInchidereValidare + + pnTipComanda = m.tnTipComanda + pnInchidereValidare = IIF(m.tlInchidereValidare,1, 0) + + llSucces = goExecutor.oExecuta("begin setOptiuneInchidere(?pnTipComanda, ?pnInchidereValidare); end;") + + RETURN m.llSucces +ENDFUNC && setOptiuneInchidereValidare \ No newline at end of file diff --git a/Programe/oproceduri_listari.prg b/Programe/oproceduri_listari.prg new file mode 100644 index 0000000..275eac5 --- /dev/null +++ b/Programe/oproceduri_listari.prg @@ -0,0 +1,2051 @@ +*!* 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 = <>) + 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(),<>, 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 = <> +*!* 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 Î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Þ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Þ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Þ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ã -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ã -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Þ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à COMENZI ÎNCHISE PE SECÞII / AN FABRICAÞ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à COMENZI ÎNCHISE PE SECÞII / AN FABRICAÞ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à COMENZI ÎNCHISE PE SECÞ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ª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 +********************************************************************************************************* \ No newline at end of file diff --git a/Programe/oproceduri_vizualizare.prg b/Programe/oproceduri_vizualizare.prg new file mode 100644 index 0000000..43055b7 --- /dev/null +++ b/Programe/oproceduri_vizualizare.prg @@ -0,0 +1,940 @@ +*!* 19.08.2014 +*!* marius.mutu +*!* vizualizeaza_detalii_comanda: adaugat campul UM + +Procedure distribuire_timp_normat +*!* Local lcFiltru,lcSql,lnSucces +*!* lcFiltru = Strtran(gcCondLuna,Chr(39),Chr(63)) +*!* lcSql=[begin pack_devize.dev_distribuie_timp_n('] + Alltrim(gcS) + [',']+Alltrim(lcFiltru)+['); end;] +LOCAL lcSql,lnSucces +lcSql = [begin pack_auto.dev_distribuie_timp_n(?gnLuna,?gnAn); end;] +lnSucces=goExecutor.oExecute(lcSql) +If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,'Eroare') + Return +Endif +Endproc +********************************************************************************** +Procedure emitere_facturi +If glLunaInchisa + amessagebox("Nu puteti emite facturi, deoarece aceasta luna este inchisa!",0+48,"Luna inchisa") + Return +Endif +*!* *--------------------------------- + +*!* lcSql = [select a.id_ordl,a.id_lucrare,a.luna,a.an,a.datai,a.validat,a.dataoravalid,b.manopera,b.materiale,; +*!* a.nume,a.nrord,a.nrinmat,a.asigurator,a.inspector,a.util_valid,a.numar,a.tip_incas,a.id_masiniclient,; +*!* b.facturat,b.datafact; +*!* from ] + gcs + [.dev_vordl a left join ] + gcs +[.dev_vordl_manmat b on a.id_ordl = b.id_ordl] +*!* lnSucces=goExecutor.oExecute(lcSql,'crsMater') +*!* If lnSucces < 0 +*!* amessagebox(goExecutor.cEroare,0+16,'Eroare') +*!* ENDIF +*!* SELECT crsMater +*!* BROWSE +*!* *----------------------------------- +Private pcValoare1,pcValoare2,pcIntre,pnCriteriu, pnCriteriu2, pcFiltruOra,pcFiltruVfp +Private pcselect,pcschema,pcfiltru,pcorder,pocomenzi,llAfiseaza +Store '' To pocomenzi +pcValoare1 = "" +pcValoare2 = "" +pnCriteriu = 1 +pnCriteriu2 = 1 +pcIntre = "" +pcFiltruOra = "" +pcFiltruVfp = "" +Do Form frm_filtru_text With "nrord","Nr. comanda",pnCriteriu,pnCriteriu2 To pcFiltruOra + +If Used('crscomenzi') + Use In crscomenzi +Endif +*!* pcschema=['ID_ORDL n(10),ID_LUCRARE n(10),DATAI d,VALIDAT n(1),DATAORAVALID t,MANOPERA n(20,4),MATERIALE n(20,4),'+]+; +*!* ['NUME c(50),NRORD c(30),NRINMAT c(10),ASIGURATOR c(24),INSPECTOR c(24),UTIL_VALID c(30),FACTURAT n(1),DATAFACT d,'+]+; +*!* ['NRFACT n(15),ID_MASINICLIENT n(8),ID_PARTENER n(5),TIP_COMANDA c(50)'] +*!* pcselect=['select a.id_ordl,a.id_lucrare,a.datai,a.validat,a.dataoravalid,a.manopera,a.materiale,a.nume,'+]+; +*!* ['a.nrord,a.nrinmat,a.asigurator,a.inspector,a.util_valid,a.facturat,a.datafact,a.nrfact,a.id_masiniclient,'+]+; +*!* ['a.id_partener,a.tip_comanda '+]+; +*!* ['from ] + gcS + [.dev_vvalid_comenzi a '+]+; +*!* ['where 1=2'] +pcschema=[''] +pcselect=['select 0 as ales,a.* from ] + gcS + [.auto_validare_comenzi a '+]+; + ['where 1=2'] +IF !EMPTY(pcFiltruora) + * TIP = 1 POST GARANTIE, 2 = GARANTIE + pcfiltru = gcCondLuna + [ and a.inchis_fortat = 0 and a.id_tip IN (1,2) ] + pcFiltruOra +ELSE + pcfiltru = [1=2] +ENDIF +pcorder=[datai,nrord] +llAfiseaza=.F. +gencursor('pocomenzi','crscomenzi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza) +pocomenzi.ca_baza1.afisare() +Select crscomenzi + +ofrmfacturare=Createobject('frm_emitere_facturi') +*!* modificare v 2.0.17 +If !Empty(pcFiltruOra) + With ofrmfacturare.ck_nrord + .cValoare1 = pcValoare1 + .cValoare2 = pcValoare2 + .criteriu = pnCriteriu + .criteriu2 = pnCriteriu2 + .cIntre = pcIntre + .filtru = pcFiltruOra + .filtru_vfp = pcFiltruVFP + .Value = 1 + Endwith +Endif +*!* modificare v 2.0.17 ^ +ofrmfacturare.Show(1) +If Used('crscomenzi') + Use In crscomenzi +Endif +Release pocomenzi,ofrmfacturare + +Endproc && emitere_facturi +***************************************************************************************** +********************************************************************************** +Procedure inchidere_regie +Private pnVar +STORE 0 TO pnVar +goExecutor.oFunction2Value("pack_auto.getOptiuneInchidere(3)",@pnVar) +If Nvl(pnVar,1) = 1 + amessagebox("Comenzile de regie se inchid automat la validare!",0+48,"Atentie") + Return +Endif + +If glLunaInchisa + amessagebox("Nu puteti inchide comenzi de regie, deoarece aceasta luna este inchisa!",0+48,"Luna inchisa") + Return +Endif + +Private pcValoare1,pcValoare2,pcIntre,pnCriteriu, pnCriteriu2, pcFiltruOra, pcFiltruVFP +Private pcselect,pcschema,pcfiltru,pcorder,pocomenzi,llAfiseaza +Store '' To pocomenzi +pcValoare1 = "" +pcValoare2 = "" +pnCriteriu = 1 +pnCriteriu2 = 1 +pcIntre = "" +pcFiltruOra = "" +pcFiltruVFP = "" +Do Form frm_filtru_text With "nrord","Nr. comanda",pnCriteriu,pnCriteriu2 To pcFiltruOra + +If Used('crscomenzi') + Use In crscomenzi +Endif +pcschema=[''] +pcselect=['select * from ] + gcS + [.auto_validare_comenzi a '+]+; + ['where 1=2'] +IF !EMPTY(pcFiltruora) + pcfiltru = gcCondLuna + [ and a.id_tip=3 ] + pcFiltruOra +ELSE + pcfiltru = [1=2] +ENDIF +pcorder=[datai,nrord] +llAfiseaza=.F. +gencursor('pocomenzi','crscomenzi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza) +pocomenzi.ca_baza1.afisare() +Select crscomenzi + +ofrmfacturare=Createobject('frm_inchidere_regie') +*!* modificare v 2.0.17 +If !Empty(pcFiltruOra) + With ofrmfacturare.ck_nrord + .cValoare1 = pcValoare1 + .cValoare2 = pcValoare2 + .criteriu = pnCriteriu + .criteriu2 = pnCriteriu2 + .cIntre = pcIntre + .filtru = pcFiltruOra + .filtru_vfp = pcFiltruVFP + .Value = 1 + Endwith +Endif +*!* modificare v 2.0.17 ^ +ofrmfacturare.Show(1) +If Used('crscomenzi') + Use In crscomenzi +Endif +Release pocomenzi,ofrmfacturare + +Endproc && inchidere_regie +***************************************************************************************** +********************************************************************************** +Procedure inchidere_productie +Private pnVar +STORE 1 TO pnVar +goExecutor.oFunction2Value("pack_auto.getOptiuneInchidere(6)",@pnVar) +If Nvl(pnVar,1) = 1 + amessagebox("Comenzile de productie se inchid automat la validare!",0+48,"Atentie") + Return +Endif + +If glLunaInchisa + amessagebox("Nu puteti inchide comenzi de productie, deoarece aceasta luna este inchisa!",0+48,"Luna inchisa") + Return +Endif + +Private pcValoare1,pcValoare2,pcIntre,pnCriteriu, pnCriteriu2, pcFiltruOra, pcFiltruVFP +Private pcselect,pcschema,pcfiltru,pcorder,pocomenzi,llAfiseaza +Store '' To pocomenzi +pcValoare1 = "" +pcValoare2 = "" +pnCriteriu = 1 +pnCriteriu2 = 1 +pcIntre = "" +pcFiltruOra = "" +pcFiltruVFP = "" +Do Form frm_filtru_text With "nrord","Nr. comanda",pnCriteriu,pnCriteriu2 To pcFiltruOra + +If Used('crscomenzi') + Use In crscomenzi +Endif +pcschema=[''] +pcselect=['select * from ] + gcS + [.auto_validare_comenzi a '+]+; + ['where 1=2'] +IF !EMPTY(pcFiltruora) + pcfiltru = gcCondLuna + [ and a.id_tip=6 ] + pcFiltruOra +ELSE + pcfiltru = [1=2] +ENDIF +pcorder=[datai,nrord] +llAfiseaza=.F. +gencursor('pocomenzi','crscomenzi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza) +pocomenzi.ca_baza1.afisare() +Select crscomenzi + +ofrmfacturare=Createobject('frm_inchidere_productie') +*!* modificare v 2.0.17 +If !Empty(pcFiltruOra) + With ofrmfacturare.ck_nrord + .cValoare1 = pcValoare1 + .cValoare2 = pcValoare2 + .criteriu = pnCriteriu + .criteriu2 = pnCriteriu2 + .cIntre = pcIntre + .filtru = pcFiltruOra + .filtru_vfp = pcFiltruVFP + .Value = 1 + Endwith +Endif +*!* modificare v 2.0.17 ^ +ofrmfacturare.Show(1) +If Used('crscomenzi') + Use In crscomenzi +Endif +Release pocomenzi,ofrmfacturare + +Endproc && inchidere_productie +***************************************************************************************** +Procedure vizualizare_facturi +Private pcselect,pcschema,pcfiltru,pcorder,pofacturi,llAfiseaza +Store '' To pofacturi +pcschema=['NRCRT n(5),ID_LUCRARE N(20),NRORD C(50),DATAI d,NUME c(50),TELEFON C(50),MANOPERA n(20,4),MATERIALE n(20,4),MANOPERA_DEVIZ n(20,4), MATERIALE_DEVIZ n(20,4),'+]+; + ['ASIGURATOR c(24),INSPECTOR c(24),NR_DOSAR c(40),NRINMAT c(35),NRACT n(14),DATAACT d,VALCTVA n(19,2), ID_PART_REF N(20), PART_REF C(100)'] +pcorder=[a.dataact,a.nract,a.datai,a.nrord] +*!* modificare 27.01 +*!* 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,a.nrfact as nract,a.datafact as dataact,a.valctva '+]+; +*!* ['from ] + gcS + [.dev_validare_comenzi a '+]+; +*!* ['where 1=2'] +pcselect=['select a.nrcrt,a.id_lucrare,a.nrord,a.datai,a.nume,a.telefon,a.manopera,a.materiale,a.manopera_deviz, a.materiale_deviz, a.asigurator,a.inspector,'+]+; + ['a.nr_dosar,a.nrinmat,a.nract,a.dataact,a.valctva, a.id_part_ref, a.part_ref '+]+; + ['from auto_facturi_emise a'+]+; + ['where 1=2'] + +*!* *!* ['join ] + gcS + [.vireg_parteneri b on a.id_lucrare=b.id_lucrare '+]+; +*!* *!* pcfiltru=[b.luna=]+Alltrim(Str(gnLuna))+[ and b.an=]+Alltrim(Str(gnAn)) +*!* *!* pcfiltru=[(extract(month from dataact) =]+Alltrim(Str(gnLuna))+[ and extract(year from dataact) =]+Alltrim(Str(gnAn))+[)] +pcFiltru=[1=2] +*!* *!* pcfiltru = gcCondLuna + [ and a.facturat = 1] +llAfiseaza=.F. + +gencursor('pofacturi','crsfacturi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza) +pofacturi.ca_baza1.afisare() + +ofrmvizfact=Createobject('frm_viz_facturi') +ofrmvizfact.Show(1) +If Used('crsfacturi') + Use In crsfacturi +Endif +Release pofacturi +Endproc && vizualizare_facturi +***************************************************************************************** +Function vizualizeaza_detalii_comanda + Lparameters toFereastra,toComanda,tlDoarVizualizare + Local loFrmDetaliiComanda, lcSelect, lcSchema, lcFiltru, lcOrder, llAfiseaza, lnDoarVizualizare + Private plComandaM, poOper, poRul, poDevEst + Store '' To poOper, poRul, poDevEst + plComandaM = .F. + llAfiseaza = .F. + Do ccsectii In update_devize.prg + + lcSchema=['ID_ORDL n(10),CODOP c(10),TIMPN n(9,3),PRET n(20,4),VALIDAT n(1),DENOP c(100),SECTIE c(100),DATAI d,ID_OPER N(20),NOU N(1)'] + lcSelect=['select id_ordl,codop,timpn,pret,validat,denop,sectie,datai,id_oper,nou from ] + gcS + [.auto_voper where 1=2'] + lcOrder=[datai,id_oper] + lcFiltru= [id_ordl = ]+Alltrim(Str(toComanda.id_ordl))+[ and ]+; + [extract(month from datai)+extract(year from datai)*12<=?gnLuna+?gnAn*12] + gencursor('pooper','oper',lcSelect,lcFiltru,lcSchema,lcOrder,llAfiseaza) + poOper.ca_baza1.afisare() + + *!* am pus toComanda.proc_tvav in loc de pack_contafin.getCotaTVAStandard + *!* era pack_contafin.getCotaTVAStandard era pus pentru ca se poate schimba TVA-ul de la o luna la alta si pe factura trebuie sa am + *!* calculat tva-ul cu cota din luna curenta,nu cu cea din luna in care am facut bonul + *!* toComanda.proc_tvav se stabileste la crearea comenzii auto, se actualizeaza la validare si la facturare + lcSchema=['CODMAT c(50),DENUMIRE c(100),UM C(10),PRETV n(20,4),CANTE n(18,3),DATAACT D,ID_RUL n(20),COTA_DIFERITA n(1),TVA n(20,4),PRETCTVA n(20,4)'] + *!* modificare v 2.0.41 : am adaugat pack_sesiune.calculeaza_pret_cu_tva + lcSelect=[select codmat,denumire,um,pretv,cante,dataact,id_rul,decode(proc_tvav,] + ALLTRIM(STR(toComanda.proc_tvav,10,4)) + [,0,1) as cota_diferita,] + ; + [pack_sesiune.calculeaza_pret_tva(pretv,1,pack_def.GetIdMonedaNationala(),] + ; + ALLTRIM(STR(toComanda.proc_tvav,10,4)) + [,0,2) as tva, ] + ; + [pack_sesiune.calculeaza_pret_cu_tva(pretv,1,pack_def.GetIdMonedaNationala(),] + ; + ALLTRIM(STR(toComanda.proc_tvav,10,4)) + [,0,2) as pretctva ] + ; + [from ] + gcS + [.vrul where 1=2'] + lcOrder=[dataact,id_rul] + lcFiltru= [id_lucrare = ]+Alltrim(Str(toComanda.id_lucrare))+[ and cante <> 0 and ]+; + [luna+an*12<=?gnLuna+?gnAn*12] + gencursor('porul','rul',lcSelect,lcFiltru,lcSchema,lcOrder,llAfiseaza) + poRul.ca_baza1.afisare() + + lcSchema=['DENUMIRE v(100),COD v(10),UM v(10),CANTITATE n(20,4),PRETFTVA n(20,4),PRETCTVA n(20,4),COTA_TVA n(10),VALOARE n(20,4),ID_DEV_ESTIMARE_REP n(20),ID_LUCRARE n(10),NRORD v(50),ID_NORME n(5),ID_ARTICOL n(20),PRET_CU_TVA n(1),VALFTVA n(20,4),VALTVA n(20,4)'] + lcSelect=['select denumire,cod,um,cantitate,pretftva,pretctva,cota_tva,valoare,id_dev_estimare_rep,id_lucrare,nrord,id_norme,id_articol,pret_cu_tva,valftva,valtva from ] + gcS + [.auto_vestimari_rep where 1=2'] + lcOrder=[id_dev_estimare_rep] + lcFiltru= [id_lucrare = ]+Alltrim(Str(toComanda.id_lucrare)) + gencursor('podevest','v_devizest',lcSelect,lcFiltru,lcSchema,lcOrder,llAfiseaza) + poDevEst.ca_baza1.afisare() + + lnDoarVizualizare = Iif(Empty(tlDoarVizualizare),1,Iif(tlDoarVizualizare,2,1)) + toFereastra.AlwaysOnTop=.F. + loFrmDetaliiComanda = Createobject('frm_vizcomanda',lnDoarVizualizare,toComanda.Validat) + loFrmDetaliiComanda.Show(1) + toFereastra.AlwaysOnTop=.T. + Use In (Select('oper')) + Use In (Select('rul')) + Use In (Select('v_devizest')) + Release loFrmDetaliiComanda, lcSelect, lcSchema, lcFiltru, lcOrder, llAfiseaza, poOper, poRul, poDevEst,llDoarVizualizare + Return plComandaM +Endfunc +***************************************************************************************** +Procedure vizualizare_comenzi_regie +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),'+]+; + ['NRINMAT c(35),NRACT n(14),DATAACT d,TOTALFTVA n(19,2)'] +pcorder=[a.datai,a.nrord] +pcselect=['select a.nrcrt,a.nrord,a.datai,a.nume,a.manopera,a.materiale,'+]+; + ['a.nrinmat,a.nract,a.dataact,a.totalftva '+]+; + ['from ]+gcS+[.auto_inchidere a'+]+; + ['where 1=2'] + +pcFiltru=[1=2] +llAfiseaza=.F. + +gencursor('pofacturi','crsfacturi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza) +pofacturi.ca_baza1.afisare() + +ofrmvizfact=Createobject('frm_viz_comenzi_regie') +ofrmvizfact.Show(1) +If Used('crsfacturi') + Use In crsfacturi +Endif +Release pofacturi +Endproc && vizualizare_comenzi_regie +***************************************************************************************** +Procedure normare_salarii +*!* If glLunaInchisa +*!* amessagebox("Nu puteti norma salariile, deoarece aceasta luna este inchisa!",0+48,"Luna inchisa") +*!* Return +*!* Endif + +Local loTherm, lcTask, lnPercent +Private pcselect,pcschema,pcfiltru,pcorder,pomanopera,pomecanici,llAfiseaza +Store '' To pomanopera,pomecanici +If Used('crsmanopera') + Use In crsmanopera +Endif +If Used('crsmecanici') + Use In crsmecanici +Endif +loTherm = Newobject("_thermometer","_therm","","Manopera comenzi inchise...") +lcTask = "Incarcare date vizualizare" +_Screen.MousePointer= 11 +*!* gofundal.AlwaysOnTop=.F. +With loTherm + .AlwaysOnTop=.T. + .Show() + + lnPercent = 0 + lcTask="Incarcare date mecanici..." + .Update(lnPercent, lcTask) +*!* =ccsectii() + =ccmecanici() + + lnPercent = 20 + .Update(lnPercent, lcTask) + pcschema=['NRORD c(50),DATAI d,ID_OPER n(10),TIMPN n(9,3),PRET n(20,4),ID_SECTIE n(5),SECTIE c(30),'+]+; + ['DENOP c(100),UTIL c(30),DATAORA t,FACTURAT n(1),NRFACT N(14),DATAFACT d,TIP_COMANDA c(50)'] +*!* pcselect=['select a.nrord,a.datai,b.id_oper,b.timpn,b.pret,b.id_sectie,b.sectie,b.denop,b.util,b.dataora,'+]+; +*!* ['c.facturat,c.nrfact,c.datafact '+]+; +*!* ['from ] + gcS + [.dev_vordl a '+]+; +*!* ['join ] + gcS + [.dev_voper b on a.id_ordl=b.id_ordl '+]+; +*!* ['left join ] + gcS + [.dev_vordl_facturat c on a.id_ordl=c.id_ordl '+]+; +*!* ['where 1=2'] + *!* inlocuire dev_vvalid_comenzi + pcselect=['select a.nrord,a.datai,b.id_oper,b.timpn,b.pret,b.id_sectie,b.sectie,b.denop,b.util,b.dataora,'+]+; + ['a.facturat,a.nrfact,a.datafact,a.tip_comanda '+]+; + ['from ] + gcS + [.auto_normare_comenzi a '+]+; + ['join ] + gcS + [.auto_voper b on a.id_ordl=b.id_ordl '+]+; + ['where 1=2'] +*!* pcfiltru=[a.luna=]+Alltrim(Str(gnLuna))+[ and a.an=]+Alltrim(Str(gnAn))+[ and a.facturat=1] +*!* pcFiltru = [extract(month from a.datafact) = ] + Alltrim(Str(gnLuna)) + [ and extract(year from a.datafact) = ]+Alltrim(Str(gnAn))+[ and a.facturat=1] + pcfiltru = gcCondLuna + [ and a.facturat = 1] + pcorder=[a.datai,a.nrord] + llAfiseaza=.F. + pcfiltru = [1=2] + gencursor('pomanopera','crsmanopera',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza) + + If !glLunaInchisa + lnPercent = 30 + lcTask="Distribuire timp normat..." + .Update(lnPercent, lcTask) + distribuire_timp_normat() + endif +*!* lcSql=[begin pack_devize.dev_distribuie_timp_n('] + Alltrim(gcS) + [',']+Alltrim(pcfiltru)+['); end;] +*!* lnSucces=goExecutor.oExecute(lcSql) +*!* If lnSucces < 0 +*!* amessagebox(goExecutor.cEroare,0+16,'Eroare') +*!* Endif + + lnPercent = 60 + lcTask="Incarcare date operatii comenzi..." + .Update(lnPercent, lcTask) + pomanopera.ca_baza1.afisare() + + lnPercent = 90 + lcTask="Incarcare date manopera..." + .Update(lnPercent, lcTask) + pcschema=['ID_OPERMECANIC n(10),ORE n(9,3),NUME c(100),ID_MECANIC n(5)'] + pcselect=['select id_opermecanic,ore,nume||CHR(32)||prenume as nume,id_mecanic from ] + gcS + [.auto_voper_detalii_m '+]+; + ['where 1=2'] + pcfiltru=[1=2] + pcorder=[nume] + llAfiseaza=.F. + gencursor('pomecanici','crsmecanici',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza) + + .Complete() + .AlwaysOnTop=.F. +Endwith +*!* gofundal.AlwaysOnTop=.T. +_Screen.MousePointer= 0 + +ofrmvizfact=Createobject('frm_normare_salarii') +ofrmvizfact.Show(1) +If Used('crsmecanici') + Use In crsmecanici +Endif +If Used('crsmanopera') + Use In crsmanopera +Endif +Release pocomenzi,pomanopera +Endproc && normare salarii +***************************************************************************************** +Procedure vizualizare_ist_comenzi +Private pcselect,pcschema,pcfiltru,pcorder,pocomenzi,llAfiseaza +Store '' To pocomenzi + +pcschema=['ID_ORDL n(10),ID_LUCRARE n(10),ID_MASINICLIENT n(8),ID_TIP n(5),DATAI d,'+]+; + ['VALIDAT n(1),DATAORAVALID T,UTIL_VALID C(50),NRORD c(50),FACTURAT n(1),DATAFACT d,NRFACT N(14),'+]+; + ['VALCTVA_FACTURA N(20,4),VAL_MANOPERA_FACTURA N(20,4),VAL_MATERIALE_FACTURA N(20,4),'+]+; + ['VAL_MATERIALE_ACH N(20,4),VAL_MATERIALE_VZ N(20,4),ORE_MANOPERA N(20,4),VAL_MANOPERA N(20,4),'+]+; + ['ID_PARTENER n(10),NRINMAT c(35),MASINA c(20),MARCA c(24),NUME c(50),'+]+; + ['ASIGURATOR c(40),INSPECTOR c(40),NR_DOSAR c(40),TIP_COMANDA c(50),PROC_TVAV N(10,4), INCHIS_FORTAT N(1), DATAORAINCHIS T, UTIL_INCHIS C(30), ID_PART_REF N(20), PART_REF C(100),'+]+; + ['SERIES V(100), KMINT I, ORE_FUNCTIONARE I'] + +pcselect=[select a.id_ordl,a.id_lucrare,a.id_masiniclient,a.id_tip,a.datai,]+; + [a.validat,a.dataoravalid,a.util_valid,a.nrord,a.facturat,a.datafact,a.nrfact,]+; + [a.valctva_factura, a.val_manopera_factura, a.val_materiale_factura, a.val_materiale_ach, a.val_materiale_vz, a.ore_manopera, a.val_manopera,]+; + [a.id_partener,a.nrinmat,a.masina,a.marca,a.nume,a.asigurator,a.inspector,a.nr_dosar,]+; + [a.tip_comanda,a.proc_tvav, ] + ; + [a.inchis_fortat, a.dataorainchis, a.util_inchis, a.id_part_ref, a.part_ref, ]+; + [a.series, a.kmint, a.ore_functionare ] + ; + [ from auto_istoric_comenzi a where 1=2] + +pcfiltru=[1=2] +pcorder=[a.datai,a.nrord] +llAfiseaza=.F. +gencursor('pocomenzi','crscomenzi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza) +pocomenzi.ca_baza1.afisare() + +ofrmistoric=Createobject('frm_istoric_comenzi') +ofrmistoric.Show(1) +If Used('crscomenzi') + Use In crscomenzi +Endif +Release pocomenzi +Endproc && vizualizare_ist_comenzi +***************************************************************************************** +Procedure vizualizare_manopera +*!* If glLunaInchisa +*!* amessagebox("Nu puteti vizualiza manopera, deoarece luna este inchisa!",0+48,"Luna inchisa") +*!* Return +*!* Endif + +Local loTherm, lcTask, lnPercent +Private pcselect,pcschema,pcfiltru,pcorder,pomanopera,pomecanici,llAfiseaza +Store '' To pomanopera,pomecanici +If Used('crsmanopera') + Use In crsmanopera +Endif +If Used('crsmecanici') + Use In crsmecanici +Endif + +loTherm = Newobject("_thermometer","_therm","","Manopera comenzi in luna curenta...") +lcTask = "Incarcare date vizualizare" +_Screen.MousePointer= 11 +*!* gofundal.AlwaysOnTop=.F. +With loTherm + .AlwaysOnTop=.T. + .Show() + + lnPercent = 0 + lcTask="Incarcare date sectii si mecanici..." + .Update(lnPercent, lcTask) + Do ccsectii in update_devize.prg + =ccmecanici() + + lnPercent = 20 + .Update(lnPercent, lcTask) + pcschema=['NRORD c(50),DATAI d,ID_OPER n(10),TIMPN n(9,3),PRET n(20,4),ID_SECTIE n(5),SECTIE c(30),'+]+; + ['DENOP c(100),UTIL c(30),DATAORA t,FACTURAT n(1),NRFACT N(14),DATAFACT d,TIP_COMANDA c(50)'] + *!* inlocuire dev_vvalid_comenzi + pcselect=['select a.nrord,a.datai,b.id_oper,b.timpn,b.pret,b.id_sectie,b.sectie,b.denop,b.util,b.dataora,'+]+; + ['a.facturat,a.nrfact,a.datafact,a.tip_comanda '+]+; + ['from ] + gcS + [.auto_normare_comenzi a '+]+; + ['join ] + gcS + [.auto_voper b on a.id_ordl=b.id_ordl '+]+; + ['where 1=2'] +*!* pcselect=['select a.nrord,a.datai,b.id_oper,b.timpn,b.pret,b.id_sectie,b.sectie,b.denop,b.util,b.dataora,'+]+; +*!* ['c.facturat,c.nrfact,c.datafact '+]+; +*!* ['from ] + gcS + [.dev_vordl a '+]+; +*!* ['join ] + gcS + [.dev_voper b on a.id_ordl=b.id_ordl '+]+; +*!* ['left join ] + gcS + [.dev_vordl_facturat c on a.id_ordl=c.id_ordl '+]+; +*!* ['where 1=2'] +*!* pcfiltru=[a.luna=]+Alltrim(Str(gnLuna))+[ and a.an=]+Alltrim(Str(gnAn)) +*!* pcFiltru = [(extract(month from a.datafact) = ] + Alltrim(Str(gnLuna)) + [ and extract(year from a.datafact) = ]+Alltrim(Str(gnAn)) + [ or a.datafact is null)] + pcfiltru = gcCondLuna + pcorder=[a.datai,a.nrord] + llAfiseaza=.F. + pcfiltru = [1=2] + gencursor('pomanopera','crsmanopera',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza) + + If !glLunaInchisa + lnPercent = 30 + lcTask="Distribuire timp normat..." + .Update(lnPercent, lcTask) + distribuire_timp_normat() + endif +*!* lcSql=[begin pack_devize.dev_distribuie_timp_n('] + Alltrim(gcS) + [',']+Alltrim(pcfiltru)+['); end;] +*!* lnSucces=goExecutor.oExecute(lcSql) +*!* If lnSucces < 0 +*!* amessagebox(goExecutor.cEroare,0+16,'Eroare') +*!* Endif + + lnPercent = 60 + lcTask="Incarcare date operatii comenzi..." + .Update(lnPercent, lcTask) + pomanopera.ca_baza1.afisare() + + lnPercent = 90 + lcTask="Incarcare date manopera..." + .Update(lnPercent, lcTask) + pcschema=['ID_OPERMECANIC n(10),ORE n(9,3),NUME c(100),ID_MECANIC n(5)'] + pcselect=['select id_opermecanic,ore,nume||CHR(32)||prenume as nume,id_mecanic from ] + gcS + [.auto_voper_detalii_m '+]+; + ['where 1=2'] + pcfiltru=[1=2] + pcorder=[nume] + llAfiseaza=.F. + gencursor('pomecanici','crsmecanici',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza) + + .Complete() + .AlwaysOnTop=.F. +Endwith +Release loTherm +*!* gofundal.AlwaysOnTop=.T. +_Screen.MousePointer= 0 + +ofrmmanopera=Createobject('frm_viz_manopera') +ofrmmanopera.Show(1) +If Used('crsmecanici') + Use In crsmecanici +Endif +If Used('crsmanopera') + Use In crsmanopera +Endif +Release pocomenzi,pomanopera +Endproc && vizualizare_manopera +***************************************************************************************** +Procedure validare_comenzi +If glLunaInchisa + amessagebox("Nu puteti valida comenzi, deoarece aceasta luna este inchisa!",0+48,"Luna inchisa") + Return +Endif + +Private pcValoare1,pcValoare2,pcIntre,pnCriteriu, pnCriteriu2, pcFiltruOra, pcFiltruVFP +Private pcselect,pcschema,pcfiltru,pcorder,pocomenzi,llAfiseaza +Store '' To pocomenzi +pcValoare1 = "" +pcValoare2 = "" +pnCriteriu = 1 +pnCriteriu2 = 1 +pcIntre = "" +pcFiltruOra = "" +pcFiltruVFP = "" +Do Form frm_filtru_text With "nrord","Nr. comanda",pnCriteriu,pnCriteriu2 To pcFiltruOra + +If Used('crscomenzi') + Use In crscomenzi +Endif +*!* pcschema=['ID_ORDL n(10),ID_LUCRARE n(10),DATAI d,VALIDAT n(1),DATAORAVALID t,MANOPERA n(20,4),MATERIALE n(20,4),'+]+; +*!* ['NUME c(50),NRORD c(30),NRINMAT c(10),ASIGURATOR c(24),INSPECTOR c(24),UTIL_VALID c(30),FACTURAT n(1),TIP_COMANDA c(50)'] +*!* pcselect=['select a.id_ordl,a.id_lucrare,a.datai,a.validat,a.dataoravalid,a.manopera,a.materiale,a.nume,'+]+; +*!* ['a.nrord,a.nrinmat,a.asigurator,a.inspector,a.util_valid,a.facturat,tip_comanda from ] + gcS + [.dev_validare_comenzi a '+]+; +*!* ['where 1=2'] +pcschema=['ID_ORDL n(10),ID_LUCRARE n(10),DATAI d,VALIDAT n(1),DATAORAVALID t,MANOPERA n(20,4),MATERIALE n(20,4),'+]+; + ['NUME c(50),NRORD c(50),NRINMAT c(35),ASIGURATOR c(24),INSPECTOR c(24),NR_DOSAR c(40),UTIL_VALID c(30),'+]+; + ['FACTURAT n(1),ID_TIP N(5),TIP_COMANDA c(50),PROC_TVAV N(10,4), INCHIS_FORTAT N(1), DATAORAINCHIS T, UTIL_INCHIS C(30),' + ]+; + ['KMINT I, ORE_FUNCTIONARE I, SERIES V(100), CILINDREE I, PUTERECP I, PUTEREKW I'] +pcselect=['select a.id_ordl,a.id_lucrare,a.datai,a.validat,a.dataoravalid,a.manopera,a.materiale,a.nume,'+]+; + ['a.nrord,a.nrinmat,a.asigurator,a.inspector,a.nr_dosar,a.util_valid,a.facturat,a.id_tip,a.tip_comanda,a.proc_tvav, '+]+; + ['a.inchis_fortat, a.dataorainchis, a.util_inchis, a.kmint, a.ore_functionare, a.series, a.cilindree, a.puterecp, a.puterekw '+]+; + ['from auto_validare_comenzi a '+]+; + ['where 1=2'] + + +&&pcFiltru = [extract(month from a.datafact) = ] + Alltrim(Str(gnLuna)) + [ and extract(year from a.datafact) = ]+Alltrim(Str(gnAn))+ +*!* pcfiltru=[((extract(month from datafact) =]+Alltrim(Str(gnLuna))+[ and extract(year from datafact) =]+Alltrim(Str(gnAn)) +[) or (datafact is null ))]+pcFiltruOra +IF !EMPTY(pcFiltruora) + pcfiltru = gcCondLuna +pcFiltruOra +ELSE + pcfiltru = [1=2] +ENDIF +pcorder=[a.datai,a.nrord] +llAfiseaza=.F. +gencursor('pocomenzi','crscomenzi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza) +pocomenzi.ca_baza1.afisare() +Select crscomenzi +ofrmvalidare=Createobject('frm_val_comenzi') +*!* modificare v 2.0.17 +If !Empty(pcFiltruOra) + With ofrmvalidare.ck_nrord + .cValoare1 = pcValoare1 + .cValoare2 = pcValoare2 + .criteriu = pnCriteriu + .criteriu2 = pnCriteriu2 + .cIntre = pcIntre + .filtru = pcFiltruOra + .filtru_vfp = pcFiltruVFP + .Value = 1 + Endwith +Endif +*!* modificare v 2.0.17 ^ +ofrmvalidare.Show(1) +If Used('crscomenzi') + Use In crscomenzi +Endif +Release pocomenzi +Endproc && validare_comenzi +***************************************************************************************** +Procedure vizualizare_comenzi +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),NRINMAT c(35),VALIDAT n(1),ID_TIP N(5),TIP_COMANDA c(50),DATAORAVALID D,'+] +; + ['FACTURAT n(1),DATAFACT d,NRFACT N(14),PROC_TVAV N(10,4), ID_PART_REF N(20), PART_REF C(100), SERIES V(100), KMINT I, ORE_FUNCTIONARE I'] + +pcselect=['select a.id_ordl,a.id_lucrare,a.datai,a.nume,a.nrord,a.nrinmat,a.validat,a.id_tip,a.tip_comanda,a.dataoravalid,a.facturat,a.datafact,a.nrfact,a.proc_tvav, a.id_part_ref, a.part_ref, '+]+; + [' a.series, a.kmint, a.ore_functionare '+] + ; + [' from ] + gcS + [.auto_normare_comenzi a where 1=2'] +*!* [' from ] + gcS + [.dev_vvalid_comenzi a where 1=2'] +*!* pcfiltru=[luna=]+Alltrim(Str(gnLuna))+[ and an=]+Alltrim(Str(gnAn)) +*!* pcfiltru=[(extract(month from datafact) =]+Alltrim(Str(gnLuna))+[ and extract(year from datafact) =]+Alltrim(Str(gnAn))+[) or (datafact is null )] + +pcfiltru = [1=2] && gcCondLuna + +pcorder=[a.datai,a.nrord] +llAfiseaza=.F. +gencursor('pocomenzi','crscomenzi',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza) +pocomenzi.ca_baza1.afisare() + +ofrmviz=Createobject('frm_viz_comenzi') +ofrmviz.Show(1) +If Used('crscomenzi') + Use In crscomenzi +Endif +Release pocomenzi +Endproc && vizualizare_comenzi +***************************************************************************************** +******************************************* +* PROCEDURE viz_optiuni( ) +* Data/ora : 02/10/05, 15:46:17 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure viz_optiuni( ) +Private lcCuloare,pcDev_p411,pcDEV_s411,pcDev_nr411,pcDev_poz411,pcDev_p704,pcDEV_s704,pcDev_nr704,pcDev_poz704 +pcDev_p411 = gcDev_p411 +pcDEV_s411 = gcDEV_s411 +pcDev_nr411 = gcDev_nr411 +pcDev_poz411 = gcDev_poz411 + +pcDev_p704 = gcDev_p704 +pcDEV_s704 = gcDEV_s704 +pcDev_nr704 = gcDev_nr704 +pcDev_poz704 = gcDev_poz704 + +*!* STORE gcCuloare_fundal TO lcCuloare +oopt = Createobject('optiuni_frm') +oopt.Show(1) +*!* DEBUG +*!* SUSPEND + +If pcDev_p411 # gcDev_p411 + lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + Alltrim(gcDEV_Sp411) + [' where varname =] + ['DEV_P411'] + lnSucces = goExecutor.oExecute(lcSql) + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,"Eroare") + Return + Endif +Endif +If pcDEV_s411 # gcDEV_s411 + lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + Alltrim(gcDEV_s411) + [' where varname =] + [ 'DEV_S411'] + lnSucces = goExecutor.oExecute(lcSql) + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,"Eroare") + Return + Endif +Endif + +If pcDev_poz411 # gcDev_poz411 + lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + Alltrim(gcDev_poz411) + [' where varname =] + [ 'DEV_POZ411'] + lnSucces = goExecutor.oExecute(lcSql) + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,"Eroare") + Return + Endif +Endif +If pcDev_nr411 # gcDev_nr411 + lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + Alltrim(gcDev_nr411) + [' where varname =] + [ 'DEV_NR411'] + lnSucces = goExecutor.oExecute(lcSql) + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,"Eroare") + Return + Endif +Endif + + + +*------------------ +If pcDev_p704 # gcDev_p704 + lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + Alltrim(gcDev_p704) + [' where varname =] + ['DEV_P704'] + lnSucces = goExecutor.oExecute(lcSql) + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,"Eroare") + Return + Endif +Endif +If pcDEV_s704 # gcDEV_s704 + lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + Alltrim(gcDEV_s704) + [' where varname =] + [ 'DEV_S704'] + lnSucces = goExecutor.oExecute(lcSql) + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,"Eroare") + Return + Endif +Endif + +If pcDev_poz704 # gcDev_poz704 + lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + Alltrim(gcDev_poz704) + [' where varname =] + [ 'DEV_POZ704'] + lnSucces = goExecutor.oExecute(lcSql) + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,"Eroare") + Return + Endif +Endif +If pcDev_nr704 # gcDev_nr704 + lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + Alltrim(gcDev_nr704) + [' where varname =] + [ 'DEV_NR704'] + lnSucces = goExecutor.oExecute(lcSql) + If lnSucces < 0 + amessagebox(goExecutor.cEroare,0+16,"Eroare") + Return + Endif +Endif +*!* pcDev_p704 = gcDev_p704 +*!* pcDEV_s704 = gcDEV_s704 +*!* pcDev_nr704 = gcDev_nr704 +*!* pcDev_poz704 = gcDev_poz704 + + + + + +*!* *----------optiuni analitice pt 704 + +*!* IF !EMPTY(gcDEV_P704) +*!* lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + ALLTRIM(gcDEV_P704) + [' where varname =] + ['DEV_P704'] +*!* ELSE +*!* lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + [' where varname =] + ['DEV_P704'] +*!* ENDIF +*!* lnSucces = goExecutor.oExecute(lcSql) +*!* If lnSucces < 0 +*!* amessagebox(goExecutor.cEroare,0+16,"Eroare") +*!* Return +*!* ENDIF +*!* IF EMPTY(gcDEV_S704) +*!* lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + [' where varname =]+[ 'DEV_S704'] +*!* ELSE +*!* lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + ALLTRIM(gcDEV_S704) + [' where varname =] + [ 'DEV_S704'] +*!* ENDIF +*!* lnSucces = goExecutor.oExecute(lcSql) +*!* If lnSucces < 0 +*!* amessagebox(goExecutor.cEroare,0+16,"Eroare") +*!* Return +*!* ENDIF + +*!* IF EMPTY(gcDEV_POZ704) +*!* lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + [' where varname =]+[ 'DEV_POZ704'] +*!* ELSE +*!* lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + ALLTRIM(gcDEV_POZ704) + [' where varname =] + [ 'DEV_POZ704'] +*!* ENDIF +*!* lnSucces = goExecutor.oExecute(lcSql) +*!* If lnSucces < 0 +*!* amessagebox(goExecutor.cEroare,0+16,"Eroare") +*!* Return +*!* ENDIF + +*!* IF EMPTY(gcDEV_NR704) +*!* lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + [' where varname =]+[ 'DEV_NR704'] +*!* ELSE +*!* lcSql = [UPDATE ] + gcS + [.optiuni SET varvalue = '] + ALLTRIM(gcDEV_NR704) + [' where varname =] + [ 'DEV_NR704'] +*!* ENDIF +*!* lnSucces = goExecutor.oExecute(lcSql) +*!* If lnSucces < 0 +*!* amessagebox(goExecutor.cEroare,0+16,"Eroare") +*!* Return +*!* ENDIF + +*!* IF gcCuloare_fundal # lcCuloare +*!* ENDIF + +Endproc + +**********************sfarsit procedura viz_optiuni******************* +**********************inceput procedura viz_stocuri******************* +Procedure viz_stocuri +*!* +tcTipGest=[] +tnTipGest=0 +*!* +LOCAL lnTipGest, lcFiltruInitial,lcTipGest, lcFiltruPermis +lcFiltruTipGest = "" +lcFiltruPermis = "" +lnTipGest = tnTipGest +lcTipGest = "" +IF EMPTY(tcTipGest) + lcTipGest = [] +ELSE + lcTipGest = tcTipGest +ENDIF + +lcFiltruInitial = [a.an=]+ Alltrim(Str(gnAn))+[ and a.luna=]+ Alltrim(Str(gnLuna))+; + STRTRAN(gcCondSucursala,[id_sucursala],[a.id_sucursala]) +IF !EMPTY(lnTipGest) + lcFiltruTipGest = [ and a.nr_pag = ] + ALLTRIM(STR(lnTipGest)) +ENDIF + +IF EMPTY(gcGestPermis) + lcFiltruPermis = [ and 1=2] +else + lcFiltruPermis = [ and a.id_gestiune in (] + gcGestPermis + [)] +EndIf + +lcFiltruInitial = lcFiltruInitial + lcFiltruTipGest + lcFiltruPermis + +LOCAL lnStocObinv +lnStocObinv = 0 +DO INAINTE_DE_STOC WITH gnAn, gnLuna, lnTipGest, lnStocObinv in oinainte_de.prg + +PRIVATE postocuri,pcschema,pcselect,pcfiltru,pcorder +STORE '' TO postocuri + +pcschema=['nr_crt n(6),id_stoc n(20),an n(4),luna n(2),id_articol n(10),serie c(100),pret n(16,4),pretv n(16,4),'+]+; + ['tva n(16,4),tvav n(16,4),cants n(14,3),cant n(14,3),cante n(14,3),cont c(4),'+]+; + ['acont c(4),pretd n(16,4),dataora d,datain d,dataout d,proc_tvav n(5,2),'+]+; + ['id_gestiune n(5),codmat c(50),denumire c(100),um c(6),nr_pag n(2),nume_gestiune c(50),'+]+; + ['cgest c(20),um2 c(10),cant_bax n(9,4),grupa c(100),subgrupa c(100),id_valuta n(10), nume_val c(4),'+]+; + ['codmatf c(50), lot c(50), adata_expirare T,id_sucursala N(5),sucursala C(100),'+]+; + ['id_lucrare_rez N(10),nrord_rez C(50),id_part_rez N(10),part_rez C(100)'] +pcselect=['select row_number() over (order by a.denumire) as nr_crt,a.id_stoc,a.an,a.luna,a.id_articol,a.serie,'+]+; + ['a.pret,a.pretv,a.tva,a.tvav,a.cants,a.cant,a.cante,a.cont,a.acont,a.pretd,a.dataora,'+]+; + ['a.datain,a.dataout,a.proc_tvav,'+]+; + ['a.id_gestiune,a.codmat,a.denumire,a.um,a.nr_pag,a.nume_gestiune,a.cgest,a.um2,a.cant_bax,a.grupa,a.subgrupa, a.id_valuta, a.nume_val, a.codmatf, a.lot, a.adata_expirare,'+]+; + ['a.id_sucursala,a.sucursala,'+]+; + ['a.id_lucrare_rez,a.nrord_rez,a.id_part_rez,a.part_rez '+]+; + ['from vstoc a where 1=2'] +pcfiltru = [1=2] +pcorder=[1] +llAfiseaza=.F. +_SCREEN.MOUSEPOINTER= 11 +gencursor('postocuri','crsStocuri',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza) +postocuri.ca_baza1.afisare() + +LOCAL loStocuri +loStocuri=CREATEOBJECT('frm_stocuri') +_SCREEN.MOUSEPOINTER= 0 +loStocuri.ntipgest = lnTipGest +PRIVATE pcListTipGest +pcListTipGest = [] +lnOptgrValue = IIF(loStocuri.ntipgest<>0,IIF(loStocuri.ntipgest=6,2,IIF(loStocuri.ntipgest=7,4,1)),3) +WITH loStocuri + .Lb_titlu_alb_b121.CAPTION = [STOCURI] + IIF(!EMPTY(lcTipGest),[ / ] + lcTipGest,[]) + .cFiltruInitial = lcFiltruInitial + .optgrup.VALUE = lnOptgrValue + *!* modificare v 2.0.5 + .but_verifica1.visible = .F. + *!* modificare v 2.0.5 ^ + IF lnOptgrValue = 1 + .optgrup.option2.VISIBLE = .F. + .optgrup.option3.VISIBLE = .F. + .optgrup.option4.VISIBLE = .F. + ENDIF + IF lnOptgrValue = 2 + .optgrup.option1.VISIBLE = .F. + .optgrup.option3.VISIBLE = .F. + .optgrup.option4.VISIBLE = .F. + ENDIF + IF lnOptgrValue = 4 + .optgrup.option1.VISIBLE = .F. + .optgrup.option2.VISIBLE = .F. + .optgrup.option3.VISIBLE = .F. + ENDIF + .optgrup.ENABLED = IIF(.ntipgest<>0,.F.,.T.) + IF .But_modifica1.VISIBLE + .But_modifica1.VISIBLE = IIF(.ntipgest<>0,.T.,.F.) + ENDIF +ENDWITH +loStocuri.SHOW(1) +RELEASE postocuri + +ENDPROC && viz_stocuri +****************************************************************************** +PROCEDURE export_cursor_excel +PARAMETERS tcAlias,tcListaCampuri,tcAliasCampuri + +ENDPROC && export_cursor_excel +**********************sfarsit procedura export_cursor_excel******************* diff --git a/Programe/ovariabile_globale.prg b/Programe/ovariabile_globale.prg new file mode 100644 index 0000000..51a4412 --- /dev/null +++ b/Programe/ovariabile_globale.prg @@ -0,0 +1,79 @@ +PUBLIC gcCondLuna +*!* gcCondLuna = [((((extract(month from datafact) =]+Alltrim(Str(gnLuna))+; +*!* [ and extract(year from datafact) =]+Alltrim(Str(gnAn))+[) or (datafact is null )); +*!* and ]+; +*!* [ (extract (month from datai)<=]+Alltrim(Str(gnLuna)) + [ and extract(year from datai)<= ]+Alltrim(Str(gnAn))+[))]+; +*!* [ or ((extract (month from dataoravalid)>= ]+Alltrim(Str(gnLuna))+[ and extract(year from dataoravalid)>=]+Alltrim(Str(gnAn)) +[)]+; +*!* [ and id_tip > 1)]+ [)] + +*!* 30.06 +*!* lcDataFact= [ (a.facturat=1 and (extract(month from a.datafact) =]+Alltrim(Str(gnLuna))+[ and extract(year from a.datafact) =]+Alltrim(Str(gnAn))+[))] +*!* lcDataValid = [ (a.validat=1 and (extract (month from a.dataoravalid)>= ]+Alltrim(Str(gnLuna))+[ and extract(year from a.dataoravalid)>=]+Alltrim(Str(gnAn)) +[)) ] +*!* gcCondLuna = [ ((extract (month from a.datai)=]+Alltrim(Str(gnLuna)) + [ and extract(year from a.datai)= ]+Alltrim(Str(gnAn))+[) or ]+; +*!* [ (a.id_tip=1 and (a.facturat=0 or ] + lcDataFact + [) ) or (a.id_tip>1 and (a.validat=0 or ] + lcDataValid + [))) ] +lcDataFact= [ (a.facturat=1 and (extract(month from a.datafact) =]+Alltrim(Str(gnLuna))+[ and extract(year from a.datafact) =]+Alltrim(Str(gnAn))+[))] +lcDataValid = [ (a.validat=1 and (extract (month from a.dataoravalid)+extract(year from a.dataoravalid)*12=]+Alltrim(Str(gnLuna+gnAn*12)) +[)) ] +gcCondLuna = [ ((extract (month from a.datai)+extract(year from a.datai)*12=]+Alltrim(Str(gnLuna+gnAn*12))+[) or ]+; + [ ((extract (month from a.datai)+extract(year from a.datai)*12<]+Alltrim(Str(gnLuna+gnAn*12))+[) and ]+; + [ ((a.inch_validare=0 and (a.facturat=0 or ] + lcDataFact + [) ) or (a.inch_validare=1 and (a.validat=0 or ] + lcDataValid + [))))) ] +*!* If Nvl(gnDev_valregie,1) = 1 +*!* gcCondLuna = [ ((extract (month from a.datai)+extract(year from a.datai)*12=]+Alltrim(Str(gnLuna+gnAn*12))+[) or ]+; +*!* [ ((extract (month from a.datai)+extract(year from a.datai)*12<]+Alltrim(Str(gnLuna+gnAn*12))+[) and ]+; +*!* [ ((a.id_tip=1 and (a.facturat=0 or ] + lcDataFact + [) ) or (a.id_tip>1 and (a.validat=0 or ] + lcDataValid + [))))) ] +*!* Else +*!* gcCondLuna = [ ((extract (month from a.datai)+extract(year from a.datai)*12=]+Alltrim(Str(gnLuna+gnAn*12))+[) or ]+; +*!* [ ((extract (month from a.datai)+extract(year from a.datai)*12<]+Alltrim(Str(gnLuna+gnAn*12))+[) and ]+; +*!* [ ((a.id_tip in (1,3) and (a.facturat=0 or ] + lcDataFact + [) ) or (a.id_tip not in (1,3) and (a.validat=0 or ] + lcDataValid + [))))) ] +*!* Endif +****************************************************************************************************************** +PUBLIC gcGestPermis, gcGrupePermis,gnTipGest,gcGestPermis_Nume,gcGrupePermis_Nume +STORE '' TO gcGestPermis,gcGrupePermis,gcGestPermis_Nume,gcGrupePermis_Nume +STORE 0 TO gnTipGest + +lcSql = [select * from ] + gcs + [.VGEST_CORESP_UTIL_GRUPE where id_util =] + ALLTRIM(STR(gnIdUtil)) +lcCursor = [GRUPE_permis] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +goExecutor.oReset() +IF lnSucces > 0 + SELECT grupe_permis + SCAN + gcGrupePermis = gcGrupePermis + ',' + ALLTRIM(STR(id_grupe)) + gcGrupePermis_nume = gcGrupePermis_nume + ',' + ALLTRIM(nume_grupa) + ENDSCAN + gcGrupePermis = SUBSTR(gcGrupePermis,2) + gcGrupePermis_nume = SUBSTR(gcGrupePermis_nume,2) + USE IN grupe_permis +ENDIF + +IF '-1' $ gcGrupePermis + gcGestPermis = '-1' +ELSE + lcSql = [SELECT * FROM ] + gcs + [.VGEST_CORESP_GRUPE_GESTIUNI A JOIN ] + gcs + [.VGEST_CORESP_UTIL_GRUPE B ]+ ; + [ON A.ID_GRUPE = B.ID_GRUPE WHERE B.ID_UTIL = ] + ALLTRIM(STR(gnIdUtil)) + lcCursor = [gest_permis] + lnSucces = goExecutor.oExecute(lcSql,lcCursor) + goExecutor.oReset() + IF lnSucces > 0 + SELECT gest_permis + SCAN + gcGestPermis = gcGestPermis + ',' + ALLTRIM(STR(id_gestiune)) + gcGestPermis_nume = gcGestPermis_nume + ',' + ALLTRIM(nume_gestiune) + ENDSCAN + gcGestPermis = SUBSTR(gcGestPermis,2) + gcGestPermis_nume = SUBSTR(gcGestPermis_nume,2) + USE IN gest_permis + ENDIF +ENDIF +SET STEP ON +* initializare variabile publice gnInchidereValidare1/2/3/4/5/6/7 +=cctipuri_deviz() +SELECT crstipuri_deviz +SCAN + lcVariabila = 'gnInchidereValidare' + ALLTRIM(STR(id_tip)) + PUBLIC &lcVariabila && gnInchidereValidare1 = 0/1 + &lcVariabila = NVL(inch_validare, 0) +ENDSCAN + +USE IN (Select('crstipuri_deviz')) + + \ No newline at end of file diff --git a/Programe/proceduri.prg b/Programe/proceduri.prg new file mode 100644 index 0000000..08ddf6d --- /dev/null +++ b/Programe/proceduri.prg @@ -0,0 +1,301 @@ +************************************************************************************ +Procedure CAUT_ALF +Parameters NUMEBAZA,NUMECIMP,CAPTEXT,VARMEM +Local MC0,MC1,MC2 +Set Safety Off +MC0='SELE '+NUMEBAZA +MC1='VARMEM=M.'+NUMECIMP +MC2='SET order TO TAG '+NUMECIMP + +&MC0 +Go Top +If Eof() + Appe Blank +Endif +&MC2 +OCA=Createobject("CAUTALF") +OCA.Caption=CAPTEXT +OCA.GRID1.RecordSource=NUMEBAZA +OCA.GRID1.COLUMN1.ControlSource=NUMECIMP +OCA.Show(1) + +Scatter Memvar +&MC1 + +Return +************************************************************************************ +Procedure CAUT_ALFa +Parameters NUMEBAZA,NUMECIMP,CAPTEXT,VARMEM +Local MC0,MC1,MC2 +Set Safety Off +MC0='SELE '+NUMEBAZA +MC1='VARMEM=M.'+NUMECIMP +MC2='SET order TO TAG '+NUMECIMP + +&MC0 + +Go Top +If Eof() + Appe Blank +Endif + +&MC2 +OCA=Createobject("CAUTALFa") +OCA.Caption=CAPTEXT +OCA.GRID1.RecordSource=NUMEBAZA +OCA.GRID1.COLUMN1.ControlSource=NUMECIMP +OCA.cmdrenunt1.Visible=.T. +OCA.Show(1) + +Scatter Memvar +&MC1 + +Return +************************************************************************************ +Procedure CODARE +Sele COD +If Flock() + Goto Bottom +*SCATTER MEMVAR + m.COD=COD+1 + Append Blank +*m.COD=RECNO() + Gather Memvar +Endif +Unlock +Return +************************************************************************************ +Procedure mesaj +Parameters m1,m2 +ot=Create('text') +ot.label2.Caption=m1 +ot.label3.Caption=m2 +ot.Show(1) +Return +************************************************************************************ +Procedure mesajval +Parameters m1,m2 +ot=Create('textval') +ot.label2.Caption=m1 +ot.valoare=m2 +ot.Show(1) +Return +************************************************************************************ +*!* Procedure IESIRE +*!* *close tables +*!* *close database +*!* *set defa to &dirgen +*!* *erase actactan.* +*!* *erase ?temp.* +*!* Quit +*!* Return +*!* ************************************************************************************ +*!* Function e_ultima_luna +*!* Sele calendar +*!* Loca For m.NL=NL And m.an=an +*!* Skip +*!* If Eof() +*!* ultima_luna=.T. +*!* Return .T. +*!* Else +*!* ultima_luna=.F. +*!* Return .F. +*!* Endif +*!* ************************************************************************************ +*!* Procedure danu +*!* Parameters m1 +*!* od=Create('danu') +*!* od.label1.Caption=m1 +*!* od.Show(1) +*!* Return +*!* ************************************************************************************ +*!* Procedure danuquit +*!* Parameters m1 +*!* od=Create('danu') +*!* od.label1.Caption=m1 +*!* od.Show(1) +*!* If buton=2 +*!* Quit +*!* Endif +*!* Return +************************************************************************************ +Procedure nrord +Parameters ALI +Sele &ALI +A=Reccount() +If A=0 + Return +Endif +If A>65000 + Return 0 +Endif +Declare NROR(A) +K=0 +Scan + K=K+1 + NROR(K)=Recno() +Endscan +Return +************************************************************************************ +Function NRCRT +NR=Ascan(NROR,Recno()) +Return NR +************************************************************************************ +Procedure inchidprog + +Endproc +*!* Procedure inchidprog +*!* Local CC,M.NUMESTATIE,UU +*!* Return +*!* UU=utilizator + +*!* *IF !FILE('&loc\&nfscurt\tempo\OPTIUNI.DBF') +*!* *RETURN +*!* *ENDIF +*!* If !Used('OPTIUNI') +*!* Return +*!* Endif +*!* *SELE 0 +*!* *USE &loc\&nfscurt\tempo\OPTIUNI SHAR ALIAS OPTIUNI +*!* Sele OPTIUNI +*!* Loca For OPTIUNE='RETEA' +*!* If !Found() Or (Found() And !DA) +*!* Sele OPTIUNI +*!* Use +*!* Return +*!* Endif +*!* Sele OPTIUNI +*!* Use + +*!* If !File('C:\CONTAFIN\TEMP\RETEA.DBF') +*!* Return +*!* Endif +*!* Sele 0 +*!* Use C:\CONTAFIN\TEMP\RETEA Shar Alias RETEA +*!* m.NUMESTATIE=Allt(NUMESTATIE) +*!* CC=DIRGEN +*!* Use + +*!* If File('&DIRGEN\Dateretea\istoric.DBF') +*!* Sele 0 +*!* Use &DIRGEN\Dateretea\istoric Share Alias istoric +*!* Else +*!* Sele 0 +*!* Use &CC\START2000\Data\istoric Share Alias istoric +*!* Endif + +*!* Sele istoric +*!* Set Order To DATAORAINT +*!* Loca For Empty(dataoraies) And Allt(statie)=m.NUMESTATIE And Allt(utilizator)=Allt(UU) +*!* If Found() +*!* If Flock() +*!* Repl dataoraies With Datetime() +*!* Unlock +*!* Endif +*!* Endif +*!* Sele istoric +*!* Use + + +*!* If File('&DIRGEN\Dateretea\activ.DBF') +*!* Sele 0 +*!* Use &DIRGEN\Dateretea\Activ Share Alias Activ +*!* Else +*!* Sele 0 +*!* Use &CC\START2000\Data\Activ Share Alias Activ +*!* Endif + +*!* Sele Activ +*!* Loca For Allt(statie)=m.NUMESTATIE +*!* If !Found() +*!* Wait Wind 'Aceasta statie nu este inregistrata in server!' +*!* Else +*!* Sele Activ +*!* If Flock() +*!* Repl DEVIZE With .F. +*!* Endif +*!* Unlock +*!* Endif +*!* Sele Activ +*!* Use + + +*!* Return +************************************************************************************ +Procedure caut_alfa_cursor +Parameters NUMEBAZA,NUMECIMP,CAPTEXT,VARMEM +Local MC0,MC1,MC2, llVizibil +Set Safety Off +llVizibil = .T. + +MC0='SELE '+NUMEBAZA +MC1='VARMEM=M.'+NUMECIMP +*MC2='SET order TO TAG '+NUMECIMP +MC2 = [INDEX ON ] +NUMECIMP+ [ TAG nume OF &loc\&nfscurt\tempo\xindex.idx COMPACT ASCENDING ] + + +*!* &MC0 +*!* &MC2 +*!* GO TOP + +Local lcNumeCol2 +Store '' To lcNumeCol2 + +LcCol = Alltrim(NUMEBAZA) + '.cod_fiscal' +If Type(LcCol) # 'U' + lcNumeCol2 = 'cod_fiscal' +Endif + +LcCol = Alltrim(NUMEBAZA) + '.gest' +If Type(LcCol) # 'U' + lcNumeCol2 = 'gest' +Endif + +LcCol = Alltrim(NUMEBAZA) + '.id_sectie' +If Type(LcCol) # 'U' + lcNumeCol2 = 'id_sectie' +Endif + +If Empty(lcNumeCol2) + lcNumeCol2 = 'space(4)' + llVizibil = .F. +Endif + +LcCol = Alltrim(NUMEBAZA) + '.id' +If Type(LcCol) # 'U' + lcNumeCol3 = 'id' +Else + lcNumeCol3 = 'space(4)' +Endif + +Select Distinct &NUMECIMP, &lcNumeCol2, &lcNumeCol3 From (NUMEBAZA) Into Cursor tnomenclator Readwrite Order By &NUMECIMP + +OCA=Createobject("CAUTALFa") +OCA.Caption=CAPTEXT +OCA.GRID1.RecordSource='tnomenclator' +OCA.GRID1.COLUMN1.ControlSource = NUMECIMP +OCA.GRID1.COLUMN2.ControlSource = lcNumeCol2 +OCA.GRID1.COLUMN2.Visible = llVizibil +OCA.cmdrenunt1.Visible=.T. +OCA.command1.Visible=.F. +OCA.command2.Visible=.F. +OCA.command3.Visible=.F. +OCA.Show(1) + +If buton=2 + Use In tnomenclator + Return +Endif + +lcFile = Addbs(gcTempPath) + 'xindex.idx' +If File(lcFile) + Set Index To + Delete File &lcFile +Endif + +Select tnomenclator +Scatter Memvar +&MC1 + +Use In tnomenclator +Return \ No newline at end of file diff --git a/Programe/roaauto.prg b/Programe/roaauto.prg new file mode 100644 index 0000000..fdd79e6 --- /dev/null +++ b/Programe/roaauto.prg @@ -0,0 +1,993 @@ +Parameters tparam + +Private gcNumeProgram +Local lcStem +lcStem = Upper(Juststem(Sys(16,0))) +gcNumeProgram="ROAAUTO" +IF !LIKE(gcNumeProgram + '*', UPPER(ALLTRIM(JUSTSTEM(SYS(16,0))))) + Messagebox("Nu puteti porni acest program!",0+16,"Atentie") + RETURN +ENDIF + +Local lchost, lcUserName, lcPassword, lnIdUtil, lnIdProgram, lcUserNameApp,lcPasswordApp +Store '' To lchost, lcUserName, lcPassword, lcUserNameApp,lcPasswordApp +Store 0 To lnIdUtil, lnIdProgram +_Screen.Icon = gcNumeProgram+".ico" + +Set Century On +Set Deleted On +Set Date To Dmy +Set Exclusive Off +Set Cpdialog Off +Set Talk Off +Set Safety Off +Set Escape Off +Set Exact On +Set Mark To '/' +Set Ansi On +Set Console Off +Set Notify Off +Set Seconds Off +Set NullDisplay To '' +Set Hours To 24 +Set Decimals To 4 +_Screen.Visible=.F. +_Screen.AutoCenter=.T. + +**************************************************************** +* VARIABILE +Local lcMainClassLib +Local lcLastSetTalk,lcLastSetPath,lcLastSetClassLib,lcOnShutdown + +**************************************************************** +* VARIABILE +Public CRLF,CR,LF,Tab +Store Chr(13) + Chr(10) To CRLF +CR=Chr(13) +LF=Chr(10) +Tab=Chr(9) + +Public pcTitlu,pl_verificat +Store "" To pcTitlu +Store .F. To pl_verificat +*********************************************************************************** +** Variabile vechi +Declare nror[65000] +Public pcNl,pcAn +PUBLIC buton,primadata,dirgen,m.ctva,m.ctvam,m.ctvai,m.den +Store "" To pcNl,pcAn,m.den && se initializeaza in start00 +Store 1 To BUTON,col_menu +STORE .T. TO primadata +*********************************************************************************** +*** DECLARATII DE VARIABILE PUBLICE +*********************************************************************************** +*-- Save and configure environment.*********************** +lcLastSetTalk=Set("TALK") +Set Talk Off +lcLastSetPath=Set("PATH") + +Set Procedure To "d:\ROA\ROAAUTO\COMUN\UTILE\web\WWUTILS.PRG" Additive +Set Procedure To "d:\ROA\ROAAUTO\COMUN\UTILE\web\WWAPI.PRG" Additive + +PRIVATE gcAppPath,gcAppName,gcTempPath, gcCaleServerDate, gcUserNameApp, gcPasswordApp,gcDirMare && gcAppDataPath +Store '' To gcUserNameApp, gcPasswordApp, gcAcces && gnNivelUtilizator, gnGrupUtilizator +Public gcSchemaPath, gcAntet +Store '' To gcSchemaPath, gcAntet + +gcAppPath = Addbs(ShortPath(GetAppStartPath())) +If Right(gcAppPath ,9)="PROGRAME\" + gcAppPath = Substr(gcAppPath ,1,Len(gcAppPath )-9) +Endif +gcAppName=Allt(Uppe(Juststem(Sys(16,0)))) +gcUtilizatoriPath = gcAppPath + "UTILIZATORI\" + +Set Default To (gcAppPath) +lcPath = gcAppPath + 'Date;' + ; + gcAppPath + 'Include;' + ; + gcAppPath + 'FERESTRE;' + ; + gcAppPath + 'GRAFICE;' + ; + gcAppPath + 'CLASE;' + ; + gcAppPath + 'MENIURI;' + ; + gcAppPath + 'PROGRAME;' + ; + gcAppPath + 'RAPOARTE;' + ; + gcAppPath + 'COMUN\CLASE;' + ; + gcAppPath + 'COMUN\FERESTRE;' + ; + gcAppPath + 'COMUN\PROGRAME;' + ; + gcAppPath + 'COMUN\GRAFICE;' + ; + gcAppPath + 'COMUN\RAPOARTE;' + ; + gcAppPath + 'COMUN\UTILE\GRIDEXTRAS;' + ; + gcAppPath + 'COMUN\UTILE\EXCEL;' + ; + gcAppPath + 'COMUN\UTILE\CTL32;' + ; + gcAppPath + 'COMUN\UTILE\HPDF;' + ; + gcAppPath + 'COMUN\UTILE\HPDF\REPORTOUTPUT;' + ; + gcAppPath + 'COMUN\UTILE\WEB;' + ; + Addbs(Substr(gcAppPath,1,Rat([\],gcAppPath,2)))+[COMUNROA\] + +SET PATH TO &lcPath ADDITIVE + +*!* Set Path To ;Date;Include;FERESTRE;GRAFICE;Help;CLASE;MENIURI;PROGRAME;RAPOARTE; + +PUSH Menu _Msysmenu +lcLastSetClassLib=Set("CLASSLIB") +lcMainClassLib = m.gcAppPath + "COMUN\clase\appwiz.vcx" + +**************************************************************** +* CLASE +Set Classlib To (lcMainClassLib) Additive +Set Classlib To baza Additive +Set Classlib To CAUT Additive +*!* Set Classlib To FERESTREBAZA Additive +**************************************************************** +Set Classlib To registry Additive +Set Classlib To odevize Additive +Set Classlib To decabaza Additive +Set Classlib To onomenclatoare Additive +Set Classlib To onom_devize Additive +Set Classlib To oviz_devize Additive +Set Classlib To cauta_alfa_forms Additive +*!* Set Classlib To ointroduceri Additive +Set Classlib To ferestre_oracle Additive +Set Classlib To caut_ora Additive +Set Classlib To Messagebox Additive +SET CLASSLIB TO otoolbar ADDITIVE +SET CLASSLIB TO serii_numere ADDITIVE +SET CLASSLIB TO stocuri additive +SET CLASSLIB TO ctl32_statusbar_fals.vcx additive +SET CLASSLIB TO ocriterii.vcx additive +*!* modificare v 2.0.6 +SET CLASSLIB TO wwdialogs.vcx additive +*!* modificare v 2.0.6 ^ +SET CLASSLIB TO comun.vcx additive +SET CLASSLIB TO gridextras.vcx additive +SET CLASSLIB TO ferestre_cere_date.vcx ADDITIVE && modificare v 2.0.28 +SET CLASSLIB TO onom_articole.vcx ADDITIVE && modificare v 2.0.41 +SET CLASSLIB TO overificari.vcx ADDITIVE && modificare v 2.1.2 +SET CLASSLIB TO accessibility.vcx additive +**************************************************************** +* PROCEDURI +Set Procedure To ooperatii_comune Additive +Set Procedure To quitapp Additive +Set Procedure To init_program Additive +Set Procedure To proceduri_comune Additive +*!* modificare v 2.0.1 +*!* Set Procedure To oproceduri_casa_marcat_e500 Additive +Set Procedure To controllerecr Additive +*!* modificare v 2.0.1 ^ +Set Procedure To oproceduri_comune Additive +Set Procedure To gencursor.prg Additive +Set Procedure To updateserver.prg Additive +Set Procedure To update_devize.prg Additive +Set Procedure To update_nomenclator.prg Additive +Set Procedure To onom_devize.prg Additive +Set Procedure To onomenclatoare Additive +Set Procedure To proceduri Additive +Set Procedure To oproceduri_ams Additive +Set Procedure To oproceduri_vizualizare Additive +Set Procedure To ocautare Additive +Set Procedure To oproceduri_devize Additive +Set Procedure To oproceduri_listari Additive +Set Procedure To oproceduri_facturare ADDITIVE +SET PROCEDURE TO email ADDITIVE +Set Procedure To oinit_optiuni Additive +Set Procedure To osecurity Additive +Set Procedure To pmenu Additive +Set Procedure To acces_meniu Additive +Set Procedure To wwxmlhttp.prg Additive +Set Procedure To ini.prg Additive +Set Procedure To oserii_numere.prg Additive +Set Procedure To oheader.prg Additive +Set Procedure To cauta_alfa.prg Additive +Set Procedure To suma_in_vorbe Additive +Set Procedure To wwutils.prg Additive +SET PROCEDURE TO oserii_numere.prg additive +SET PROCEDURE TO oexport.prg additive +SET PROCEDURE TO wwconfig.prg additive +*!* modificare v 2.0.6 +SET PROCEDURE TO iniacces.prg ADDITIVE +SET PROCEDURE TO oupdate.prg additive +SET PROCEDURE TO procese.prg additive +SET PROCEDURE TO version.prg additive +SET PROCEDURE TO xmlaccess.prg additive +SET PROCEDURE TO xmlparser.prg additive +SET PROCEDURE TO filebringer.prg additive +SET PROCEDURE TO wwcodeupdate.prg additive +SET PROCEDURE TO wwhttp.prg ADDITIVE +Set Procedure To wwApi.prg Additive +SET PROCEDURE TO xdate.prg Additive +SET PROCEDURE TO validare.prg Additive +SET PROCEDURE TO regex.prg Additive + +SET PROCEDURE TO excelxml.prg ADDITIVE + +Declare Integer GetPrivateProfileString In Kernel32 ; + string, String, String, String @, Integer, String +Declare Integer WritePrivateProfileString In Kernel32 ; + string, String, String, String +Declare Integer CopyFile In kernel32; + STRING lpExistingFileName,; + STRING lpNewFileName,; + INTEGER bFailIfExists +Declare Integer URLDownloadToFile In urlmon.Dll; + INTEGER pCaller, String szURL, String szFileName,; + INTEGER dwReserved, Integer lpfnCB +Declare Integer PathFileExists In shlwapi; + STRING pszPath +*!* modificare v 2.0.6 ^ +*!* modificare v 2.0.8 +Set Procedure To ofacturare.prg Additive +Set Procedure To ofacturare_comun.prg Additive +*!* modificare v 2.0.8 ^ +*********************************************************************************** +If Pcount() = 1 And Type('tparam') = 'C' + glParametri = .T. + Private laParametri + Declare laParametri[1] + lcParam = Alltrim(tparam) + lnNr = lista2array(lcParam,@laParametri,";") + If lnNr < 5 + AMessagebox('Numar incorect de parametri',0+16,'Eroare') + Return + Endif + lchost = laParametri[1] + lcUserName = laParametri[2] + lcPassword = laParametri[3] + lnIdUtil = Round(Val(laParametri[4]),0) + lnIdProgram = Round(Val(laParametri[5]),0) +Else + glParametri = .F. + lchost = 'JCSSERVER' + lcUserName = 'CONTAFIN_ORACLE' + lcPassword = '' + lnIdUtil = 0 + lnIdProgram = 0 +Endif + +*!* Public glVerificTabel && daca se verifica structura tabelelor in totv.prg +*!* glVerificTabel=.T. + + + +Store "" To gcTempPath, gcCaleServerDate + +*!* modificare v 2.0.6 +*!* If !Directory(gcAppDataPath) +*!* Md (gcAppDataPath) +*!* Endif +*!* modificare v 2.0.6 ^ +*********************************************************************************** +*** DIRGEN + +liat = Rat("\",gcAppPath,2) +gcDirMare = Addbs(Left(gcAppPath,liat-1)) +dirgen = gcDirMare + +*!* modificare v 2.1.9 +PRIVATE gcReportPreviewer, gcReportPreviewerPath +gcReportPreviewer = "FoxyPreview" && oexport.prg +gcReportPreviewerPath = gcDirMare + "COMUNROA\" +*!* modificare v 2.1.9 ^ + +gcSecurityPath = gcDirMare + 'Security\' +gcSecurityFile = gcSecurityPath + 'ROA_SECURITY.TXT' + +Private poLog,goLog && obiect pt logarea mesajelor sistemului +poLog = Newobject("Log_Mesaje","Log_Mesaje.prg") +goLog = poLog + +*!* modificare 21.06 +PRIVATE gcGeneralIniFile,gcSettingsFile +gcGeneralIniFile = m.gcDirMare + "settings.ini" +gcSettingsFile = m.gcGeneralIniFile +IF !FILE(gcGeneralIniFile) + TEXT TO lcSettings NOSHOW + [errors] + host=http://83.103.197.79:3000/errors/create_xml + ENDTEXT + STRTOFILE(lcSettings, gcGeneralIniFile) +ENDIF +*!* ^ + +Public glQuit +glQuit = .F. +Public gnIdIstoric +gnIdIstoric = 0 + +*!* modificare v 2.1.9 +Private gcLocalePath, goLocale, gcLocale +gcLocalePath = gcAppPath + "Locale\" +lcLanguage = getini(gcGeneralIniFile,"locale","lang") +llLocale= getini(gcGeneralIniFile,"locale","llocale") +If Empty(m.lcLanguage) + gcLocale = 'Romana' +Else + gcLocale = m.lcLanguage +Endif +Local lcObjLocale +If gcLocale = 'Romana' + lcObjLocale = [Locale_dummy] +Else + lcObjLocale = [Locale] +Endif +goLocale=Newobject(lcObjLocale,"Locale.vcx") +If !Empty(m.llLocale) And m.llLocale<>'0' + goLocale.llocale=.T. +Endif +Release lcObjLocale +goLocale.locale = gcLocale +*!* If verificari() +*!* _Screen.Visible=.T. +*!* aMessagebox("Se fac verificari programului!"+CRLF+"Va rugam reveniti!",64,"ROA FACTURARE") +*!* glQuit= .T. +*!* Quit +*!* Endif +*!* If !Debug_Start() +*!* lcParam=tparam +*!* If Empty(tparam) Or (Type('tParam')='C' And !verific_start(tparam,gcDirMare,gcAppName)) +*!* _Screen.Visible=.T. +*!* aMessagebox("Programul trebuie pornit doar din START!",64,"ROA FACTURARE") +*!* Quit +*!* Endif +*!* Endif +*!* modificare v 2.1.9 ^ + +*** verificare serie permanenta +*!* Public tipar,SER_PERM,SER_PERI,VERSIUNE +*!* Store .F. To SER_PERM,SER_PERI + +***************************** VARIABILE ORACLE +*!* PRIVATE goUtilizator +Private gnHandle,gnidutil,GCCODFISCAL,GCADRESA,GCNUMEFIRMA,GCMONEDA,GNDIFZILE, gcUserNameApp, gcPasswordApp +Private gnButon && variabila pentru renunt si terminat +Store 2 To gnButon +Store '' To GCCODFISCAL,GCADRESA,GCNUMEFIRMA, gcUserNameApp, gcPasswordApp, gcAcces +gnHandle = -1 +gnidutil = 0 +Private gcHost, gcUserName, gcPassword, gofundal, gnIdProgram, gnId_prg_owner +gnId_prg_owner = 0 +gnIdProgram = 0 +gofundal='' + +PRIVATE gcCopyRight +gcCopyRight = '© ROA Romfast SRL' + +Private goFirma,gnIdFirma,gcFirma,gnAn,gnLuna && ,gnPA,gnPC,gnId_Firma +&& STORE 0 TO gnPA,gnPC && nr. de zecimale afisare, calcul +Store Null To goFirma +Store 0 To gnAn,gnLuna,gnIdFirma && ,gnId_Firma +Store '' To gcFirma + +Private glUltimaLuna,glPrimaLuna, glLunaBuna,glLuna_neplatita,glLunaInchisa +Store .F. To glUltimaLuna,glPrimaLuna, glLunaBuna,glLuna_neplatita,glLunaInchisa + +***toolbar*** +PRIVATE otool,ohelp +STORE '' TO otool,ohelp +***toolbar*** + +Private gcS && schema firmei +Store '' To gcS + +*!* modificare v 2.0.28 +PUBLIC glFontCharSet +glFontCharSet = AFONT(laFontCharSet,"Arial Narrow",238) +*!* modificare v 2.0.28 ^ + +IF TYPE('laparametri',1)="A" + IF ALEN(laParametri,1)=10 + gnAn = VAL(laParametri[7]) + gnLuna = VAL(laParametri[8]) &&lansare noua + GcS = laParametri[9] + gnIdFirma = VAL(laParametri[10]) && modificare v 2.0.29 + ENDIF +ENDIF + +&& obiect global wrap pt sqlexec cu text eroare si succes +Private goExecutor +goExecutor = Createobject("oExecutor") + +Private goConn +goConn = Createobject("oConn") +*!* modificare v 2.0.2 +Private goExport +goExport = CREATEOBJECT("oExportConfig") +*!* modificare v 2.0.2 ^ + +*!* modificare 21.06 +PRIVATE goMyXMLHTTP +lcHostErrors = getini(gcGeneralIniFile,'errors','host') +goMyXMLHTTP = CREATEOBJECT("MyXMLHTTP", lcHostErrors) +*!* ^ + +&& obiect global pt luna aleasa din calendar +Private goCalendar +Store Null To goCalendar + +gcHost = lchost +gcUserName = lcUserName +gcPassword = lcPassword +gcUserNameApp = lcUserNameApp +gcPasswordApp = lcPasswordApp +gnidutil = lnIdUtil +gnIdProgram = lnIdProgram + +*!* modificare v 2.0.1 +PRIVATE goControllerEcr +goControllerEcr = CreateObject('oControllerEcr') +*!* modificare v 2.0.1 ^ + +If !glParametri + lnValid = getcrsSecurity(gcSecurityFile) + If lnValid > 0 + If Used('crsHost') + Select crsHost + Go Top + gcHost = Alltrim(Host) + gcUserName = Alltrim(schema) + gcPassword = Alltrim(pwd) + Use In crsHost + Endif + Endif +Endif + +***************************** VARIABILE ORACLE +*!* Use &gcAppPath\SER In 0 Alias SER Shared +*!* Select SER +*!* Go Top +*!* tipar=TIP +*!* SER_PERM=SER_PERMAN +*!* SER_PERI=SER_PERIOD +*!* VERSIUNE=VERcont +*!* MODEL_PROGRAM=MODEL +*!* Use In SER +*!* parolamea=Substr(tipar,Month(Date()),1) +*!* parolamea=parolamea+Allt(Str(Day(Date())))+Allt(Str(Month(Date()))) + +*!* If !_DEBUG() +*!* If SER_PERM And !verif_ser_perm() +*!* Quit +*!* Endif +*!* Endif + +*!* Public cales,eserver,loc,numestatie +*!* eserver=.F. +*!* Store '' To cales,loc,numestatie + +Public NUMEPROGRAM,MENIUPROGRAM,FUNDALPROGRAM +NUMEPROGRAM='ROAAUTO' +*!* MENIUPROGRAM=gcAppPath+"meniuri\cont2000.mpr" +*!* FUNDALPROGRAM=gcAppPath+"FERESTRE\FUNDAL.scx" +_program='roaauto' + +*!* *** INITIALIZEZ CAI DATE +*!* If .F. +*!* If !Start_Nou() +*!* _Screen.WindowState=2 +*!* Cd \ +*!* If !Directory('c:\contafin') +*!* Md contafin +*!* Endif +*!* Cd c:\contafin\ +*!* If !Directory('temp') +*!* Md temp +*!* Endif + + +*!* Sele 0 +*!* Use c:\contafin\temp\ceprogram Alias ceprogram +*!* Scat Memv +*!* *wait wind m.util +*!* Sele ceprogram +*!* Use +*!* utilizator=m.UTIL +*!* GRUPUL=M.nrgrup +*!* If M.nrgrup=0 +*!* E_UN_SUPERVIZOR=.T. +*!* Else +*!* E_UN_SUPERVIZOR=.F. +*!* Endif + +*!* If File('&DIRGEN\START2000\DATA\RETEA.DBF') +*!* If !File('c:\contafin\temp\RETEA.dbf') +*!* Copy File &DIRGEN\START2000\Data\RETEA.* To c:\contafin\temp\RETEA.* +*!* Endif +*!* Sele 0 +*!* Use c:\contafin\temp\RETEA +*!* eserver=Server +*!* cales=Allt(CALESERVER) +*!* Use In RETEA +*!* Endif +*!* Else + +*!* gcTempPath = Init_Cale_Temp(DIRGEN) +*!* If !Directory(gcTempPath) +*!* Md (gcTempPath) +*!* Endif + +*!* cales = Init_Cale_Server_Date(DIRGEN) +*!* eserver = .T. +*!* numestatie = Init_Nume_Statie(DIRGEN) +*!* utilizator = Init_Nume_Utilizator(DIRGEN) +*!* m.nivel = Round(Val(Init_Nivel_Utilizator(DIRGEN)),0) +*!* m.CONTAB = Upper(Alltrim(Init_NumeAlternativ(DIRGEN))) + +*!* lcQuitData = Alltrim(DIRGEN)+"\dateretea" +*!* lcQuitName = "start_quitapp" +*!* Private goQuitApp && I'm making it private so it will die with the application. +*!* goQuitApp = quitapp(lcQuitData,lcQuitName) + +*!* gnIdIstoric = Start_Istoric(m.utilizator, gcAppName, numestatie, Addbs(DIRGEN)+"DATERETEA\", "START_ISTORIC","start_ids") + + +*!* Endif +*!* Endif + +lcOnShutdown="ShutDown()" +On Shutdown &lcOnShutdown +On Error ErrorHandler(Error(),Program(),Lineno()) +_Shell="DO Cleanup IN roaauto.prg" + +*-- Instantiate application object.*************************** +Release goApp +Public goApp +goApp=Createobject("wzApplication") + +*-- Configure application object.***************************** +*!* goApp.SetCaption("DEVIZE") +Local laVersion +Dimension laVersion(12) +If Agetfileversion(laVersion, Sys(16,0)) > 0 + NUMEPROGRAM = laVersion(10) +Endif +Release laVersion + +goApp.SetCaption(NUMEPROGRAM) +goApp.cStartupMenu = m.gcAppPath + "\meniuri\roaauto" +goApp.cStartupForm = m.gcAppPath + 'COMUN\ferestre\frm_login.scx' + +_Screen.WindowState=2 +*-- Show application. +goApp.Show +*-- Release application. +Release goApp + +*-- Restore default menu. +Pop Menu _Msysmenu + +*-- Restore environment. +On Error +On Shutdown +If Not lcLastSetClassLib==Set("classlib") + Release Classlib (lcMainClassLib) +Endif +If Empty(lcLastSetPath) + Set Path To +Else + Set Path To &lcLastSetPath +Endif +If lcLastSetTalk=="ON" + Set Talk On +Else + Set Talk Off +Endif +Return +************************************************************************************ +* FUNCTII______________________________________________________________________ +Function ErrorHandler(nError,cMethod,nLine) +Local lcErrorMsg,lcCodeLineMsg + +Wait Clear +lcErrorMsg=Message()+Chr(13)+Chr(13) +lcErrorMsg=lcErrorMsg+"Method: "+cMethod +lcCodeLineMsg=Message(1) +If Between(nLine,1,10000) And Not lcCodeLineMsg="..." + lcErrorMsg=lcErrorMsg+Chr(13)+"Line: "+Alltrim(Str(nLine)) + If Not Empty(lcCodeLineMsg) + lcErrorMsg=lcErrorMsg+Chr(13)+Chr(13)+lcCodeLineMsg + Endif +ENDIF + +*!* modificare 21.06 +If Type('goMyXMLHTTP') = 'O' + lcErrorMsg = Sys(0) + ":" + Iif(Type('GCS')='C'," " + GCS,"") + Chr(13) +Chr(10) + lcErrorMsg + lcUserName = gcUserNameApp + lcProgram = Juststem(Sys(16,0)) + goMyXMLHTTP.postError(lcErrorMsg, lcUserName, lcProgram) +Endif +*!* ^ + +If AMessagebox(lcErrorMsg,17,_Screen.Caption)#1 + On Error + Return .F. +Endif +Endfunc +************************************************************************************ +Function Shutdown +*!* =End_Istoric(gnIdIstoric, Addbs(DIRGEN)+"DATERETEA\", "START_ISTORIC") +If Type("goApp")=="O" And Not Isnull(goApp) + Return goApp.OnShutDown() +Endif +Cleanup() +Quit +Endfunc +************************************************************************************ +Function Cleanup +If Cntbar("_msysmenu")=7 + Return +Endif +On Error +On Shutdown +Set Classlib To +Set Path To +Clear All +Close All +Pop Menu _Msysmenu +Return +************************************************************************************ +*!* Function verif_ser_perm +*!* Clear +*!* Return PORNIRE() +************************************************************************************ +Function PORNIRE +Set Exact On +Private calewin,calesys,checksum1,checksum2,serinreg,serdisk,file1,file2,valret,serdisktemp,ser1,ser2,key1,KEY2 +Store '' To calewin,serinreg,serdisk,calesys,serdisktemp,catehd,ser1,ser2,key1,KEY2 +Store 0 To checksum1,checksum2 +Store .T. To valret +Declare Integer SHGetFolderPath In SHFOLDER.Dll ; + INTEGER hwndOwner, ; + INTEGER nFolder, ; + INTEGER hToken, ; + INTEGER dwFlags, ; + STRING @ pszPath +Declare Integer GetActiveWindow In WIN32API +#Define CSIDL_WINDOWS 36 +#Define CSIDL_SYSTEM 37 +#Define CSIDL_PROGRAMS 38 +lcPath = Repl(Chr(0),261) +=SHGetFolderPath(GetActiveWindow(),CSIDL_WINDOWS,0,0,@lcPath) +calewin=Left(lcPath,At(Chr(0),lcPath)-1) +lcPath = Repl(Chr(0),261) +=SHGetFolderPath(GetActiveWindow(),CSIDL_SYSTEM,0,0,@lcPath) +calesys=Left(lcPath,At(Chr(0),lcPath)-1) +&&se verifica existenta celor trei fisiere +If (Not File(calesys+'\diskserial.dll')) Or (Not File(calesys+'\getmacip.dll')) Or (Not File(calewin+'\comdir.snr')) + valret=.F. +Endif +If valret + file1=Filetostr(calesys+'\diskserial.dll') + checksum1=Sys(2007,file1) + file2=Filetostr(calesys+'\getmacip.dll') + checksum2=Sys(2007,file2) +&&severifica daca dll-urile nu au fost modificate + If (Val(checksum1) != 58755) Or (Val(checksum2) != 30476) + valret=.F. + Endif +Endif +&&se citesc seriile tutturor celor patru hard disk-uri posibile(pe IDE primary master,primary slave...) +&&se tine minte primul cu seria nenula-daca nu s-a putut citi seria de la nici unul se pune o serie default +&&seria default este "NUAREHAR" +If valret + Declare Integer GetSerialNumber In diskSerial.Dll Integer ,String + catehd=0 + For i=0 To 3 + serdisktemp=Space(40) + GetSerialNumber(i,@serdisktemp) + If (Len(Alltrim(serdisktemp))!=0) And (catehd=0) + serdisktemp=sircaracter(serdisktemp) + serdisk=serdisktemp + catehd=catehd+1 + Endif + Endfor + If (Len(Alltrim(serdisk))=0) + serdisk='NUAREHAR' + Else + If ((Len(Alltrim(serdisk))>0) And (Len(Alltrim(serdisk))<8)) + serdisk=serdisk+Replicate('1',8-Len(Alltrim(serdisk))) + Endif + Endif + serdisk=Substr(Alltrim(serdisk),Len(Alltrim(serdisk))-7,8) +Endif +&&se citeste din comdir.snr seria de inregistrare si se verifica egalitatea cu seria obtinuta anterior +If valret + gnFileHandle = Fopen(calewin+'\comdir.snr') + nSize = Fseek(gnFileHandle, 0, 2) && Move pointer to EOF + If nSize!=9 + valret=.F. + Else + = Fseek(gnFileHandle, 0, 0) && Move pointer to BOF + cString = Fread(gnFileHandle,9) + ser1=Substr(cString,1,4) + ser2=Substr(cString,5,4) + key1=Substr(cString,9,1) + KEY2=DECTOBIN(Alltrim(HEXDEC(key1))) + serinreg=decodare1(Alltrim(Upper(ser1)),KEY2)+decodare1(Alltrim(Upper(ser2)),KEY2) + If serdisk!=serinreg + valret=.F. + Endif + Endif + = Fclose(gnFileHandle) +Endif +seriedisk1=serdisk +serieinreg1=serinreg +On Error valret=.F. +Return valret +************************************************************************************ +Function decodare1 +Parameters lstring,CHEIE +Local lens,poz1,poz2,POZ3,lret,LRET2,lcstring,val1,lret1 +lret='' +lret1='' +LRET2='' +lcstring=Alltrim(Upper(lstring)) +lens=Len(lcstring) +For i=1 To 4 + poz1=Substr(lcstring,i,1) + val1=Asc(poz1) + POZ3=Substr(CHEIE,i,1) + Do Case + Case val1>=48 And val1<=57 + If ((val1-47)+Int(Val(POZ3)))<=10 + poz2=Chr(val1+Int(Val(POZ3))) + Else + poz2=Chr(val1+Int(Val(POZ3))-10) + Endif + Case val1>=65 And val1<=90 + If ((val1-64)+2*Int(Val(POZ3)))<=26 + poz2=Chr(val1+2*Int(Val(POZ3))) + Else + poz2=Chr(val1+2*Int(Val(POZ3))-26) + Endif + Endcase + LRET2=LRET2+poz2 +Endfor +For i=1 To lens + poz1=Substr(LRET2,i,1) + val1=Asc(poz1) + Do Case + Case val1>=48 And val1<=57 + If ((val1-47)+i)<=10 + poz2=Chr(val1+i) + Else + poz2=Chr(val1+i-10) + Endif + Case val1>=65 And val1<=90 + If ((val1-64)+2*i)<=26 + poz2=Chr(val1+2*i) + Else + poz2=Chr(val1+2*i-26) + Endif + Endcase + lret=lret+poz2 +Endfor +lens=Len(lret) +For i=1 To lens + poz1=Substr(lret,i,1) + val1=Asc(poz1) + Do Case + Case val1>=48 And val1<=57 + poz2=Chr(val1+17)&& din 0-9 in A-J + Case val1>=65 And val1<=74 + poz2=Chr(val1-17)&& din A-J in 0-9 + Case val1>=75 And val1<=82 + poz2=Chr(val1+8)&&din K-R in S-Z + Case val1>=83 And val1<=90 + poz2=Chr(val1-8)&&din S-Z in K-R + Endcase + lret1=lret1+poz2 +Endfor +Return lret1 +************************************************************************************ +&&transformarea in decimal a unui caracter hexa +Function HEXDEC +Lparameters LC +Local LV +Do Case +Case LC=='0' + LV='0' +Case LC=='1' + LV='1' +Case LC=='2' + LV='2' +Case LC=='3' + LV='3' +Case LC=='4' + LV='4' +Case LC=='5' + LV='5' +Case LC=='6' + LV='6' +Case LC=='7' + LV='7' +Case LC=='8' + LV='8' +Case LC=='9' + LV='9' +Case LC=='A' + LV='10' +Case LC=='B' + LV='11' +Case LC=='C' + LV='12' +Case LC=='D' + LV='13' +Case LC=='E' + LV='14' +Case LC=='F' + LV='15' +Endcase +Return LV +************************************************************************************ +&&codarea binara din hexa pe patru biti +Function DECTOBIN +Parameters sc +Local lretf +Do Case +Case sc=='0' + lretf='0000' +Case sc=='1' + lretf='0001' +Case sc=='2' + lretf='0010' +Case sc=='3' + lretf='0011' +Case sc=='4' + lretf='0100' +Case sc=='5' + lretf='0101' +Case sc=='6' + lretf='0110' +Case sc=='7' + lretf='0111' +Case sc=='8' + lretf='1000' +Case sc=='9' + lretf='1001' +Case sc=='10' + lretf='1010' +Case sc=='11' + lretf='1011' +Case sc=='12' + lretf='1100' +Case sc=='13' + lretf='1101' +Case sc=='14' + lretf='1110' +Case sc=='15' + lretf='1111' +Endcase +Return lretf +************************************************************************************ +Function ECARACTER +Parameters strg1 +Private pz,ch,lcstring,vret,lg1 +Store 0 To pz,lg1 +Store '' To ch,lcstring +Store .T. To vret +lcstring=Upper(strg1) +lg1=Len(lcstring) +For ind1=1 To lg1 + ch=Substr(lcstring,ind1,1) + If (Not Between(Asc(ch),48,57)) And (Not Between(Asc(ch),65,90)) + vret=.F. + Exit + Endif +Endfor +Return vret +************************************************************************************ +Function sircaracter +Parameters strg1 +Private pz,ch,lcstring,vret,lg1,lciesire +Store 0 To pz,lg1 +Store '' To ch,lcstring,lciesire +Store .T. To vret +strg1=Strtran(strg1,Alltrim(Chr(39)),'')&&caracterul ' +strg1=Strtran(strg1,Alltrim(Chr(39)),'')&&caracterul " +lcstring=Upper(Alltrim(strg1)) +lg1=Len(lcstring) +For ind1=1 To lg1 + ch=Substr(lcstring,ind1,1) + If Between(Asc(ch),48,57) Or Between(Asc(ch),65,90) + lciesire=lciesire+ch + Endif +Endfor +Return lciesire +************************************************************************************ +Procedure _DEBUG +Private lcret,lcfisier,lcPath,lccalewin +Declare Integer SHGetFolderPath In SHFOLDER.Dll ; + INTEGER hwndOwner, ; + INTEGER nFolder, ; + INTEGER hToken, ; + INTEGER dwFlags, ; + STRING @ pszPath +Declare Integer GetActiveWindow In WIN32API +#Define CSIDL_WINDOWS 36 + + +lcPath = Repl(Chr(0),261) +=SHGetFolderPath(GetActiveWindow(),CSIDL_WINDOWS,0,0,@lcPath) +lccalewin=Left(lcPath,At(Chr(0),lcPath)-1) + +lcret=.F. +lcfisier=Addbs(lccalewin)+[DEBUG.TXT] + +lcLog = '1 ' + lcfisier +poLog.Log(lcLog,Program()) + +If File(lcfisier) + LCVAL=Filetostr(lcfisier) + + LNVAL1=Mod(Val(Right(LCVAL,1)),2) && restul 1 sau 0; daca e impar e 1 + lnval2=Val(Left(LCVAL,Len(LCVAL)-1)) + + lcLog = Transform(LNVAL1) + ' ' + Transform(lnval2) + poLog.Log(lcLog,Program()) + + If LNVAL1=1 Or Year(Date())-Month(Date())=lnval2 + lcret=.T. + Endif +Endif + +lcLog = Transform(lcret) +poLog.Log(lcLog,Program()) + +Return lcret +Endproc +************************************************************************************ +Function Start_Nou +*!* llExista_Branch = Exista_Branch(,,dirgen) + +*!* lcLog = TRANSFORM(llExista_Branch) +*!* poLog.log(lcLog,PROGRAM()) +Return Exista_Branch(,,DIRGEN) +Return llExista_Branch + +Endfunc && start_nou +************************************************************************************ +Procedure Debug_Start +lcFile = gcAppPath + "debug.txt" +If File(lcFile) + lcLog = 'debug_start' + poLog.Log(lcLog,Program()) +Else + lcLog = '!debug_start' + poLog.Log(lcLog,Program()) +Endif + +If File(lcFile) Or !Start_Nou() + Return .T. +Endif +Return .F. + +Endproc && Debug_Start +************************************************************************************ +Procedure verificari +Parameters tcFisierVerif +lcverificari = Addbs(gcAppPath)+gcAppName+".txt" +If File(lcverificari) + Return .T. +Endif +Return .F. + +Endproc && verificari*************** +************************************************************************************ +Procedure myinstance +Parameters myApp +=Ddesetoption("SAFETY",.F.) +ichannel = Ddeinitiate(myApp,"ZOOM") +If ichannel =>0 + =Ddeterminate(ichannel) + Quit +Endif +=Ddesetservice(myApp,"define") +=Ddesetservice(myApp,"execute") +=Ddesettopic(myApp,"","ddezoom") +Return +************************************************************************************ +Procedure ddezoom +Parameter ichannel,saction,sitem,sdata,sformat,istatus +Zoom Window Screen Norm +Return +************************************************************************************ +** EOF +************************************************************************************ diff --git a/Programe/update_devize.prg b/Programe/update_devize.prg new file mode 100644 index 0000000..a62fef6 --- /dev/null +++ b/Programe/update_devize.prg @@ -0,0 +1,504 @@ +******************************************* +* PROCEDURE update_mecanici( ) +* Data/ora : 12/16/04, 13:01:32 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure update_mecanici( ) +If Used('v_mecanici') + Use In v_mecanici +Endif + +lcSql = [select * from ] + gcS + [.auto_vmecanici order by nume] +lcCursor = [v_mecanici] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +goExecutor.oReset() + +Return lnSucces + +Endproc + +**********************sfarsit procedura update_mecanici******************* + +******************************************* +* PROCEDURE caut_personal_devize( ) +******************************************* +Procedure caut_personal_devize( ) +Local loCauta,llReturn +Store "" To loCauta +Store .F. To llReturn +pcselect = ["select id_salariat,id_part,nume,prenume,marca from ] + gcS + [.auto_vnom_salariati where inactiv = 0"] +pcfiltru = [1=2] +pcschema = [''] +pcorder = [2] +pccoloane = [nume,prenume,marca] +pcTitlu = [Alegeþi mecanicul] +pcTitluColoane = [Nume,Prenume,Marca] +loCauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,"") +Return loCauta +Endproc + +**********************sfarsit procedura caut_personal_devize ******************* + +******************************************* +* PROCEDURE caut_norme( ) +******************************************* +Procedure caut_norme( ) +Local loCauta,llReturn +Store "" To loCauta +Store .F. To llReturn +pcselect = ["select id_norme,denop from ] + gcS + [.auto_vnorme where inactiv = 0"] +pcfiltru = [1=2] +pcschema = [''] +pcorder = [2] +pccoloane = [denop] +pcTitlu = [Alegeþi operaþia] +pcTitluColoane = [Denumire] +loCauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,"") +Return loCauta +Endproc + +**********************sfarsit procedura caut_norme ******************* +******************************************* +* PROCEDURE update_sectie( ) +* Data/ora : 12/16/04, 14:26:22 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure update_sectie( ) +If Used('v_sectie') + Use In v_sectie +Endif + +lcSql = [select * from ] + gcS + [.vnom_sectii order by sectie]&& where inactiv = 0] +lcCursor = [v_sectie] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +goExecutor.oReset() + +Return lnSucces + +Endproc + +**********************sfarsit procedura update_sectie******************* + +******************************************* +* PROCEDURE update_clienti( ) +* Data/ora : 12/20/04, 09:58:55 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure update_clienti( ) +LPARAMETERS tnid_partener +LOCAL lcFiltru +IF !EMPTY(tnid_partener) + lcFiltru = [ and p.id_part=]+ALLTRIM(STR(tnid_partener)) +ELSE + lcFiltru = [] +ENDIF +If Used('v_clienti') + Use In v_clienti +Endif + +*!* lcSql=[select p.nume,p.cod_fiscal,p.id_part from ] + gcS + [.vnom_parteneri p order by p.nume] +lcSql = [select distinct p.nume, p.cod_fiscal, p.id_part FROM ] + gcS + [.vcoresp_tip_part p ] + ; + [join ] + gcS + [.vcoresp_tip_cont c on p.id_tip_part=c.id_tip_part where c.cont ='4111' ] + ; + [and p.inactiv=0 ]+lcFiltru+[ order by p.nume ] +*!* lcSql = [select distinct p.nume, p.cod_fiscal, p.id_part FROM ] + gcS + [.Vcoresp_tip_part p ] + ; +*!* [ join ]+gcS+[.vcoresp_tip_cont c on p.id_tip_part=c.id_tip_part where c.cont = 411 order by nume] +lcCursor = 'v_clienti' +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +goExecutor.oReset() +Return lnSucces + + +Endproc + +**********************sfarsit procedura update_clienti******************* +******************************************* +* PROCEDURE update_masini( ) +* Data/ora : 12/21/04, 10:33:10 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure update_masini( ) +If Used('v_masini') + Use In v_masini +Endif + +lcSql = [select id_masina,id_marca,nvl(masina,lpad(CHR(32),100,CHR(32))) as masina,sctip,clasa,] + ; + [nvl(marca,lpad(CHR(32),100,CHR(32))) as marca from ] + gcS + [.auto_vmasini where inactiv = 0 order by 3] +lcCursor = [v_masini] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +goExecutor.oReset() + +Return lnSucces +Endproc + +**********************sfarsit procedura update_masini******************* +******************************************* +* PROCEDURE update_ansamble( ) +* Data/ora : 12/21/04, 10:34:31 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure update_ansamble( ) +If Used('v_ansamble') + Use In v_ansamble +Endif + +lcSql = [select * from ] + gcS + [.auto_vansamble where inactiv=0 order by denumire] +lcCursor = [v_ansamble] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +goExecutor.oReset() + +Return lnSucces + +Endproc + +**********************sfarsit procedura update_ansamble******************* + +******************************************* +* PROCEDURE update_marci( ) +* Data/ora : 12/21/04, 16:05:00 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure update_marci( ) +If Used('v_marci') + Use In v_marci +Endif + +lcSql = [select * from ] + gcS + [.auto_vmarci order by marca] +lcCursor = [v_marci] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +goExecutor.oReset() + +Return lnSucces + +Endproc + +**********************sfarsit procedura update_marci******************* +******************************************* +* PROCEDURE update_asigurator( ) +* Data/ora : 12/21/04, 16:08:00 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure update_asigurator( ) +If Used('v_asiguratori') + Use In v_asiguratori +Endif + +lcSql = [select * from ] + gcS + [.auto_vasiguratori where inactiv = 0 order by asigurator] +lcCursor = [v_asiguratori] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +goExecutor.oReset() + +Return lnSucces +Endproc + +**********************sfarsit procedura update_asigurator******************* + +******************************************* +* PROCEDURE update_inspector( ) +* Data/ora : 01/06/05, 10:42:26 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure update_inspector( ) +If Used('v_inspectori') + Use In v_inspectori +Endif + +lcSql = [select * from ] + gcS + [.auto_vinspectori where inactiv = 0 order by inspector] +lcCursor = [v_inspectori] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +goExecutor.oReset() + +Return lnSucces + +Endproc + +**********************sfarsit procedura update_inspectori******************* + +******************************************* +* PROCEDURE update_furnizori( ) +* Data/ora : 01/03/05, 15:36:04 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure update_furnizori( ) +If Used('v_dealeri') + Use In v_dealeri +Endif + +lcSql = [select id_furnizor,denumire as furnizor,inactiv from ] + gcS + [.auto_vfurnizori order by denumire] +lcCursor = [v_dealeri] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +goExecutor.oReset() + +Return lnSucces + +Endproc + +**********************sfarsit procedura update_furnizori******************* + +******************************************* +* PROCEDURE update_preturi( ) +* Data/ora : 01/12/05, 16:36:27 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure update_preturi( ) +If Used('v_preturi') + Use In v_preturi +Endif + +lcSql = [select * from ] + gcS + [.auto_vpreturi where inactiv=0] +lcCursor = [v_preturi] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +goExecutor.oReset() + +Return lnSucces +Endproc + +**********************sfarsit procedura update_preturi******************* + +******************************************* +* PROCEDURE update_norme( ) +* Data/ora : 01/12/05, 16:40:41 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +Procedure update_norme +LPARAMETERS tcFiltru +LOCAL lcFiltru +IF EMPTY(tcFiltru) + lcFiltru = [where inactiv=0] +ELSE + lcFiltru = [where inactiv=0 and ] + tcFiltru +ENDIF + +If Used('v_norme') + Use In v_norme +Endif + +lcSql = [select auto_vnorme.*,0 as ales,9999 as ordine from ] + gcS + [.auto_vnorme ] + lcFiltru + [ order by denop,masina] +lcCursor = [v_norme] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +goExecutor.oReset() + +Return lnSucces +Endproc + +**********************sfarsit procedura update_norme******************* + + +******************************************* +* PROCEDURE update_optiuni_util( ) +* Data/ora : 02/11/05, 11:07:19 +* autor : liana.macinic +* descriere: + +****** PARAMETER BLOCK ************** +* Parametri : 0 +* +******************************************* +PROCEDURE update_optiuni_util( ) + IF USED('v_optiuni_util') + USE IN v_optiuni_util + ENDIF + + lcSql='select * from optiuni_util where id_util = '+ALLTRIM(STR(gnIdUtil)) + [ or id_util = 0 order by varname] + lcCursor = 'v_optiuni_util' + + lnSucces = goExecutor.oExecute(lcSql,lcCursor) +*!* AMESSAGEBOX('v_optiuni_util') + RETURN lnSucces + +ENDPROC + +**********************sfarsit procedura update_optiuni_util******************* +*********************************************************************** + +PROCEDURE ccsectii + + IF USED('v_nom_sectii') + USE IN v_nom_sectii + ENDIF + + lcSql='select id_sectie,sectie from '+gcS+'.vnom_sectii order by sectie' + lcCursor = 'v_nom_sectii' + + lnSucces = goExecutor.oExecute(lcSql,lcCursor) + RETURN lnSucces + +ENDPROC +*********************************************************************** +Procedure ccnorme +Lparameters tctip,tnid +Local lcFiltru + +If Used('v_denop') + Use In v_denop +Endif +Do Case +Case Empty(tctip) + lcFiltru = [ where inactiv=0 ] +Case tctip='NORMA' + lcFiltru=[ where id_norme = ] + Alltrim(Str(tnid)) +Case tctip='MASINA' + lcFiltru=[ where id_masina = ] + Alltrim(Str(tnid)) + [ and inactiv=0 ] +Endcase +lcSql='select id_norme,denop,timpn from '+gcS+'.auto_vnorme '+; + lcFiltru+' order by denop' +lcCursor = 'v_denop' + +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +Return lnSucces + +Endproc +*********************************************************************** +Procedure ccmecanici +If Used('v_mecanici') + Use In v_mecanici +Endif + +lcSql='select id_mecanic,TRIM(nume)||CHR(32)||TRIM(prenume) as nume from auto_vmecanici where inactiv=0 order by nume' +lcCursor = 'v_mecanici' + +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +Return lnSucces + +Endproc +*********************************************************************** +PROCEDURE cctipuri_deviz +IF USED('crstipuri_deviz') + USE IN crstipuri_deviz +ENDIF + +lcSql='select id_tip,denumire,inch_validare from dev_tip_deviz where sters=0 order by denumire' +lcCursor = 'crstipuri_deviz' +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +RETURN lnSucces + +ENDPROC +*********************************************************************** +Function cauta_utilizator +Lparameters tnIdUtil,tcUtilizator +Local locauta,llReturn +Store "" To locauta +Store .F. To llReturn +pcselect = ["select id_util,utilizator from syn_vutilizatori"] +pcfiltru = [1=2] +pcschema = [''] +pcorder = [utilizator] +pccoloane = [Utilizator] +pcTitlu = [Alegeþi utilizatorul] +pcTitluColoane = [Utilizator] +locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,"") +If !Empty(locauta.id_util) + tnIdUtil=locauta.id_util + tcUtilizator=Alltrim(locauta.utilizator) + llReturn=.T. +Endif +Return llReturn +Endfunc && cauta_utilizator +*********************************************************************** +FUNCTION cauta_client +Lparameters tnIdPartener,tcNume +Local locauta,llReturn +Store "" To locauta +Store .F. To llReturn +pcselect = ["select p.id_part,p.nume,p.cod_fiscal from ]+gcS+[.vcoresp_tip_part p "+] + ; + ["join ] + gcS + [.vcoresp_tip_cont c on p.id_tip_part=c.id_tip_part "+]+; + ["where c.cont ='4111' and p.inactiv=0"] +pcfiltru = [1=2] +pcschema = ['id_part n(10),nume c(100),cod_fiscal c(100)'] +pcorder = [nume] +pccoloane = [nume,cod_fiscal] +pcTitlu = [Alegeþi clientul] +pcTitluColoane = [Client,Cod fiscal] +locauta = cauta_alfa(pcselect,pcfiltru,pcschema,pcorder,pccoloane,pcTitlu,pcTitluColoane,"") +If !Empty(locauta.id_part) + tnIdPartener=locauta.id_part + tcNume=Alltrim(locauta.nume) + llReturn=.T. +Endif +Return llReturn +ENDFUNC +*********************************************************************** + +PROCEDURE ccarticole +LPARAMETERS tcFiltru +If Used('v_articole') + Use In v_articole +Endif + +lcSql = [select * from ] + gcS + [.vnom_articole where inactiv = 0 ] + IIF(!EMPTY(tcFiltru),[ and ] + tcFiltru,[])+ [ order by denumire ] +lcCursor = [v_articole] +lnSucces = goExecutor.oExecute(lcSql,lcCursor) + +Return lnSucces +Endproc +*********************************************************************** + +Procedure ccnorme_devest +LPARAMETERS tcFiltru +If Used('v_norme') + Use In v_norme +Endif + +lcSql='select * from '+gcS+'.auto_vnorme where inactiv = 0 ' + IIF(!EMPTY(tcFiltru),' and ' + tcFiltru,'')+ ' order by denop' +lcCursor = 'v_norme' + +lnSucces = goExecutor.oExecute(lcSql,lcCursor) +Return lnSucces + +ENDPROC +*********************************************************************** + diff --git a/Programe/update_nomenclator.prg b/Programe/update_nomenclator.prg new file mode 100644 index 0000000..389da92 --- /dev/null +++ b/Programe/update_nomenclator.prg @@ -0,0 +1,40 @@ +********************************************************** +PROCEDURE update_nomenclator + + DO update_lunilean + + *** tabele meniu deschise din proiect + LOCAL lcCaleDateMenu + + lcCaleDateMenu=gcAppPath+[COMUN\DATEMENU\] +*!* modificare v 2.0.6 +*!* IF !USED('XREQUEST') +*!* USE &lcCaleDateMenu.XREQUEST IN 0 ALIAS XREQUEST +*!* ENDIF +*!* IF !USED('xitems') +*!* USE &lcCaleDateMenu.xitems IN 0 ALIAS xitems +*!* ENDIF +*!* IF !USED('XSETS') +*!* USE &lcCaleDateMenu.XSETS IN 0 ALIAS XSETS ORDER TAG ID_SET +*!* ENDIF +*!* IF !USED('xACT') +*!* USE &lcCaleDateMenu.xACT IN 0 ALIAS xACT +*!* ENDIF +*!* IF !USED('xnote') +*!* USE &lcCaleDateMenu.xnote IN 0 ALIAS xnote +*!* ENDIF + lnSucces = xdate() +*!* modificare v 2.0.6 ^ + IF !USED('INFISIERE') + USE &lcCaleDateMenu.INFISIERE IN 0 ALIAS INFISIERE + ENDIF + + IF !USED('mila1') + USE &lcCaleDateMenu.mila1 IN 0 ALIAS mila1 + ENDIF + + *!* modificare v 2.0.5 + CREATE CURSOR dual (dummy c(10)) + INSERT INTO dual (dummy) VALUES ("x") + *!* modificare v 2.0.5 ^ +ENDPROC && update_nomenclator \ No newline at end of file diff --git a/Proiect/AUTOHAUS/Originale/usr_fact_farachit.FRT b/Proiect/AUTOHAUS/Originale/usr_fact_farachit.FRT new file mode 100644 index 0000000..b02603c Binary files /dev/null and b/Proiect/AUTOHAUS/Originale/usr_fact_farachit.FRT differ diff --git a/Proiect/AUTOHAUS/Originale/usr_fact_farachit.frx b/Proiect/AUTOHAUS/Originale/usr_fact_farachit.frx new file mode 100644 index 0000000..85a856b Binary files /dev/null and b/Proiect/AUTOHAUS/Originale/usr_fact_farachit.frx differ diff --git a/Proiect/AUTOHAUS/TVA 0/sigla.jpg b/Proiect/AUTOHAUS/TVA 0/sigla.jpg new file mode 100644 index 0000000..e5c97e9 Binary files /dev/null and b/Proiect/AUTOHAUS/TVA 0/sigla.jpg differ diff --git a/Proiect/AUTOHAUS/TVA 0/usr_fact_farachit.FRT b/Proiect/AUTOHAUS/TVA 0/usr_fact_farachit.FRT new file mode 100644 index 0000000..69a96fb Binary files /dev/null and b/Proiect/AUTOHAUS/TVA 0/usr_fact_farachit.FRT differ diff --git a/Proiect/AUTOHAUS/TVA 0/usr_fact_farachit.frx b/Proiect/AUTOHAUS/TVA 0/usr_fact_farachit.frx new file mode 100644 index 0000000..969c187 Binary files /dev/null and b/Proiect/AUTOHAUS/TVA 0/usr_fact_farachit.frx differ diff --git a/Proiect/ROAAUTO.mwb b/Proiect/ROAAUTO.mwb new file mode 100644 index 0000000..9a028c6 Binary files /dev/null and b/Proiect/ROAAUTO.mwb differ diff --git a/Proiect/ROAAUTO_vechi1506.mwb b/Proiect/ROAAUTO_vechi1506.mwb new file mode 100644 index 0000000..0bfba6c Binary files /dev/null and b/Proiect/ROAAUTO_vechi1506.mwb differ diff --git a/Rapoarte/Deviz20110919/rap_deviz_orig.FRT b/Rapoarte/Deviz20110919/rap_deviz_orig.FRT new file mode 100644 index 0000000..b5e8d1b Binary files /dev/null and b/Rapoarte/Deviz20110919/rap_deviz_orig.FRT differ diff --git a/Rapoarte/Deviz20110919/rap_deviz_orig.frx b/Rapoarte/Deviz20110919/rap_deviz_orig.frx new file mode 100644 index 0000000..32642d8 Binary files /dev/null and b/Rapoarte/Deviz20110919/rap_deviz_orig.frx differ diff --git a/Rapoarte/Deviz20110919/rap_deviz_v8.FRT b/Rapoarte/Deviz20110919/rap_deviz_v8.FRT new file mode 100644 index 0000000..86c10cb Binary files /dev/null and b/Rapoarte/Deviz20110919/rap_deviz_v8.FRT differ diff --git a/Rapoarte/Deviz20110919/rap_deviz_v8.frx b/Rapoarte/Deviz20110919/rap_deviz_v8.frx new file mode 100644 index 0000000..d6277f9 Binary files /dev/null and b/Rapoarte/Deviz20110919/rap_deviz_v8.frx differ diff --git a/Rapoarte/Linii/fact_cuchit.FRT b/Rapoarte/Linii/fact_cuchit.FRT new file mode 100644 index 0000000..bf96548 Binary files /dev/null and b/Rapoarte/Linii/fact_cuchit.FRT differ diff --git a/Rapoarte/Linii/fact_cuchit.frx b/Rapoarte/Linii/fact_cuchit.frx new file mode 100644 index 0000000..8cd3cfb Binary files /dev/null and b/Rapoarte/Linii/fact_cuchit.frx differ diff --git a/Rapoarte/Linii/fact_farachit.FRT b/Rapoarte/Linii/fact_farachit.FRT new file mode 100644 index 0000000..a8cfc84 Binary files /dev/null and b/Rapoarte/Linii/fact_farachit.FRT differ diff --git a/Rapoarte/Linii/fact_farachit.frx b/Rapoarte/Linii/fact_farachit.frx new file mode 100644 index 0000000..6209ec9 Binary files /dev/null and b/Rapoarte/Linii/fact_farachit.frx differ diff --git a/Rapoarte/Linii/factav_cuchit.FRT b/Rapoarte/Linii/factav_cuchit.FRT new file mode 100644 index 0000000..11aff84 Binary files /dev/null and b/Rapoarte/Linii/factav_cuchit.FRT differ diff --git a/Rapoarte/Linii/factav_cuchit.frx b/Rapoarte/Linii/factav_cuchit.frx new file mode 100644 index 0000000..b06dd49 Binary files /dev/null and b/Rapoarte/Linii/factav_cuchit.frx differ diff --git a/Rapoarte/Linii/factav_farachit.FRT b/Rapoarte/Linii/factav_farachit.FRT new file mode 100644 index 0000000..0922f64 Binary files /dev/null and b/Rapoarte/Linii/factav_farachit.FRT differ diff --git a/Rapoarte/Linii/factav_farachit.frx b/Rapoarte/Linii/factav_farachit.frx new file mode 100644 index 0000000..d4acd9c Binary files /dev/null and b/Rapoarte/Linii/factav_farachit.frx differ diff --git a/Rapoarte/Vechi/comfact.FRT b/Rapoarte/Vechi/comfact.FRT new file mode 100644 index 0000000..42fda6e Binary files /dev/null and b/Rapoarte/Vechi/comfact.FRT differ diff --git a/Rapoarte/Vechi/comfact.frx b/Rapoarte/Vechi/comfact.frx new file mode 100644 index 0000000..5e5ff58 Binary files /dev/null and b/Rapoarte/Vechi/comfact.frx differ diff --git a/Rapoarte/Vechi/comvalid.FRT b/Rapoarte/Vechi/comvalid.FRT new file mode 100644 index 0000000..3fcfde3 Binary files /dev/null and b/Rapoarte/Vechi/comvalid.FRT differ diff --git a/Rapoarte/Vechi/comvalid.frx b/Rapoarte/Vechi/comvalid.frx new file mode 100644 index 0000000..2b414f1 Binary files /dev/null and b/Rapoarte/Vechi/comvalid.frx differ diff --git a/Rapoarte/Vechi/comvalidnef.FRT b/Rapoarte/Vechi/comvalidnef.FRT new file mode 100644 index 0000000..25cb9ce Binary files /dev/null and b/Rapoarte/Vechi/comvalidnef.FRT differ diff --git a/Rapoarte/Vechi/comvalidnef.frx b/Rapoarte/Vechi/comvalidnef.frx new file mode 100644 index 0000000..1f1752e Binary files /dev/null and b/Rapoarte/Vechi/comvalidnef.frx differ diff --git a/Rapoarte/Vechi/factura.FRT b/Rapoarte/Vechi/factura.FRT new file mode 100644 index 0000000..48a3309 Binary files /dev/null and b/Rapoarte/Vechi/factura.FRT differ diff --git a/Rapoarte/Vechi/factura.frx b/Rapoarte/Vechi/factura.frx new file mode 100644 index 0000000..4fd20f2 Binary files /dev/null and b/Rapoarte/Vechi/factura.frx differ diff --git a/Rapoarte/Vechi/factura1.FRT b/Rapoarte/Vechi/factura1.FRT new file mode 100644 index 0000000..18d1137 Binary files /dev/null and b/Rapoarte/Vechi/factura1.FRT differ diff --git a/Rapoarte/Vechi/factura1.frx b/Rapoarte/Vechi/factura1.frx new file mode 100644 index 0000000..d732a38 Binary files /dev/null and b/Rapoarte/Vechi/factura1.frx differ diff --git a/Rapoarte/Vechi/listfactsold.FRT b/Rapoarte/Vechi/listfactsold.FRT new file mode 100644 index 0000000..08af560 Binary files /dev/null and b/Rapoarte/Vechi/listfactsold.FRT differ diff --git a/Rapoarte/Vechi/listfactsold.frx b/Rapoarte/Vechi/listfactsold.frx new file mode 100644 index 0000000..965b069 Binary files /dev/null and b/Rapoarte/Vechi/listfactsold.frx differ diff --git a/Rapoarte/_deviz.FRT b/Rapoarte/_deviz.FRT new file mode 100644 index 0000000..0f787dc Binary files /dev/null and b/Rapoarte/_deviz.FRT differ diff --git a/Rapoarte/_deviz.frx b/Rapoarte/_deviz.frx new file mode 100644 index 0000000..843e233 Binary files /dev/null and b/Rapoarte/_deviz.frx differ diff --git a/Rapoarte/_preco.FRT b/Rapoarte/_preco.FRT new file mode 100644 index 0000000..b9fa62f Binary files /dev/null and b/Rapoarte/_preco.FRT differ diff --git a/Rapoarte/_preco.frx b/Rapoarte/_preco.frx new file mode 100644 index 0000000..eb80322 Binary files /dev/null and b/Rapoarte/_preco.frx differ diff --git a/Rapoarte/centralizator_devize.FRT b/Rapoarte/centralizator_devize.FRT new file mode 100644 index 0000000..223c4f9 Binary files /dev/null and b/Rapoarte/centralizator_devize.FRT differ diff --git a/Rapoarte/centralizator_devize.frx b/Rapoarte/centralizator_devize.frx new file mode 100644 index 0000000..60b5f51 Binary files /dev/null and b/Rapoarte/centralizator_devize.frx differ diff --git a/Rapoarte/certificatg_a4.FRT b/Rapoarte/certificatg_a4.FRT new file mode 100644 index 0000000..5a75429 Binary files /dev/null and b/Rapoarte/certificatg_a4.FRT differ diff --git a/Rapoarte/certificatg_a4.frx b/Rapoarte/certificatg_a4.frx new file mode 100644 index 0000000..86e50c2 Binary files /dev/null and b/Rapoarte/certificatg_a4.frx differ diff --git a/Rapoarte/certificatg_a5.FRT b/Rapoarte/certificatg_a5.FRT new file mode 100644 index 0000000..bd000ff Binary files /dev/null and b/Rapoarte/certificatg_a5.FRT differ diff --git a/Rapoarte/certificatg_a5.frx b/Rapoarte/certificatg_a5.frx new file mode 100644 index 0000000..65829da Binary files /dev/null and b/Rapoarte/certificatg_a5.frx differ diff --git a/Rapoarte/clie.FRT b/Rapoarte/clie.FRT new file mode 100644 index 0000000..e898a41 Binary files /dev/null and b/Rapoarte/clie.FRT differ diff --git a/Rapoarte/clie.frx b/Rapoarte/clie.frx new file mode 100644 index 0000000..e28fdec Binary files /dev/null and b/Rapoarte/clie.frx differ diff --git a/Rapoarte/clieadresa.FRT b/Rapoarte/clieadresa.FRT new file mode 100644 index 0000000..4d5d078 Binary files /dev/null and b/Rapoarte/clieadresa.FRT differ diff --git a/Rapoarte/clieadresa.frx b/Rapoarte/clieadresa.frx new file mode 100644 index 0000000..74f390c Binary files /dev/null and b/Rapoarte/clieadresa.frx differ diff --git a/Rapoarte/facturi.FRT b/Rapoarte/facturi.FRT new file mode 100644 index 0000000..b5583d7 Binary files /dev/null and b/Rapoarte/facturi.FRT differ diff --git a/Rapoarte/facturi.frx b/Rapoarte/facturi.frx new file mode 100644 index 0000000..18fb199 Binary files /dev/null and b/Rapoarte/facturi.frx differ diff --git a/Rapoarte/facturia.FRT b/Rapoarte/facturia.FRT new file mode 100644 index 0000000..2bf1783 Binary files /dev/null and b/Rapoarte/facturia.FRT differ diff --git a/Rapoarte/facturia.frx b/Rapoarte/facturia.frx new file mode 100644 index 0000000..576f011 Binary files /dev/null and b/Rapoarte/facturia.frx differ diff --git a/Rapoarte/facturisectie.FRT b/Rapoarte/facturisectie.FRT new file mode 100644 index 0000000..3394e12 Binary files /dev/null and b/Rapoarte/facturisectie.FRT differ diff --git a/Rapoarte/facturisectie.frx b/Rapoarte/facturisectie.frx new file mode 100644 index 0000000..b46cf11 Binary files /dev/null and b/Rapoarte/facturisectie.frx differ diff --git a/Rapoarte/matbon.FRT b/Rapoarte/matbon.FRT new file mode 100644 index 0000000..06679cf Binary files /dev/null and b/Rapoarte/matbon.FRT differ diff --git a/Rapoarte/matbon.frx b/Rapoarte/matbon.frx new file mode 100644 index 0000000..068cb7f Binary files /dev/null and b/Rapoarte/matbon.frx differ diff --git a/Rapoarte/matbon_sec.FRT b/Rapoarte/matbon_sec.FRT new file mode 100644 index 0000000..c8fccd8 Binary files /dev/null and b/Rapoarte/matbon_sec.FRT differ diff --git a/Rapoarte/matbon_sec.frx b/Rapoarte/matbon_sec.frx new file mode 100644 index 0000000..f1c6682 Binary files /dev/null and b/Rapoarte/matbon_sec.frx differ diff --git a/Rapoarte/matnefact.FRT b/Rapoarte/matnefact.FRT new file mode 100644 index 0000000..1ca4c33 Binary files /dev/null and b/Rapoarte/matnefact.FRT differ diff --git a/Rapoarte/matnefact.frx b/Rapoarte/matnefact.frx new file mode 100644 index 0000000..ffb1c4f Binary files /dev/null and b/Rapoarte/matnefact.frx differ diff --git a/Rapoarte/opersal.FRT b/Rapoarte/opersal.FRT new file mode 100644 index 0000000..fc10d26 Binary files /dev/null and b/Rapoarte/opersal.FRT differ diff --git a/Rapoarte/opersal.frx b/Rapoarte/opersal.frx new file mode 100644 index 0000000..de11114 Binary files /dev/null and b/Rapoarte/opersal.frx differ diff --git a/Rapoarte/opersalcom.FRT b/Rapoarte/opersalcom.FRT new file mode 100644 index 0000000..233da2f Binary files /dev/null and b/Rapoarte/opersalcom.FRT differ diff --git a/Rapoarte/opersalcom.frx b/Rapoarte/opersalcom.frx new file mode 100644 index 0000000..667c301 Binary files /dev/null and b/Rapoarte/opersalcom.frx differ diff --git a/Rapoarte/preco.FRT b/Rapoarte/preco.FRT new file mode 100644 index 0000000..a5e9101 Binary files /dev/null and b/Rapoarte/preco.FRT differ diff --git a/Rapoarte/preco.frx b/Rapoarte/preco.frx new file mode 100644 index 0000000..a22a272 Binary files /dev/null and b/Rapoarte/preco.frx differ diff --git a/Rapoarte/preco_nou.FRT b/Rapoarte/preco_nou.FRT new file mode 100644 index 0000000..867c650 Binary files /dev/null and b/Rapoarte/preco_nou.FRT differ diff --git a/Rapoarte/preco_nou.frx b/Rapoarte/preco_nou.frx new file mode 100644 index 0000000..0500825 Binary files /dev/null and b/Rapoarte/preco_nou.frx differ diff --git a/Rapoarte/precog.FRT b/Rapoarte/precog.FRT new file mode 100644 index 0000000..8c7ad90 Binary files /dev/null and b/Rapoarte/precog.FRT differ diff --git a/Rapoarte/precog.frx b/Rapoarte/precog.frx new file mode 100644 index 0000000..7ba16e6 Binary files /dev/null and b/Rapoarte/precog.frx differ diff --git a/Rapoarte/rap_articole_comenzi.FRT b/Rapoarte/rap_articole_comenzi.FRT new file mode 100644 index 0000000..7ae3b13 Binary files /dev/null and b/Rapoarte/rap_articole_comenzi.FRT differ diff --git a/Rapoarte/rap_articole_comenzi.frx b/Rapoarte/rap_articole_comenzi.frx new file mode 100644 index 0000000..bf4944b Binary files /dev/null and b/Rapoarte/rap_articole_comenzi.frx differ diff --git a/Rapoarte/rap_comanda.FRT b/Rapoarte/rap_comanda.FRT new file mode 100644 index 0000000..ee2c0ca Binary files /dev/null and b/Rapoarte/rap_comanda.FRT differ diff --git a/Rapoarte/rap_comanda.frx b/Rapoarte/rap_comanda.frx new file mode 100644 index 0000000..c913a88 Binary files /dev/null and b/Rapoarte/rap_comanda.frx differ diff --git a/Rapoarte/rap_deviz.FRT b/Rapoarte/rap_deviz.FRT new file mode 100644 index 0000000..256ae87 Binary files /dev/null and b/Rapoarte/rap_deviz.FRT differ diff --git a/Rapoarte/rap_deviz.frx b/Rapoarte/rap_deviz.frx new file mode 100644 index 0000000..0704404 Binary files /dev/null and b/Rapoarte/rap_deviz.frx differ diff --git a/Rapoarte/rap_devize_marci.FRT b/Rapoarte/rap_devize_marci.FRT new file mode 100644 index 0000000..40d2abb Binary files /dev/null and b/Rapoarte/rap_devize_marci.FRT differ diff --git a/Rapoarte/rap_devize_marci.frx b/Rapoarte/rap_devize_marci.frx new file mode 100644 index 0000000..1f27790 Binary files /dev/null and b/Rapoarte/rap_devize_marci.frx differ diff --git a/Rapoarte/rap_devizest.FRT b/Rapoarte/rap_devizest.FRT new file mode 100644 index 0000000..37dbb4a Binary files /dev/null and b/Rapoarte/rap_devizest.FRT differ diff --git a/Rapoarte/rap_devizest.frx b/Rapoarte/rap_devizest.frx new file mode 100644 index 0000000..94b74a5 Binary files /dev/null and b/Rapoarte/rap_devizest.frx differ diff --git a/Rapoarte/rap_facturi_asig.FRT b/Rapoarte/rap_facturi_asig.FRT new file mode 100644 index 0000000..ec21154 Binary files /dev/null and b/Rapoarte/rap_facturi_asig.FRT differ diff --git a/Rapoarte/rap_facturi_asig.frx b/Rapoarte/rap_facturi_asig.frx new file mode 100644 index 0000000..c6cf02e Binary files /dev/null and b/Rapoarte/rap_facturi_asig.frx differ diff --git a/Rapoarte/rap_facturi_clienti.FRT b/Rapoarte/rap_facturi_clienti.FRT new file mode 100644 index 0000000..b6d8bfa Binary files /dev/null and b/Rapoarte/rap_facturi_clienti.FRT differ diff --git a/Rapoarte/rap_facturi_clienti.frx b/Rapoarte/rap_facturi_clienti.frx new file mode 100644 index 0000000..c724d23 Binary files /dev/null and b/Rapoarte/rap_facturi_clienti.frx differ diff --git a/Rapoarte/rap_facturi_sectii.FRT b/Rapoarte/rap_facturi_sectii.FRT new file mode 100644 index 0000000..04694b8 Binary files /dev/null and b/Rapoarte/rap_facturi_sectii.FRT differ diff --git a/Rapoarte/rap_facturi_sectii.frx b/Rapoarte/rap_facturi_sectii.frx new file mode 100644 index 0000000..d3d08f0 Binary files /dev/null and b/Rapoarte/rap_facturi_sectii.frx differ diff --git a/Rapoarte/rap_manasig.frt b/Rapoarte/rap_manasig.frt new file mode 100644 index 0000000..8c4974e Binary files /dev/null and b/Rapoarte/rap_manasig.frt differ diff --git a/Rapoarte/rap_manasig.frx b/Rapoarte/rap_manasig.frx new file mode 100644 index 0000000..a243f16 Binary files /dev/null and b/Rapoarte/rap_manasig.frx differ diff --git a/Rapoarte/rap_manopera_anfabricatie.FRT b/Rapoarte/rap_manopera_anfabricatie.FRT new file mode 100644 index 0000000..5631afc Binary files /dev/null and b/Rapoarte/rap_manopera_anfabricatie.FRT differ diff --git a/Rapoarte/rap_manopera_anfabricatie.frx b/Rapoarte/rap_manopera_anfabricatie.frx new file mode 100644 index 0000000..5f13a55 Binary files /dev/null and b/Rapoarte/rap_manopera_anfabricatie.frx differ diff --git a/Rapoarte/rap_manopera_anfabricatie_c.FRT b/Rapoarte/rap_manopera_anfabricatie_c.FRT new file mode 100644 index 0000000..653ffe3 Binary files /dev/null and b/Rapoarte/rap_manopera_anfabricatie_c.FRT differ diff --git a/Rapoarte/rap_manopera_anfabricatie_c.frx b/Rapoarte/rap_manopera_anfabricatie_c.frx new file mode 100644 index 0000000..8917198 Binary files /dev/null and b/Rapoarte/rap_manopera_anfabricatie_c.frx differ diff --git a/Rapoarte/rap_manopera_sectii.FRT b/Rapoarte/rap_manopera_sectii.FRT new file mode 100644 index 0000000..d464136 Binary files /dev/null and b/Rapoarte/rap_manopera_sectii.FRT differ diff --git a/Rapoarte/rap_manopera_sectii.frx b/Rapoarte/rap_manopera_sectii.frx new file mode 100644 index 0000000..b53419e Binary files /dev/null and b/Rapoarte/rap_manopera_sectii.frx differ diff --git a/Rapoarte/rap_oper.FRT b/Rapoarte/rap_oper.FRT new file mode 100644 index 0000000..f88156d Binary files /dev/null and b/Rapoarte/rap_oper.FRT differ diff --git a/Rapoarte/rap_oper.frx b/Rapoarte/rap_oper.frx new file mode 100644 index 0000000..07047cb Binary files /dev/null and b/Rapoarte/rap_oper.frx differ diff --git a/Rapoarte/rap_verifvenit.FRT b/Rapoarte/rap_verifvenit.FRT new file mode 100644 index 0000000..a5e3393 Binary files /dev/null and b/Rapoarte/rap_verifvenit.FRT differ diff --git a/Rapoarte/rap_verifvenit.frx b/Rapoarte/rap_verifvenit.frx new file mode 100644 index 0000000..b8f77b6 Binary files /dev/null and b/Rapoarte/rap_verifvenit.frx differ diff --git a/Rapoarte/salarii.FRT b/Rapoarte/salarii.FRT new file mode 100644 index 0000000..a1a379f Binary files /dev/null and b/Rapoarte/salarii.FRT differ diff --git a/Rapoarte/salarii.frx b/Rapoarte/salarii.frx new file mode 100644 index 0000000..b1568d4 Binary files /dev/null and b/Rapoarte/salarii.frx differ diff --git a/Rapoarte/tprod.FRT b/Rapoarte/tprod.FRT new file mode 100644 index 0000000..3c44136 Binary files /dev/null and b/Rapoarte/tprod.FRT differ diff --git a/Rapoarte/tprod.frx b/Rapoarte/tprod.frx new file mode 100644 index 0000000..7c2e7ba Binary files /dev/null and b/Rapoarte/tprod.frx differ diff --git a/Rapoarte/verordl.FRT b/Rapoarte/verordl.FRT new file mode 100644 index 0000000..49c548f Binary files /dev/null and b/Rapoarte/verordl.FRT differ diff --git a/Rapoarte/verordl.frx b/Rapoarte/verordl.frx new file mode 100644 index 0000000..4edaa98 Binary files /dev/null and b/Rapoarte/verordl.frx differ diff --git a/Scripturi_instalare/20090413/script_mv.txt b/Scripturi_instalare/20090413/script_mv.txt new file mode 100644 index 0000000..e14aabd --- /dev/null +++ b/Scripturi_instalare/20090413/script_mv.txt @@ -0,0 +1,265 @@ +CREATE MATERIALIZED VIEW LOG ON act WITH PRIMARY KEY, ROWID, SEQUENCE(id_lucrare,dataact,nract,id_set,scc,scd,luna,an,suma,sters,explicatia) +INCLUDING NEW VALUES; +CREATE MATERIALIZED VIEW LOG ON rul WITH PRIMARY KEY, ROWID, SEQUENCE(id_lucrare,luna,an,pretv,cante,sters) +INCLUDING NEW VALUES; +CREATE MATERIALIZED VIEW LOG ON dev_oper WITH PRIMARY KEY, ROWID, SEQUENCE(id_ordl,datai,pret,timpn,nou,sters) +INCLUDING NEW VALUES; + +create materialized view MV_ORDL_MAN +refresh fast on commit +as +select id_ordl, + extract(month from datai) + extract(year from datai) * 12 as luni, + sum(case + when nou = 0 then + round(round(pret / 10000, 2) * timpn, 2) + else + round(pret * timpn, 2) + end) as manopera_ron, + sum(case + when nou = 0 then + round(pret * timpn, 2) + else + 0 + end) as manopera_rol, + count(*) as cnt, + count(case + when nou = 0 then + round(round(pret / 10000, 2) * timpn, 2) + else + round(pret * timpn, 2) + end) as cnt_manopera_ron, + count(case + when nou = 0 then + round(pret * timpn, 2) + else + 0 + end) as cnt_manopera_rol + from dev_oper + where sters = 0 + group by id_ordl, + extract(month from datai) + extract(year from datai) * 12 +/ + +create materialized view MV_ORDL_MAT +refresh force on commit +as +select id_lucrare, + luna + an * 12 as luni, + sum(case + when luna + an * 12 < 7 + 2005 * 12 then + round(round(pretv / 10000, 2) * cante, 2) + else + round(pretv * cante, 2) + end) as materiale_ron, + sum(case + when luna + an * 12 < 7 + 2005 * 12 then + round(pretv * cante, 2) + else + 0 + end) as materiale_rol, + count(*) as cnt, + count(case + when luna + an * 12 < 7 + 2005 * 12 then + round(round(pretv / 10000, 2) * cante, 2) + else + round(pretv * cante, 2) + end) as cnt_materiale_ron, + count(case + when luna + an * 12 < 7 + 2005 * 12 then + round(pretv * cante, 2) + else + 0 + end) as cnt_materiale_rol + from rul + where sters = 0 + group by id_lucrare, luna + an * 12 +/ + +create materialized view MV_ORDL_SUME_ACT +refresh fast on commit +as +select id_lucrare, + dataact, + nract, + id_set, + sum(case + when scc = '704' then + (case + when luna + an * 12 < 7 + 2005 * 12 then + round(suma / 10000, 2) + else + suma + end) when explicatia like 'DISCOUNT MANOPERA%' and scc <> '4427' then(case + when luna + + an * 12 < 7 + + 2005 * 12 then + round((-1) * + (abs(suma)) / + 10000, + 2) + else + (-1) * + (abs(suma)) + end) else 0 end) as manopera_ron, + sum(case + when scc in ('707', '419') then + (case + when luna + an * 12 < 7 + 2005 * 12 then + round(suma / 10000, 2) + else + suma + end) when explicatia like 'DISCOUNT MATERIALE%' and scc <> '4427' then(case + when luna + + an * 12 < 7 + + 2005 * 12 then + round((-1) * + (abs(suma)) / + 10000, + 2) + else + (-1) * + (abs(suma)) + end) else 0 end) as materiale_ron, + sum(case + when scc = '4427' then + (case + when luna + an * 12 < 7 + 2005 * 12 then + round(suma / 10000, 2) + else + suma + end) else 0 end) as tva_ron, + sum(case + when scc = '704' then + (case + when luna + an * 12 < 7 + 2005 * 12 then + suma + else + 0 + end) when explicatia like 'DISCOUNT MANOPERA%' and scc <> '4427' then(case + when luna + + an * 12 < 7 + + 2005 * 12 then + (-1) * + (abs(suma)) + else + 0 + end) else 0 end) as manopera_rol, + sum(case + when scc in ('707', '419') then + (case + when luna + an * 12 < 7 + 2005 * 12 then + suma + else + 0 + end) when explicatia like 'DISCOUNT MATERIALE%' and scc <> '4427' then(case + when luna + + an * 12 < 7 + + 2005 * 12 then + (-1) * + (abs(suma)) + else + 0 + end) else 0 end) as materiale_rol, + sum(case + when scc = '4427' then + (case + when luna + an * 12 < 7 + 2005 * 12 then + suma + else + 0 + end) else 0 end) as tva_rol, + count(*) as cnt, + count(case + when scc = '704' then + (case + when luna + an * 12 < 7 + 2005 * 12 then + round(suma / 10000, 2) + else + suma + end) when explicatia like 'DISCOUNT MANOPERA%' and scc <> '4427' then(case + when luna + + an * 12 < 7 + + 2005 * 12 then + round((-1) * + (abs(suma)) / + 10000, + 2) + else + (-1) * + (abs(suma)) + end) else 0 end) as cnt_manopera_ron, + count(case + when scc in ('707', '419') then + (case + when luna + an * 12 < 7 + 2005 * 12 then + round(suma / 10000, 2) + else + suma + end) when explicatia like 'DISCOUNT MATERIALE%' and scc <> '4427' then(case + when luna + + an * 12 < 7 + + 2005 * 12 then + round((-1) * + (abs(suma)) / + 10000, + 2) + else + (-1) * + (abs(suma)) + end) else 0 end) as cnt_materiale_ron, + count(case + when scc = '4427' then + (case + when luna + an * 12 < 7 + 2005 * 12 then + round(suma / 10000, 2) + else + suma + end) else 0 end) as cnt_tva_ron, + count(case + when scc = '704' then + (case + when luna + an * 12 < 7 + 2005 * 12 then + suma + else + 0 + end) when explicatia like 'DISCOUNT MANOPERA%' and scc <> '4427' then(case + when luna + + an * 12 < 7 + + 2005 * 12 then + (-1) * + (abs(suma)) + else + 0 + end) else 0 end) as cnt_manopera_rol, + count(case + when scc in ('707', '419') then + (case + when luna + an * 12 < 7 + 2005 * 12 then + suma + else + 0 + end) when explicatia like 'DISCOUNT MATERIALE%' and scc <> '4427' then(case + when luna + + an * 12 < 7 + + 2005 * 12 then + (-1) * + (abs(suma)) + else + 0 + end) else 0 end) as cnt_materiale_rol, + count(case + when scc = '4427' then + (case + when luna + an * 12 < 7 + 2005 * 12 then + suma + else + 0 + end) else 0 end) as cnt_tva_rol + from act + where sters = 0 + and scd in ('4111', '667', '482', '711', '6588') + and id_set in + (31001, 31002, 31003, 31004, 31005, 31006, 31007, 31011, 31012) + group by id_lucrare, dataact, nract, id_set +/ \ No newline at end of file diff --git a/Scripturi_instalare/ROAAUTO_instalare.sql b/Scripturi_instalare/ROAAUTO_instalare.sql new file mode 100644 index 0000000..bf348e1 --- /dev/null +++ b/Scripturi_instalare/ROAAUTO_instalare.sql @@ -0,0 +1,25 @@ +prompt Versiunea ROAAUTO: 1.4.151 +prompt Pana la scriptul script_ff_2006_01_28_4.sql (inclusiv) din COMUN +prompt ================================================================ +prompt + +prompt +prompt Creare structura +prompt ================ +prompt + +@D:\CONTAFIN_ORACLE\ROAAUTO\Scripturi_instalare\curatare_schema.sql; +@D:\CONTAFIN_ORACLE\ROAAUTO\Scripturi_instalare\tabele.sql; +@D:\CONTAFIN_ORACLE\ROAAUTO\Scripturi_instalare\secvente.sql; +@D:\CONTAFIN_ORACLE\ROAAUTO\Scripturi_instalare\triggere.sql; +@D:\CONTAFIN_ORACLE\ROAAUTO\Scripturi_instalare\procfunc.sql; +@D:\CONTAFIN_ORACLE\ROAAUTO\Scripturi_instalare\packages.sql; +@D:\CONTAFIN_ORACLE\ROAAUTO\Scripturi_instalare\viewuri_materializate.sql; +@D:\CONTAFIN_ORACLE\ROAAUTO\Scripturi_instalare\viewuri.sql; + +prompt +prompt Initializari date ( trebuie sa existe tabela SAL_PERSONAL ) +prompt =========================================================== +prompt + +@D:\CONTAFIN_ORACLE\ROAAUTO\Scripturi_instalare\initializari.sql; \ No newline at end of file diff --git a/Scripturi_instalare/curatare_schema.sql b/Scripturi_instalare/curatare_schema.sql new file mode 100644 index 0000000..4c9ea5a --- /dev/null +++ b/Scripturi_instalare/curatare_schema.sql @@ -0,0 +1,296 @@ +-------------------------------------------------------- +-- Pregatire schema pentru ROAAUTO -- +-- Created by marius.atanasiu on 2/2/2006, 9:42:17 AM -- +-------------------------------------------------------- + +spool curatare_schema.log + +PROMPT +PROMPT Droping views +PROMPT ============= +PROMPT +declare + cursor crsviewuri is + select view_name from user_views where view_name like 'DEV_%'; + linie_view crsviewuri%rowtype; +begin + open crsviewuri; + loop + fetch crsviewuri into linie_view; + exit when crsviewuri%notfound; + execute immediate 'DROP VIEW '||linie_view.view_name; + end loop; +end; +/ + +PROMPT +PROMPT Droping materialized view mv_ordl_sume_act +PROMPT ========================================== +PROMPT +drop materialized view mv_ordl_sume_act +/ + +PROMPT +PROMPT Droping materialized view log on act +PROMPT ==================================== +PROMPT +drop materialized view log on act +/ + +PROMPT +PROMPT Droping materialized view mv_ordl_man +PROMPT ===================================== +PROMPT +drop materialized view MV_ORDL_MAN +/ + +PROMPT +PROMPT Droping materialized view log on dev_oper +PROMPT ========================================= +PROMPT +drop materialized view log on dev_oper +/ + +PROMPT +PROMPT Droping materialized view log on rul +PROMPT ==================================== +PROMPT +drop materialized view log on rul +/ + +PROMPT +PROMPT Droping materialized view mv_ordl_mat +PROMPT ===================================== +PROMPT +drop materialized view mv_ordl_mat +/ + +prompt +prompt Droping table DEV_CONTRACTE +prompt =========================== +prompt +drop table DEV_CONTRACTE; + +prompt +prompt Droping table DEV_FACTURI +prompt ========================== +prompt +drop table DEV_FACTURI; + +prompt +prompt Droping table DEV_NOM_FURNIZORIMASINI +prompt ===================================== +prompt +drop table DEV_NOM_FURNIZORIMASINI; + +prompt +prompt Droping table DEV_NOM_MARCI +prompt =========================== +prompt +drop table DEV_NOM_MARCI; + +prompt +prompt Droping table DEV_NOM_MASINI +prompt ============================ +prompt +drop table DEV_NOM_MASINI; + +prompt +prompt Droping table DEV_TIPURI_MOTOARE +prompt ================================ +prompt +drop table DEV_TIPURI_MOTOARE; + +prompt +prompt Droping table DEV_MASINICLIENTI +prompt =============================== +prompt +drop table DEV_MASINICLIENTI; + +prompt +prompt Droping table DEV_MECANICI +prompt ========================== +prompt +drop table DEV_MECANICI; + +prompt +prompt Droping table DEV_NOM_ANSAMBLE +prompt ============================== +prompt +drop table DEV_NOM_ANSAMBLE; + +prompt +prompt Droping table DEV_NOM_ASIGURATORI +prompt ================================= +prompt +drop table DEV_NOM_ASIGURATORI; + +prompt +prompt Droping table DEV_NOM_DELEGATI +prompt ============================== +prompt +drop table DEV_NOM_DELEGATI; + +prompt +prompt Droping table DEV_NOM_INSPECTORI +prompt ================================ +prompt +drop table DEV_NOM_INSPECTORI; + +prompt +prompt Droping table DEV_NOM_NORME +prompt =========================== +prompt +drop table DEV_NOM_NORME; + +prompt +prompt Droping table DEV_NOM_PRETURI +prompt ============================= +prompt +drop table DEV_NOM_PRETURI; + +prompt +prompt Droping table DEV_NOM_RESP +prompt ========================== +prompt +drop table DEV_NOM_RESP; + +prompt +prompt Droping table DEV_ORDL +prompt ====================== +prompt +drop table DEV_ORDL; + +prompt +prompt Droping table DEV_OPER +prompt ====================== +prompt +drop table DEV_OPER; + +prompt +prompt Droping table DEV_OPER_MECANICI +prompt =============================== +prompt +drop table DEV_OPER_MECANICI; + +prompt +prompt Droping table DEV_REVIZII +prompt ========================= +prompt +drop table DEV_REVIZII; + +prompt +prompt Droping table DEV_TIP_DEVIZ +prompt =========================== +prompt +drop table DEV_TIP_DEVIZ; + +prompt +prompt Droping sequence SEQ_DEV_COMANDA +prompt ================================ +prompt +drop sequence SEQ_DEV_COMANDA; + +prompt +prompt Droping sequence SEQ_DEV_MASINICLIENTI +prompt ====================================== +prompt +drop sequence SEQ_DEV_MASINICLIENTI; + +prompt +prompt Droping sequence SEQ_DEV_MECANICI +prompt ================================= +prompt +drop sequence SEQ_DEV_MECANICI; + +prompt +prompt Droping sequence SEQ_DEV_NOM_ANSAMBLE +prompt ===================================== +prompt +drop sequence SEQ_DEV_NOM_ANSAMBLE; + +prompt +prompt Droping sequence SEQ_DEV_NOM_ASIGURATORI +prompt ======================================== +prompt +drop sequence SEQ_DEV_NOM_ASIGURATORI; + +prompt +prompt Droping sequence SEQ_DEV_NOM_DELEGATI +prompt ===================================== +prompt +drop sequence SEQ_DEV_NOM_DELEGATI; + +prompt +prompt Droping sequence SEQ_DEV_NOM_FURNIZORIMASINI +prompt ============================================ +prompt +drop sequence SEQ_DEV_NOM_FURNIZORIMASINI; + +prompt +prompt Droping sequence SEQ_DEV_NOM_INSPECTORI +prompt ======================================= +prompt +drop sequence SEQ_DEV_NOM_INSPECTORI; + +prompt +prompt Droping sequence SEQ_DEV_NOM_MARCI +prompt ================================== +prompt +drop sequence SEQ_DEV_NOM_MARCI; + +prompt +prompt Droping sequence SEQ_DEV_NOM_MASINI +prompt =================================== +prompt +drop sequence SEQ_DEV_NOM_MASINI; + +prompt +prompt Droping sequence SEQ_DEV_NOM_NORME +prompt ================================== +prompt +drop sequence SEQ_DEV_NOM_NORME; + +prompt +prompt Droping sequence SEQ_DEV_NOM_PRETURI +prompt ==================================== +prompt +drop sequence SEQ_DEV_NOM_PRETURI; + +prompt +prompt Droping sequence SEQ_DEV_NOM_RESP +prompt ================================= +prompt +drop sequence SEQ_DEV_NOM_RESP; + +prompt +prompt Droping sequence SEQ_DEV_OPER +prompt ============================= +prompt +drop sequence SEQ_DEV_OPER; + +prompt +prompt Droping sequence SEQ_DEV_OPER_MECANICI +prompt ====================================== +prompt +drop sequence SEQ_DEV_OPER_MECANICI; + +prompt +prompt Droping sequence SEQ_DEV_ORDL +prompt ============================= +prompt +drop sequence SEQ_DEV_ORDL; + +prompt +prompt Droping sequence SEQ_DEV_TIP_DEVIZ +prompt ================================== +prompt +drop sequence SEQ_DEV_TIP_DEVIZ; + +prompt +prompt Droping sequence SEQ_DEV_TIPURI_MOTOARE +prompt ======================================= +prompt +drop sequence SEQ_DEV_TIPURI_MOTOARE; + +spool off \ No newline at end of file diff --git a/Scripturi_instalare/initializari.sql b/Scripturi_instalare/initializari.sql new file mode 100644 index 0000000..5664216 --- /dev/null +++ b/Scripturi_instalare/initializari.sql @@ -0,0 +1,217 @@ +set feedback off +set define off + +prompt +prompt Initializare SAL_PERSONAL +prompt ========================= + +prompt Disabling triggers for SAL_PERSONAL... +alter table SAL_PERSONAL disable all triggers; + +prompt Deleting SAL_PERSONAL... +delete from SAL_PERSONAL where id_salariat=0; +commit; + +prompt Loading SAL_PERSONAL... +insert into SAL_PERSONAL (ID_SALARIAT, NUME, PRENUME, MARCA, STERS, INACTIV, BINR, BLOC, CMNR, LOCNASTERE, LOCALITATE, LIVRETMIL, JUDET, ID_PART, ETAJ, CODPOSTAL, CODPERS, CMSERIA, VECHIMEI, STRADA, SPECIALIZ, SITMIL, SECTOR, SCARA, NUMAR, NATIONALIT, MODINCADR, CETATENIE, BISERIA, BIELIBERAT, APART, BIDATA, DATA_VECH, STARECIV, NUMEMAMA, NUMESOT, NUMETATA, ID_PROFESIE, VECHIMEZ) +values (0, '', null, 0, 0, 0, null, null, null, null, null, null, null, 0, null, null, 0, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, 0); +commit; +prompt 1 records loaded + +prompt Enabling triggers for SAL_PERSONAL... +alter table SAL_PERSONAL enable all triggers; + +prompt +prompt Initializare DEV_MECANICI +prompt ========================= +prompt Disabling triggers for DEV_MECANICI... +alter table DEV_MECANICI disable all triggers; + +prompt Deleting DEV_MECANICI... +delete from DEV_MECANICI where id_mecanic=1; +commit; + +prompt Loading DEV_MECANICI... +insert into DEV_MECANICI (ID_MECANIC, ID_SALARIAT, ID_SECTIE, STERS, INACTIV) +values (1, 0, null, 0, 0); +commit; +prompt 1 records loaded + +prompt Enabling triggers for DEV_MECANICI... +alter table DEV_MECANICI enable all triggers; + +prompt +prompt Initializare DEV_NOM_ANSAMBLE +prompt ============================= +prompt Disabling triggers for DEV_NOM_ANSAMBLE... +alter table DEV_NOM_ANSAMBLE disable all triggers; + +prompt Deleting DEV_NOM_ANSAMBLE... +delete from DEV_NOM_ANSAMBLE where id_ansamblu=0; +commit; + +prompt Loading DEV_NOM_ANSAMBLE... +insert into DEV_NOM_ANSAMBLE (ID_ANSAMBLU, DENUMIRE, STERS, INACTIV) +values (0, null, 0, 0); +commit; +prompt 1 records loaded + +prompt Enabling triggers for DEV_NOM_ANSAMBLE... +alter table DEV_NOM_ANSAMBLE enable all triggers; + +prompt +prompt Initializare DEV_NOM_ASIGURATORI +prompt ================================ +prompt Disabling triggers for DEV_NOM_ASIGURATORI... +alter table DEV_NOM_ASIGURATORI disable all triggers; + +prompt Deleting DEV_NOM_ASIGURATORI... +delete from DEV_NOM_ASIGURATORI where id_asigurator=0; +commit; + +prompt Loading DEV_NOM_ASIGURATORI... +insert into DEV_NOM_ASIGURATORI (ID_ASIGURATOR, ASIGURATOR, STERS, INACTIV) +values (0, null, 0, 0); +commit; +prompt 1 records loaded + +prompt Enabling triggers for DEV_NOM_ASIGURATORI... +alter table DEV_NOM_ASIGURATORI enable all triggers; + +prompt +prompt Initializare DEV_NOM_FURNIZORIMASINI +prompt ==================================== +prompt Disabling triggers for DEV_NOM_FURNIZORIMASINI... +alter table DEV_NOM_FURNIZORIMASINI disable all triggers; + +prompt Deleting DEV_NOM_FURNIZORIMASINI... +delete from DEV_NOM_FURNIZORIMASINI where id_furnizor=0; +commit; + +prompt Loading DEV_NOM_FURNIZORIMASINI... +insert into DEV_NOM_FURNIZORIMASINI (ID_FURNIZOR, DENUMIRE, STERS, INACTIV) +values (0, null, 0, 0); +commit; +prompt 1 records loaded + +prompt Enabling triggers for DEV_NOM_FURNIZORIMASINI... +alter table DEV_NOM_FURNIZORIMASINI enable all triggers; + +prompt +prompt Initializare DEV_NOM_INSPECTORI +prompt =============================== +prompt Disabling triggers for DEV_NOM_INSPECTORI... +alter table DEV_NOM_INSPECTORI disable all triggers; + +prompt Disabling foreign key constraints for DEV_NOM_INSPECTORI... +alter table DEV_NOM_INSPECTORI disable constraint FK_NOM_ASIGURATORI; + +prompt Deleting DEV_NOM_INSPECTORI... +delete from DEV_NOM_INSPECTORI where id_inspector=0; +commit; + +prompt Loading DEV_NOM_INSPECTORI... +insert into DEV_NOM_INSPECTORI (ID_INSPECTOR, INSPECTOR, ID_ASIGURATOR, STERS, INACTIV) +values (0, null, 0, 0, 0); +commit; +prompt 1 records loaded + +prompt Enabling foreign key constraints for DEV_NOM_INSPECTORI... +alter table DEV_NOM_INSPECTORI enable constraint FK_NOM_ASIGURATORI; + +prompt Enabling triggers for DEV_NOM_INSPECTORI... +alter table DEV_NOM_INSPECTORI enable all triggers; + +prompt +prompt Initializare DEV_NOM_MARCI +prompt ================================ +prompt Disabling triggers for DEV_NOM_MARCI... +alter table DEV_NOM_MARCI disable all triggers; + +prompt Deleting DEV_NOM_MARCI... +delete from DEV_NOM_MARCI where id_marca=0; +commit; + +prompt Loading DEV_NOM_MARCI... +insert into DEV_NOM_MARCI (ID_MARCA, MARCA, STERS, INACTIV) +values (0, null, 0, 0); +commit; +prompt 1 records loaded + +prompt Enabling triggers for DEV_NOM_MARCI... +alter table DEV_NOM_MARCI enable all triggers; + +prompt +prompt Initializare DEV_NOM_MASINI +prompt =========================== +prompt Disabling triggers for DEV_NOM_MASINI... +alter table DEV_NOM_MASINI disable all triggers; + +prompt Disabling foreign key constraints for DEV_NOM_MASINI... +alter table DEV_NOM_MASINI disable constraint FK_MARCA; + +prompt Deleting DEV_NOM_MASINI... +delete from DEV_NOM_MASINI where id_masina=0; +commit; + +prompt Loading DEV_NOM_MASINI... +insert into DEV_NOM_MASINI (ID_MASINA, ID_MARCA, MASINA, SCTIP, CLASA, STERS, INACTIV) +values (0, 0, null, null, null, 0, 0); +commit; +prompt 1 records loaded + +prompt Enabling foreign key constraints for DEV_NOM_MASINI... +alter table DEV_NOM_MASINI enable constraint FK_MARCA; + +prompt Enabling triggers for DEV_NOM_MASINI... +alter table DEV_NOM_MASINI enable all triggers; + +prompt +prompt Initializare DEV_TIPURI_MOTOARE +prompt =============================== +prompt Disabling triggers for DEV_TIPURI_MOTOARE... +alter table DEV_TIPURI_MOTOARE disable all triggers; + +prompt Deleting DEV_TIPURI_MOTOARE... +delete from DEV_TIPURI_MOTOARE where id_tipmotor=0; +commit; + +prompt Loading DEV_TIPURI_MOTOARE... +insert into DEV_TIPURI_MOTOARE (ID_TIPMOTOR, DENUMIRE, STERS, INACTIV) +values (0, null, 0, 0); +commit; +prompt 1 records loaded + +prompt Enabling triggers for DEV_TIPURI_MOTOARE... +alter table DEV_TIPURI_MOTOARE enable all triggers; + +prompt +prompt Initializare DEV_TIP_DEVIZ +prompt ========================== +prompt Disabling triggers for DEV_TIP_DEVIZ... +alter table DEV_TIP_DEVIZ disable all triggers; + +prompt Deleting DEV_TIP_DEVIZ... +delete from DEV_TIP_DEVIZ; +commit; + +prompt Loading DEV_TIP_DEVIZ... +insert into DEV_TIP_DEVIZ (ID_TIP, DENUMIRE, STERS) +values (1, 'POST GARANTIE', 0); +insert into DEV_TIP_DEVIZ (ID_TIP, DENUMIRE, STERS) +values (2, 'GARANTIE', 0); +insert into DEV_TIP_DEVIZ (ID_TIP, DENUMIRE, STERS) +values (3, 'REGIE', 0); +insert into DEV_TIP_DEVIZ (ID_TIP, DENUMIRE, STERS) +values (4, 'PREGATIRE', 0); +insert into DEV_TIP_DEVIZ (ID_TIP, DENUMIRE, STERS) +values (5, 'REGIE 2', 0); +commit; +prompt 5 records loaded + +prompt Enabling triggers for DEV_TIP_DEVIZ... +alter table DEV_TIP_DEVIZ enable all triggers; + +set feedback on +set define on +prompt Done. diff --git a/Scripturi_instalare/packages.sql b/Scripturi_instalare/packages.sql new file mode 100644 index 0000000..e5514a3 --- /dev/null +++ b/Scripturi_instalare/packages.sql @@ -0,0 +1,477 @@ +----------------------------------------------------------------- +-- Package & package body PACK_DEVIZE pentru ROAAUTO v 1.4.151 -- +-- Created by marius.atanasiu on 2/2/2006, 9:51:33 AM -- +----------------------------------------------------------------- + +spool packages.log + +prompt +prompt Creating package PACK_DEVIZE +prompt ============================ +prompt +create or replace package pack_devize is + + -- Author : LIANA.MACINIC + -- Created : 1/7/2005 11:40:29 AM + -- Purpose : + procedure dev_sterge_comanda(tcSchema in varchar2, + tnIdUtil in number, + tnIdOrdl in number, + tnIdLucrare in number); + + procedure dev_adauga_oper_fact(tcSchema in varchar2, + tnIdOrdl in number, + tnIdSectie in number, + tnIdNorme in number, + tnTotalFTva in number, + tnTimpN in number, + tnOre in number, + tnIdUtil in number, + tnIdMecanic in number); + + procedure dev_adauga_lucrare(v_gcs in varchar2, + tnan in number, + tnluna in number, + tnIdUtil in number, + pcNr in varchar2, + pnIdInsp in number, + pnIdAsig in number, + pnIdMC in number, + pnKmInt in number, + pdTermen in date, + pnTipCom in number, + pnIdOrdl out number); + + procedure dev_valideaza_comanda(v_gcs in varchar2, + tnid_ordl in number, + tnid_util in number); + + procedure dev_invalideaza_comanda(v_gcs in varchar2, + tnid_ordl in number, + tnid_utils in number); + + procedure dev_distribuie_timp_n(v_gcs in varchar2, v_filtru in varchar2); + + procedure dev_adauga_operatie(v_gcs in varchar2, + tnid_sectie in number, + tnid_ordl in number, + tnpret in number, + tnid_util in number, + tntimpn in number, + tnid_norme in number, + tcsir_idmecanic in varchar2); + + procedure dev_actualizeaza_operatie(v_gcs in varchar2, + v_camp in varchar2, + v_valoare_noua in number, + v_id_oper in number, + v_luna in number, + v_an in number); + + procedure dev_valideaza_operatie(v_gcs in varchar2, + tnid_oper in number, + tnid_util in number); + + procedure dev_valideaza_operatii(v_gcs in varchar2, + tnid_ordl in number, + tnid_util in number); + + procedure dev_completeaza_rul(v_gcs in varchar2, tnid_lucrare in number); + + procedure valideaza_operatie(V_SCHEMA IN VARCHAR2, + V_VALIDAT IN NUMBER, + V_ID_OPER IN NUMBER, + V_ID_UTIL IN NUMBER); + + procedure modifica_sectie(V_SCHEMA IN VARCHAR2, + V_ID_SECTIE IN NUMBER, + V_ID_OPER IN NUMBER, + V_ID_UTIL IN NUMBER); + + procedure modifica_tip_comanda(V_SCHEMA IN VARCHAR2, + V_ID_TIP IN NUMBER, + V_ID_ORDL IN NUMBER, + V_ID_UTIL IN NUMBER); + + procedure sterge_operatie(V_SCHEMA IN VARCHAR2, + V_ID_OPER IN NUMBER, + V_ID_UTIL IN NUMBER); +end pack_devize; +/ + +prompt +prompt Creating package body PACK_DEVIZE +prompt ================================= +prompt +CREATE OR REPLACE PACKAGE BODY pack_devize is + procedure dev_sterge_comanda(tcSchema in varchar2, + tnIdUtil in number, + tnIdOrdl in number, + tnIdLucrare in number) is + lnRulaje NUMBER(3) := 0; + lnOperatii NUMBER(3) := 0; + BEGIN + EXECUTE IMMEDIATE 'SELECT COUNT(*) AS SUMA FROM ' || tcSchema || + '.RUL WHERE ID_LUCRARE=:1 AND STERS=0' + INTO lnRulaje + USING tnIdLucrare; + + IF lnRulaje > 0 then + raise_application_error(-20001, + 'Aceasta comanda nu poate fi stearsa, deoarece are legaturi in rulaje!'); + ELSE + EXECUTE IMMEDIATE 'SELECT COUNT(*) AS SUMA FROM ' || tcSchema || + '.DEV_OPER WHERE ID_ORDL=:1 AND STERS=0' + INTO lnOperatii + USING tnIdOrdl; + + IF lnOperatii > 0 then + raise_application_error(-20001, + 'Aceasta comanda nu poate fi stearsa, deoarece are adaugate operatii!'); + ELSE + EXECUTE IMMEDIATE 'UPDATE ' || tcSchema || + '.DEV_ORDL SET STERS=1,ID_UTILS=:1,DATAORAS=SYSDATE WHERE ' || + 'ID_ORDL = :2' + USING tnIdUtil, tnIdOrdl; + END IF; + END IF; + END; + ------------------------------------------------------------------ + procedure dev_adauga_oper_fact(tcSchema in varchar2, + tnIdOrdl in number, + tnIdSectie in number, + tnIdNorme in number, + tnTotalFTva in number, + tnTimpN in number, + tnOre in number, + tnIdUtil in number, + tnIdMecanic in number) is + V_ID_OPER number(10); + V_PRET number(17, 4); + V_DATAORA date; + V_VALIDAT number(1); + v_nou number(1); + begin + if pack_sesiune.getAn() * 12 + pack_sesiune.getLuna() >= + pack_sesiune.GET_ANRON() * 12 + pack_sesiune.GET_LUNARON() then + v_nou := 1; + else + v_nou := 0; + end if; + + v_dataora := sysdate; + v_validat := 1; + execute immediate 'UPDATE ' || tcSchema || '.DEV_ORDL ' || + 'SET VALIDAT = :1,ID_UTIL_VALID = :2,DATAORAVALID = :3 WHERE ID_ORDL = :4 ' + using V_VALIDAT, tnIdUtil, V_DATAORA, tnIdOrdl; + + V_PRET := tnTotalFTva / tnTimpN; + + execute immediate 'INSERT INTO ' || tcSchema || + '.DEV_OPER(ID_ORDL,ID_SECTIE,TIMPN,PRET,ID_NORME,ID_UTIL,DATAORA,VALIDAT,NOU) ' || + 'VALUES (:1,:2,:3,:4,:5,:6,:7,:8,:9) RETURNING ID_OPER INTO :10' + using tnIdOrdl, tnIdSectie, tnTimpN, V_PRET, tnIdNorme, tnIdUtil, V_DATAORA, V_VALIDAT, V_NOU + returning into V_ID_OPER; + + execute immediate 'INSERT INTO ' || tcSchema || + '.DEV_OPER_MECANICI(ID_OPER,ID_MECANIC,ORE) ' || + 'VALUES(:1,:2,:3)' + using V_ID_OPER, tnIdMecanic, tnOre; + end; + ------------------------------------------------------------------ + procedure dev_adauga_lucrare(v_gcs in varchar2, + tnan in number, + tnluna in number, + tnIdUtil in number, + pcNr in varchar2, + pnIdInsp in number, + pnIdAsig in number, + pnIdMC in number, + pnKmInt in number, + pdTermen in date, + pnTipCom in number, + pnIdOrdl out number) is + V_DATAORA date := sysdate; + + begin + execute immediate 'INSERT INTO ' || v_gcs || '.NOM_LUCRARI (NRORD,ID_MOD) + VALUES( :1, 1200)' + using pcNr; + + execute immediate 'insert into ' || v_gcs || + '.dev_ordl + (an, luna, id_inspector, id_lucrare, datai, id_util_ad, id_masiniclient,id_asigurator,id_tip,kmint,termen,dataoraad) + values( :1 , :2 , :3 , :4 , :5 , :6 , :7 , :8, :9, :10, :11, :12) returning id_ordl into :13' + using tnAn, tnLuna, pnIdInsp, pack_sesiune.dev_idLucrare, v_dataora, tnIdUtil, pnIdMC, pnIdAsig, pnTipCom, pnKmInt, pdTermen, V_DATAORA + returning into pnidOrdl; + + execute immediate 'update ' || v_gcs || + '.dev_masiniclienti set kmint=:1 ' || + 'where id_masiniclient=:2' + using pnKmInt, pnIdMC; + end; + ------------------------------------------------------------------ + procedure dev_valideaza_comanda(v_gcs in varchar2, + tnid_ordl in number, + tnid_util in number) as + lnNevalidate NUMBER(3); + begin + execute immediate 'SELECT COUNT(*) FROM ' || v_gcs || '.DEV_OPER ' || + 'WHERE STERS=0 AND VALIDAT=0 AND ID_ORDL=:1' + into lnNevalidate + using tnid_ordl; + + if lnNevalidate > 0 then + RAISE_APPLICATION_ERROR(-20000, + 'Mai sunt operatii nevalidate pe aceasta comanda!' || + CHR(13) || CHR(10) || + LPAD(CHR(32), 12, CHR(32)) || + 'Comanda nu a fost validata!'); + end if; + execute immediate 'UPDATE ' || v_gcs || '.DEV_ORDL SET VALIDAT=1,' || + 'ID_UTIL_VALID=:1,DATAORAVALID=SYSDATE ' || + 'WHERE ID_ORDL=:2' + using tnid_util, tnid_ordl; + end; + ------------------------------------------------------------------ + procedure dev_invalideaza_comanda(v_gcs in varchar2, + tnid_ordl in number, + tnid_utils in number) AS + begin + execute immediate 'UPDATE ' || v_gcs || '.DEV_ORDL ' || + 'SET VALIDAT=0,ID_UTIL_VALID=0,DATAORAVALID=NULL,' || + 'ID_UTILS=:1,DATAORAS=SYSDATE ' || 'WHERE ID_ORDL=:2' + using tnid_utils, tnid_ordl; + end; + ------------------------------------------------------------------ + procedure dev_distribuie_timp_n(v_gcs in varchar2, v_filtru in varchar2) AS + lnManopera number(10); + lnSucces number(10); + lnTimpN number(7, 3); + lnId_oper number(10); + lnNrMecanici number(3); + lnOre number(7, 3); + lcSql varchar2(1000); + lcFiltru varchar2(2000); + lnSumaOre number(7, 3); + lnRanduri number(4); + lnIdMecanic number(1); + lcDevOper VARCHAR2(30); + begin + lcFiltru := replace(v_filtru, CHR(63), CHR(39)); + lnManopera := dbms_sql.open_cursor; + /*lcSql := 'SELECT B.ID_OPER,B.TIMPN,ROUND(SUM(NVL(D.ORE,-1.000)),3) + FROM ' || v_gcs || '.dev_vvalid_comenzi A + JOIN ' || v_gcs || + '.DEV_VOPER B ON A.ID_ORDL=B.ID_ORDL + LEFT JOIN ' || v_gcs || + '.DEV_VOPER_DETALII_M D ON B.ID_OPER=D.ID_OPER + WHERE ' || lcFiltru || ' + GROUP BY B.ID_OPER,B.TIMPN + HAVING B.TIMPN-ROUND(SUM(NVL(D.ORE,-1.000)),3)!=0';*/ + IF lcFiltru IS NULL THEN + lcDevOper := 'DEV_VOPER'; + ELSE + lcDevOper := 'DEV_VOPER_SIMPLU'; + END IF; + + lcSql := 'SELECT B.ID_OPER,B.TIMPN,ROUND(SUM(NVL(D.ORE,-1.000)),3) + FROM ' || v_gcs || '.dev_normare_comenzi A + JOIN ' || v_gcs || '.' || lcDevOper || + ' B ON A.ID_ORDL=B.ID_ORDL + LEFT JOIN ' || v_gcs || '.DEV_VOPER_DETALII_M D ON B.ID_OPER=D.ID_OPER + WHERE ' || lcFiltru || ' + GROUP BY B.ID_OPER,B.TIMPN + HAVING B.TIMPN-ROUND(SUM(NVL(D.ORE,-1.000)),3)!=0'; + dbms_sql.parse(lnManopera, lcSql, dbms_sql.native); + dbms_sql.define_column(lnManopera, 1, lnId_oper); + dbms_sql.define_column(lnManopera, 2, lnTimpN); + dbms_sql.define_column(lnManopera, 3, lnSumaOre); + + lnIdMecanic := 1; + lnSucces := dbms_sql.execute(lnManopera); + loop + if dbms_sql.fetch_rows(lnManopera) > 0 then + dbms_sql.column_value(lnManopera, 1, lnId_oper); + dbms_sql.column_value(lnManopera, 2, lnTimpN); + dbms_sql.column_value(lnManopera, 3, lnSumaOre); + + execute immediate 'SELECT COUNT(ID_MECANIC) FROM ' || v_gcs || + '.DEV_VOPER_DETALII_M WHERE ID_OPER=:1' + into lnNrMecanici + using lnId_oper; + + if lnNrMecanici = 0 then + execute immediate 'INSERT INTO ' || v_gcs || + '.DEV_OPER_MECANICI(ID_OPER,ID_MECANIC,ORE) ' || + ' VALUES(:1,:2,:3)' + using lnId_oper, lnIdMecanic, lnTimpN; + else + lnOre := lnTimpN / lnNrMecanici; + execute immediate 'UPDATE ' || v_gcs || + '.DEV_OPER_MECANICI SET ORE=:1 WHERE ID_OPER=:2 AND STERS=0' + using lnOre, lnId_oper; + end if; + + else + exit; + end if; + end loop; + + dbms_sql.close_cursor(lnManopera); + end; + ------------------------------------------------------------------ + procedure dev_adauga_operatie(v_gcs in varchar2, + tnid_sectie in number, + tnid_ordl in number, + tnpret in number, + tnid_util in number, + tntimpn in number, + tnid_norme in number, + tcsir_idmecanic in varchar2) AS + v_id_oper number(10); + v_lungime_sir number(3); + v_ore number(7, 3); + v_timp_ramas number(7, 3); + v_nou number(1); + begin + + if pack_sesiune.getAn() * 12 + pack_sesiune.getLuna() >= + pack_sesiune.GET_ANRON() * 12 + pack_sesiune.GET_LUNARON() then + v_nou := 1; + else + v_nou := 0; + end if; + + /* execute immediate 'INSERT INTO ' || v_gcs || + '.DEV_OPER(ID_ORDL,ID_SECTIE,TIMPN,PRET,ID_NORME,ID_UTIL,NOU,DATAORA) ' || + 'VALUES (:1,:2,:3,:4,:5,:6,:7,SYSDATE) RETURNING ID_OPER INTO :8' + using tnid_ordl, tnid_sectie, tntimpn, tnpret, tnid_norme, tnid_util, v_nou + returning into v_id_oper;*/ + + execute immediate 'INSERT INTO ' || v_gcs || + '.DEV_OPER(ID_ORDL,ID_SECTIE,TIMPN,PRET,ID_NORME,ID_UTILI,NOU,DATAORA) ' || + 'VALUES (:1,:2,:3,:4,:5,:6,:7,:8) RETURNING ID_OPER INTO :9' + using tnid_ordl, tnid_sectie, tntimpn, tnpret, tnid_norme, tnid_util, v_nou, SYSDATE + returning into v_id_oper; + + v_lungime_sir := SIR_IN_SIR(tcsir_idmecanic, ';'); + v_ore := round(tntimpn / v_lungime_sir, 3); + + if v_lungime_sir > 0 then + for i in 1 .. v_lungime_sir loop + execute immediate 'INSERT INTO ' || v_gcs || + '.DEV_OPER_MECANICI(ID_OPER,ID_MECANIC,ORE) ' || + 'VALUES(:1,:2,:3)' + using v_id_oper, ID_DIN_SIR(tcsir_idmecanic, ';', i), v_ore; + end loop; + end if; + + end; + ------------------------------------------------------------------ + procedure dev_actualizeaza_operatie(v_gcs in varchar2, + v_camp in varchar2, + v_valoare_noua in number, + v_id_oper in number, + v_luna in number, + v_an in number) as + v_datai date; + v_data_ron date; + v_data_util date; + v_valoare number; + begin + execute immediate 'SELECT DATAI FROM ' || v_gcs || + '.DEV_OPER WHERE ID_OPER=:1' + into v_datai + using v_id_oper; + + v_data_ron := to_date(pack_sesiune.get_lunaron || '/' || + pack_sesiune.get_anron, + 'MM/YYYY'); + v_data_util := to_date(v_luna || '/' || v_an, 'MM/YYYY'); + + if UPPER(TRIM(v_camp)) = 'PRET' and v_datai < v_data_ron and + v_data_util >= v_data_ron then + v_valoare := v_valoare_noua * 10000; + else + v_valoare := v_valoare_noua; + end if; + + execute immediate 'UPDATE ' || v_gcs || '.DEV_OPER SET ' || v_camp || + '=:1 WHERE ID_OPER=:2' + using v_valoare, v_id_oper; + end; + ------------------------------------------------------------------ + procedure dev_valideaza_operatie(v_gcs in varchar2, + tnid_oper in number, + tnid_util in number) as + begin + execute immediate 'UPDATE ' || v_gcs || '.DEV_OPER SET VALIDAT=1,' || + 'ID_UTIL=:1,DATAORA=SYSDATE ' || 'WHERE ID_OPER=:2' + using tnid_util, tnid_oper; + end; + ------------------------------------------------------------------ + procedure dev_valideaza_operatii(v_gcs in varchar2, + tnid_ordl in number, + tnid_util in number) as + begin + execute immediate 'UPDATE ' || v_gcs || '.DEV_OPER SET VALIDAT=1,' || + 'ID_UTIL=:1,DATAORA=SYSDATE ' || + 'WHERE ID_ORDL=:2 AND STERS=0 AND VALIDAT=0' + using tnid_util, tnid_ordl; + end; + ------------------------------------------------------------------ + procedure dev_completeaza_rul(v_gcs in varchar2, tnid_lucrare in number) AS + V_ID_FACT number(20); + begin + V_ID_FACT := pack_contafin.get_idFact(); + execute immediate 'update ' || v_gcs || + '.rul set id_fact=:1 where id_lucrare=:2' + using V_ID_FACT, tnid_lucrare; + end; + ------------------------------------------------------------------ + procedure valideaza_operatie(V_SCHEMA IN VARCHAR2, + V_VALIDAT IN NUMBER, + V_ID_OPER IN NUMBER, + V_ID_UTIL IN NUMBER) is + begin + EXECUTE IMMEDIATE 'UPDATE ' || V_SCHEMA || '.DEV_OPER SET VALIDAT=:1,' || + 'DATAORA=:2,ID_UTIL=:3 WHERE ID_OPER=:4' + USING V_VALIDAT, SYSDATE, V_ID_UTIL, V_ID_OPER; + end; + ------------------------------------------------------------------ + procedure modifica_sectie(V_SCHEMA IN VARCHAR2, + V_ID_SECTIE IN NUMBER, + V_ID_OPER IN NUMBER, + V_ID_UTIL IN NUMBER) is + begin + EXECUTE IMMEDIATE 'UPDATE ' || V_SCHEMA || + '.DEV_OPER SET ID_SECTIE=:1 WHERE ID_OPER=:2' + USING V_ID_SECTIE, V_ID_OPER; + end; + ------------------------------------------------------------------ + procedure modifica_tip_comanda(V_SCHEMA IN VARCHAR2, + V_ID_TIP IN NUMBER, + V_ID_ORDL IN NUMBER, + V_ID_UTIL IN NUMBER) is + begin + EXECUTE IMMEDIATE 'UPDATE ' || V_SCHEMA || '.DEV_ORDL SET ID_TIP=:1 ' || + 'WHERE ID_ORDL=:2' + USING V_ID_TIP, V_ID_ORDL; + end; + ------------------------------------------------------------------ + procedure sterge_operatie(V_SCHEMA IN VARCHAR2, + V_ID_OPER IN NUMBER, + V_ID_UTIL IN NUMBER) is + begin + EXECUTE IMMEDIATE 'UPDATE ' || V_SCHEMA || '.DEV_OPER SET STERS=:1,' || + 'DATAORAS=:2,ID_UTILS=:3 WHERE ID_OPER=:4' + USING 1, SYSDATE, V_ID_UTIL, V_ID_OPER; + end; + ------------------------------------------------------------------ + ------------------------------------------------------------------ +end pack_devize; +/ + + +spool off diff --git a/Scripturi_instalare/procfunc.sql b/Scripturi_instalare/procfunc.sql new file mode 100644 index 0000000..bf99d19 --- /dev/null +++ b/Scripturi_instalare/procfunc.sql @@ -0,0 +1,187 @@ +-------------------------------------------------------- +-- Proceduri si functii pentru ROAAUTO v 1.4.151 -- +-- Created by marius.atanasiu on 2/2/2006, 9:52:31 AM -- +-------------------------------------------------------- + +spool procfunc.log + +prompt +prompt Creating function SIR_IN_SIR +prompt ============================ +prompt +create or replace function sir_in_sir(sir1 in varchar2, sir2 in varchar2) + return integer is + vret integer := 0; + v_count integer := 0; +begin + case + when instr(sir1, sir2, 1, 1) = 0 then + vret := 0; + when instr(sir1, sir2, 1, 1) <> 0 and + instr(sir1, sir2, 1, 1) = instr(sir1, sir2, -1, 1) then + vret := 1; + else + for i in 1 .. length(sir1) loop + if substr(sir1, i, length(sir2)) = sir2 then + v_count := v_count + 1; + end if; + end loop; + vret := v_count; + end case; + return vret; +end; +/ + +prompt +prompt Creating function ELEMENT_DIN_SIR +prompt ================================= +prompt +create or replace function ELEMENT_DIN_SIR(SIR1 IN VARCHAR2, + SIR2 IN VARCHAR2, + OCC IN INTEGER) return VARCHAR2 is + + VRET VARCHAR2(1000) := ''; +begin + if sir_in_sir(sir1, sir2) > 0 then + vret := NVL(REPLACE(substr(SIR1,(CASE WHEN OCC > 1 THEN instr(sir1, sir2, 1, OCC - 1) ELSE 0 END) + 1, instr(sir1, sir2, 1, OCC) - (CASE WHEN OCC > 1 THEN instr(sir1, sir2, 1, OCC - 1) ELSE 0 END)), SIR2, ''), ''); + end if; + return vret; +end; +/ + +prompt +prompt Creating function GETDEV_COMANDA +prompt ================================ +prompt +create or replace function getdev_comanda +return number IS +lnReturn NUMBER(20) := 0; + begin + + select seq_dev_comanda.NEXTVAL into lnReturn from dual; + return lnReturn; +end getdev_comanda; +/ + +prompt +prompt Creating function ID_DIN_SIR +prompt ============================ +prompt +create or replace function ID_DIN_SIR(SIR1 IN VARCHAR2, + SIR2 IN VARCHAR2, + OCC IN INTEGER) return NUMBER is + + VRET NUMBER(20) := 0; +begin + if sir_in_sir(sir1, sir2) > 0 then + vret := TO_NUMBER(NVL(REPLACE(substr(SIR1, + (CASE WHEN OCC>1 THEN instr(sir1, sir2, 1, OCC-1) ELSE 0 END) + 1, + instr(sir1, sir2, 1, OCC) - + (CASE WHEN OCC>1 THEN instr(sir1, sir2, 1, OCC-1) ELSE 0 END)),SIR2,''), + 0)); + end if; + return vret; +end; +/ + +prompt +prompt Creating procedure DEVINVALCOMPROC +prompt ================================== +prompt +CREATE OR REPLACE PROCEDURE "DEVINVALCOMPROC"(V_SCHEMA IN VARCHAR2, + V_ID_ORDL IN NUMBER, + V_ID_UTILS IN NUMBER) AS +BEGIN + EXECUTE IMMEDIATE 'UPDATE ' || V_SCHEMA || '.DEV_ORDL ' || + 'SET VALIDAT=0,TVAM=0,TVAN=0,TVA=0,' || + 'MANOPERA=0,MATERIALE=0,VALOARE=0,' || + 'ID_UTIL_VALID=0,DATAORAVALID=NULL,ID_UTILS=:1,' || + 'DATAORAS=SYSDATE WHERE ID_ORDL=:2' + USING V_ID_UTILS, V_ID_ORDL; +END; +/ + +prompt +prompt Creating procedure DEVPARTINSPROC +prompt ================================= +prompt +CREATE OR REPLACE PROCEDURE DEVPARTINSPROC(V_SCHEMA IN VARCHAR2, + V_NUME IN VARCHAR2, + V_COD_FISCAL IN VARCHAR2, + V_TELEFON IN VARCHAR2, + V_ADRESA IN VARCHAR2, + V_BANCA IN VARCHAR2, + V_CONT_BANCA IN VARCHAR2, + V_REG_COMERT IN VARCHAR2, + V_ID_LOC IN NUMBER) IS + V_ID_PART NUMBER(20) := 0; + V_ID_TIP_PART NUMBER(20) := 0; + V_CONT VARCHAR2(4) := '4111'; +BEGIN + EXECUTE IMMEDIATE 'INSERT /*+ APPEND */ INTO ' || V_SCHEMA || '.NOM_PARTENERI' || + '(NUME,COD_FISCAL,TELEFON,ADRESA,BANCA,CONT_BANCA,REG_COMERT,ID_LOC) ' || + 'VALUES(:1,:2,:3,:4,:5,:6,:7,:8) RETURNING ID_PART INTO :9' + USING V_NUME, V_COD_FISCAL, V_TELEFON, V_ADRESA, V_BANCA, V_CONT_BANCA, V_REG_COMERT, V_ID_LOC + RETURNING INTO V_ID_PART; + + EXECUTE IMMEDIATE 'SELECT ID_TIP_PART FROM ' || V_SCHEMA || + '.VCORESP_TIP_CONT ' || 'WHERE CONT=:1' + INTO V_ID_TIP_PART + USING V_CONT; + + EXECUTE IMMEDIATE 'INSERT /*+ APPEND */ INTO ' || V_SCHEMA || + '.CORESP_TIP_PART(ID_TIP_PART,ID_PART) ' || + 'VALUES(:1,:2)' + USING V_ID_TIP_PART, V_ID_PART; +END; +/ + +prompt +prompt Creating procedure DEVVALCOMPROC +prompt ================================ +prompt +CREATE OR REPLACE PROCEDURE "DEVVALCOMPROC"(V_SCHEMA IN VARCHAR2, + V_ID_ORDL IN NUMBER, + V_ID_LUCRARE IN NUMBER, + V_ID_UTIL IN NUMBER) as + V_CTVA NUMBER(5, 2) := 1.19; + V_TVAM NUMBER(17, 4) := 0; + V_TVAN NUMBER(17, 4) := 0; + V_TVA NUMBER(17, 4) := 0; + V_MANOPERA NUMBER(17, 4) := 0; + V_MATERIALE NUMBER(17, 4) := 0; + V_VALOARE NUMBER(17, 4) := 0; +BEGIN + EXECUTE IMMEDIATE 'SELECT SUM(PRET*TIMPN) AS MANOPERA FROM ' || V_SCHEMA || + '.DEV_OPER WHERE ID_ORDL=:1' + INTO V_MANOPERA + USING V_ID_ORDL; + + IF V_MANOPERA IS NULL THEN + V_MANOPERA:=0; + END IF; + + EXECUTE IMMEDIATE 'SELECT SUM(PRETV*CANTE) AS MATERIALE FROM ' || + V_SCHEMA || '.RUL WHERE ID_LUCRARE=:1' + INTO V_MATERIALE + USING V_ID_LUCRARE; + + IF V_MATERIALE IS NULL THEN + V_MATERIALE:=0; + END IF; + + V_TVAM := V_MATERIALE * (V_CTVA - 1); + V_TVAN := V_MANOPERA * (V_CTVA - 1); + V_TVA := V_TVAM + V_TVAN; + V_VALOARE := V_TVA + V_MANOPERA + V_MATERIALE; + + EXECUTE IMMEDIATE 'UPDATE ' || V_SCHEMA || '.DEV_ORDL SET VALIDAT=1,' || + 'TVAM=:1,TVAN=:2,TVA=:3,MANOPERA=:4,MATERIALE=:5,' || + 'VALOARE=:6,ID_UTIL_VALID=:7,DATAORAVALID=SYSDATE ' || + 'WHERE ID_ORDL=:8' + USING V_TVAM, V_TVAN, V_TVA, V_MANOPERA, V_MATERIALE, V_VALOARE, V_ID_UTIL, V_ID_ORDL; +END; +/ + + +spool off diff --git a/Scripturi_instalare/secvente.sql b/Scripturi_instalare/secvente.sql new file mode 100644 index 0000000..35b6122 --- /dev/null +++ b/Scripturi_instalare/secvente.sql @@ -0,0 +1,207 @@ +-------------------------------------------------------- +-- Secvente pentru ROAAUTO v 1.4.151 -- +-- Created by marius.atanasiu on 2/2/2006, 9:43:11 AM -- +-------------------------------------------------------- + +spool secvente.log + +prompt +prompt Creating sequence SEQ_DEV_COMANDA +prompt ================================= +prompt +create sequence SEQ_DEV_COMANDA +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_MASINICLIENTI +prompt ======================================= +prompt +create sequence SEQ_DEV_MASINICLIENTI +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_MECANICI +prompt ================================== +prompt +create sequence SEQ_DEV_MECANICI +minvalue 2 +maxvalue 999999999999999999999999999 +start with 2 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_NOM_ANSAMBLE +prompt ====================================== +prompt +create sequence SEQ_DEV_NOM_ANSAMBLE +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_NOM_ASIGURATORI +prompt ========================================= +prompt +create sequence SEQ_DEV_NOM_ASIGURATORI +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_NOM_DELEGATI +prompt ====================================== +prompt +create sequence SEQ_DEV_NOM_DELEGATI +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_NOM_FURNIZORIMASINI +prompt ============================================= +prompt +create sequence SEQ_DEV_NOM_FURNIZORIMASINI +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_NOM_INSPECTORI +prompt ======================================== +prompt +create sequence SEQ_DEV_NOM_INSPECTORI +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_NOM_MARCI +prompt =================================== +prompt +create sequence SEQ_DEV_NOM_MARCI +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_NOM_MASINI +prompt ==================================== +prompt +create sequence SEQ_DEV_NOM_MASINI +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_NOM_NORME +prompt =================================== +prompt +create sequence SEQ_DEV_NOM_NORME +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_NOM_PRETURI +prompt ===================================== +prompt +create sequence SEQ_DEV_NOM_PRETURI +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_NOM_RESP +prompt ================================== +prompt +create sequence SEQ_DEV_NOM_RESP +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_OPER +prompt ============================== +prompt +create sequence SEQ_DEV_OPER +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_OPER_MECANICI +prompt ======================================= +prompt +create sequence SEQ_DEV_OPER_MECANICI +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_ORDL +prompt ============================== +prompt +create sequence SEQ_DEV_ORDL +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_TIP_DEVIZ +prompt =================================== +prompt +create sequence SEQ_DEV_TIP_DEVIZ +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + +prompt +prompt Creating sequence SEQ_DEV_TIPURI_MOTOARE +prompt ======================================== +prompt +create sequence SEQ_DEV_TIPURI_MOTOARE +minvalue 1 +maxvalue 999999999999999999999999999 +start with 1 +increment by 1 +nocache; + + +spool off diff --git a/Scripturi_instalare/tabele.sql b/Scripturi_instalare/tabele.sql new file mode 100644 index 0000000..6e900bd --- /dev/null +++ b/Scripturi_instalare/tabele.sql @@ -0,0 +1,797 @@ +-------------------------------------------------------- +-- Tabele ROAAUTO versiunea 1.4.151 -- +-- Created by marius.atanasiu on 2/2/2006, 9:42:17 AM -- +-------------------------------------------------------- + +spool tabele.log + +prompt +prompt Creating table DEV_NOM_FURNIZORIMASINI +prompt ====================================== +prompt +create table DEV_NOM_FURNIZORIMASINI +( + ID_FURNIZOR NUMBER(5) not null, + DENUMIRE VARCHAR2(50), + STERS NUMBER(1) default 0 not null, + INACTIV NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_NOM_FURNIZORIMASINI + add constraint PK_FURNIZOR primary key (ID_FURNIZOR) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); + +prompt +prompt Creating table DEV_NOM_MARCI +prompt ============================ +prompt +create table DEV_NOM_MARCI +( + ID_MARCA NUMBER(5) not null, + MARCA VARCHAR2(24), + STERS NUMBER(1) default 0 not null, + INACTIV NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_NOM_MARCI + add constraint PK_MARCA primary key (ID_MARCA) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); + +prompt +prompt Creating table DEV_NOM_MASINI +prompt ============================= +prompt +create table DEV_NOM_MASINI +( + ID_MASINA NUMBER(5) not null, + ID_MARCA NUMBER(5) not null, + MASINA VARCHAR2(20), + SCTIP VARCHAR2(100), + CLASA VARCHAR2(10), + STERS NUMBER(1) default 0 not null, + INACTIV NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_NOM_MASINI + add constraint PK_MASINA primary key (ID_MASINA) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_NOM_MASINI + add constraint FK_MARCA foreign key (ID_MARCA) + references DEV_NOM_MARCI (ID_MARCA); + +prompt +prompt Creating table DEV_TIPURI_MOTOARE +prompt ================================= +prompt +create table DEV_TIPURI_MOTOARE +( + ID_TIPMOTOR NUMBER(5) not null, + DENUMIRE VARCHAR2(50), + STERS NUMBER(1) default 0 not null, + INACTIV NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_TIPURI_MOTOARE + add constraint PK_TIPMOTOR primary key (ID_TIPMOTOR) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); + +prompt +prompt Creating table DEV_MASINICLIENTI +prompt ================================ +prompt +create table DEV_MASINICLIENTI +( + ID_MASINICLIENT NUMBER(8) default 0 not null, + ID_TIPMOTOR NUMBER(5), + ID_FURNIZOR NUMBER(5), + ID_MASINA NUMBER(5), + ID_PARTENER NUMBER(5) default 0 not null, + NRINMAT VARCHAR2(10), + SERIES VARCHAR2(17), + SERIEM VARCHAR2(17), + CULOARE VARCHAR2(30), + KMINT NUMBER(10), + DATAACHI DATE, + NRACHI NUMBER(16), + SERIEF VARCHAR2(20), + SERIECV VARCHAR2(20), + ANFABRICATIE NUMBER(4), + STERS NUMBER(1) default 0 not null, + INACTIV NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_MASINICLIENTI + add constraint PK_MASINICLIENT primary key (ID_MASINICLIENT) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_MASINICLIENTI + add constraint FK_FURNIZOR foreign key (ID_FURNIZOR) + references DEV_NOM_FURNIZORIMASINI (ID_FURNIZOR) + disable; +alter table DEV_MASINICLIENTI + add constraint FK_ID_PARTENER foreign key (ID_PARTENER) + references NOM_PARTENERI (ID_PART) + disable; +alter table DEV_MASINICLIENTI + add constraint FK_MASINA foreign key (ID_MASINA) + references DEV_NOM_MASINI (ID_MASINA) + disable; +alter table DEV_MASINICLIENTI + add constraint FK_TIPMOTOR foreign key (ID_TIPMOTOR) + references DEV_TIPURI_MOTOARE (ID_TIPMOTOR) + disable; +create index IDX_MASINICLIENT_00001 on DEV_MASINICLIENTI (ID_PARTENER) + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +create index IDX_MASINICLIENT_00002 on DEV_MASINICLIENTI (ID_MASINA) + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +create index IDX_MASINICLIENT_00003 on DEV_MASINICLIENTI (ID_FURNIZOR) + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +create index IDX_MASINICLIENT_00004 on DEV_MASINICLIENTI (ID_TIPMOTOR) + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); + +prompt +prompt Creating table DEV_MECANICI +prompt =========================== +prompt +create table DEV_MECANICI +( + ID_MECANIC NUMBER(5) not null, + ID_SALARIAT NUMBER(5), + ID_SECTIE NUMBER(5), + STERS NUMBER(1) default 0 not null, + INACTIV NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_MECANICI + add constraint PK_MECANICI primary key (ID_MECANIC) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); + +prompt +prompt Creating table DEV_NOM_ANSAMBLE +prompt =============================== +prompt +create table DEV_NOM_ANSAMBLE +( + ID_ANSAMBLU NUMBER(5) not null, + DENUMIRE VARCHAR2(100), + STERS NUMBER(1) default 0 not null, + INACTIV NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_NOM_ANSAMBLE + add constraint PK_ANSAMBLE primary key (ID_ANSAMBLU) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); + +prompt +prompt Creating table DEV_NOM_ASIGURATORI +prompt ================================== +prompt +create table DEV_NOM_ASIGURATORI +( + ID_ASIGURATOR NUMBER(5) not null, + ASIGURATOR VARCHAR2(24), + STERS NUMBER(1) default 0 not null, + INACTIV NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_NOM_ASIGURATORI + add constraint PK_ASIGURATORI primary key (ID_ASIGURATOR) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); + +prompt +prompt Creating table DEV_NOM_DELEGATI +prompt =============================== +prompt +create table DEV_NOM_DELEGATI +( + ID_NOM_DELEGATI NUMBER(5) not null, + DELEGAT VARCHAR2(64), + ELIBERATDE VARCHAR2(64), + ID_PARTENER NUMBER(5) not null, + STERS NUMBER(1) default 0 not null, + INACTIV NUMBER(1) default 0 not null, + BI VARCHAR2(10) +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_NOM_DELEGATI + add constraint PK_DELEGAT primary key (ID_NOM_DELEGATI) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_NOM_DELEGATI + add constraint FK_PARTENER foreign key (ID_PARTENER) + references NOM_PARTENERI (ID_PART) + disable; + +prompt +prompt Creating table DEV_NOM_INSPECTORI +prompt ================================= +prompt +create table DEV_NOM_INSPECTORI +( + ID_INSPECTOR NUMBER(5) not null, + INSPECTOR VARCHAR2(24), + ID_ASIGURATOR NUMBER(5), + STERS NUMBER(1) default 0 not null, + INACTIV NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_NOM_INSPECTORI + add constraint PK_NOM_INSPECTORI primary key (ID_INSPECTOR) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_NOM_INSPECTORI + add constraint FK_NOM_ASIGURATORI foreign key (ID_ASIGURATOR) + references DEV_NOM_ASIGURATORI (ID_ASIGURATOR); + +prompt +prompt Creating table DEV_NOM_NORME +prompt ============================ +prompt +create table DEV_NOM_NORME +( + ID_NORME NUMBER(5) not null, + ID_ANSAMBLU NUMBER(5), + ID_MASINA NUMBER(5), + DENOP VARCHAR2(100), + CODOP VARCHAR2(10), + TIMPN NUMBER(7,3), + STERS NUMBER(1) default 0 not null, + INACTIV NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_NOM_NORME + add constraint PK_NORME primary key (ID_NORME) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_NOM_NORME + add constraint FK_ANSAMBLE foreign key (ID_ANSAMBLU) + references DEV_NOM_ANSAMBLE (ID_ANSAMBLU); + +prompt +prompt Creating table DEV_NOM_PRETURI +prompt ============================== +prompt +create table DEV_NOM_PRETURI +( + ID_PRET NUMBER(5) not null, + ID_MARCA NUMBER(5), + ID_ASIGURATORI NUMBER(5), + PRET NUMBER(18,4), + PRET_VAL NUMBER(10,4), + ID_VALUTA NUMBER(5), + CURS NUMBER(12,4), + STERS NUMBER(1) default 0 not null, + INACTIV NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_NOM_PRETURI + add constraint PK_PRETURI primary key (ID_PRET) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_NOM_PRETURI + add constraint FK_ASIGURATOR foreign key (ID_ASIGURATORI) + references DEV_NOM_ASIGURATORI (ID_ASIGURATOR); +alter table DEV_NOM_PRETURI + add constraint FK_MARCA1 foreign key (ID_MARCA) + references DEV_NOM_MARCI (ID_MARCA); + +prompt +prompt Creating table DEV_NOM_RESP +prompt =========================== +prompt +create table DEV_NOM_RESP +( + ID_RESP NUMBER(5) not null, + NUME VARCHAR2(24) not null, + BI VARCHAR2(10), + CNPRESP VARCHAR2(13), + ALES NUMBER(1) default 0 not null, + STERS NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_NOM_RESP + add constraint PK_RESP primary key (ID_RESP) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); + +prompt +prompt Creating table DEV_ORDL +prompt ======================= +prompt +create table DEV_ORDL +( + ID_ORDL NUMBER(10) not null, + LUNA NUMBER(2) default 0 not null, + AN NUMBER(4) default 0 not null, + ID_INSPECTOR NUMBER(5) default 0 not null, + ID_LUCRARE NUMBER(10) not null, + TERMEN DATE, + DATAI DATE, + ORAI NUMBER(5), + DATAE DATE, + ORAE NUMBER(5), + VALIDAT NUMBER(1) default 0 not null, + TIP_INCAS VARCHAR2(24), + ID_UTIL_AD NUMBER(5) default 0 not null, + ID_UTIL_VALID NUMBER(5) default 0 not null, + DATAORAAD DATE, + DATAORAVALID DATE, + ID_UTILS NUMBER(5) default 0 not null, + DATAORAS DATE, + ID_FACT NUMBER(10) default 0 not null, + ID_MASINICLIENT NUMBER(5) default 0 not null, + ID_ASIGURATOR NUMBER(5) default 0 not null, + ID_CONTRACT NUMBER(5) default 0 not null, + AVANS NUMBER(17,4), + STERS NUMBER(1) default 0 not null, + VALCTVA NUMBER(17,4) default 0 not null, + ID_TIP NUMBER(5) default 1 not null, + INCHIS_FORTAT NUMBER(1) default 0 not null, + KMINT NUMBER(10) +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_ORDL + add constraint PK_ORDL primary key (ID_ORDL) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_ORDL + add constraint FK_LUCR foreign key (ID_LUCRARE) + references NOM_LUCRARI (ID_LUCRARE) + disable; +create index IDX_ORDL_00001 on DEV_ORDL (ID_LUCRARE) + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +create index IDX_ORDL_00002 on DEV_ORDL (ID_INSPECTOR) + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +create index IDX_ORDL_00003 on DEV_ORDL (DATAORAVALID) + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); + +prompt +prompt Creating table DEV_OPER +prompt ======================= +prompt +create table DEV_OPER +( + ID_OPER NUMBER(10) not null, + ID_ORDL NUMBER(10) not null, + ID_NORME NUMBER(10) not null, + ID_FACT NUMBER(10), + TIMPN NUMBER(8,3) default 0 not null, + PRET NUMBER(17,4) default 0 not null, + DATAI DATE default sysdate not null, + ID_SECTIE NUMBER(5), + ID_UTIL NUMBER(5), + DATAORA DATE, + ID_UTILS NUMBER(5), + DATAORAS DATE, + STERS NUMBER(1) default 0 not null, + VALIDAT NUMBER(1) default 0 not null, + NOU NUMBER(1) default 0 not null, + ID_UTILI NUMBER(5), + DATAI_ORIG DATE, + DATAORA_ORIG DATE +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_OPER + add constraint PK_OPER primary key (ID_OPER) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_OPER + add constraint FK_NORME foreign key (ID_NORME) + references DEV_NOM_NORME (ID_NORME); +alter table DEV_OPER + add constraint FK_ORDL foreign key (ID_ORDL) + references DEV_ORDL (ID_ORDL); + +prompt +prompt Creating table DEV_OPER_MECANICI +prompt ================================ +prompt +create table DEV_OPER_MECANICI +( + ID_OPERMECANIC NUMBER(10) not null, + ID_MECANIC NUMBER(5), + ID_OPER NUMBER(10), + ORE NUMBER(8,3), + STERS NUMBER(1) default 0 not null, + INACTIV NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_OPER_MECANICI + add constraint PK_DEV_OPER_MECANICI primary key (ID_OPERMECANIC) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); + +prompt +prompt Creating table DEV_TIP_DEVIZ +prompt ============================ +prompt +create table DEV_TIP_DEVIZ +( + ID_TIP NUMBER(5) not null, + DENUMIRE VARCHAR2(50) not null, + STERS NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); +alter table DEV_TIP_DEVIZ + add constraint PK_TIP_DEVIZ primary key (ID_TIP) + using index + tablespace ROA + pctfree 10 + initrans 2 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); + + +spool off diff --git a/Scripturi_instalare/tabele_nefolosite.sql b/Scripturi_instalare/tabele_nefolosite.sql new file mode 100644 index 0000000..198bff7 --- /dev/null +++ b/Scripturi_instalare/tabele_nefolosite.sql @@ -0,0 +1,84 @@ +-------------------------------------------------------- +-- Tabele nefolosite in ROAAUTO versiunea 1.4.151 -- +-- Created by marius.atanasiu on 2/2/2006, 9:42:17 AM -- +-------------------------------------------------------- + +spool tabele.log + +prompt +prompt Creating table DEV_CONTRACTE +prompt ============================ +prompt +create table DEV_CONTRACTE +( + ID_CONTRACT NUMBER(5) not null, + NUMAR VARCHAR2(10), + DATA DATE, + ID_PARTENER NUMBER(5), + STERS NUMBER(1) default 0 not null, + INACTIV NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); + +prompt +prompt Creating table DEV_FACTURI +prompt ========================== +prompt +create table DEV_FACTURI +( + ID_LUCRARE NUMBER(10) not null, + NRFACT NUMBER(10) default 0 not null, + DATAFACT DATE, + ID_UTILAD NUMBER(10) default 0 not null, + ID_UTILSTERG NUMBER(10) default 0 not null, + DATAAD DATE, + DATASTERG DATE, + VALCTVA NUMBER(17,4) default 0 not null, + TVA NUMBER(17,4) default 0 not null, + STERS NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); + +prompt +prompt Creating table DEV_REVIZII +prompt ========================== +prompt +create table DEV_REVIZII +( + ID_REVIZIE NUMBER(5) not null, + ID_MASINICLIENTI NUMBER(5), + CODSERV VARCHAR2(10), + DATASERV DATE, + KM NUMBER(10), + STERS NUMBER(1) default 0 not null +) +tablespace ROA + pctfree 10 + initrans 1 + maxtrans 255 + storage + ( + initial 64K + minextents 1 + maxextents unlimited + ); + +spool off diff --git a/Scripturi_instalare/triggere.sql b/Scripturi_instalare/triggere.sql new file mode 100644 index 0000000..ecf9b32 --- /dev/null +++ b/Scripturi_instalare/triggere.sql @@ -0,0 +1,1697 @@ +-------------------------------------------------------- +-- Triggere pentru ROAAUTO v 1.4.151 -- +-- Created by marius.atanasiu on 2/2/2006, 9:53:06 AM -- +-------------------------------------------------------- + +spool triggere.log + +prompt +prompt Creating trigger TRG_DEV_ASIGURATORI_BEFOINS +prompt ============================================ +prompt +create or replace trigger TRG_DEV_ASIGURATORI_BEFOINS + before insert on dev_nom_asiguratori + for each row + -- local variables here +begin + select SEQ_dev_nom_asiguratori.NEXTVAL into :new.id_asigurator from dual; +end TRG_DEV_ASIGURATORI_BEFOINS; +/ + +prompt +prompt Creating trigger TRG_DEV_FURNIZORI +prompt ================================== +prompt +create or replace trigger TRG_DEV_FURNIZORI + before insert on dev_nom_furnizorimasini + for each row +declare + -- local variables here +begin + select SEQ_dev_nom_FURNIZORIMASINI.NEXTVAL into :new.id_FURNIZOR from dual; +end TRG_DEV_FURNIZORI; +/ + +prompt +prompt Creating trigger TRG_DEV_MASINICLIENT_BEFOUPD +prompt ============================================= +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_MASINICLIENT_BEFOUPD +BEFORE UPDATE ON DEV_MASINICLIENTI +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + +if :old.ID_MASINICLIENT <> :new.ID_MASINICLIENT then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'ID_MASINICLIENT','N', :OLD.ID_MASINICLIENT, :NEW.ID_MASINICLIENT, PACK_SESIUNE.get_id_util() ) ; +end if; + +if :old.ID_TIPMOTOR <> :new.ID_TIPMOTOR then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'ID_TIPMOTOR','N', :OLD.ID_TIPMOTOR, :NEW.ID_TIPMOTOR, PACK_SESIUNE.get_id_util() ) ; +end if; + +if :old.ID_FURNIZOR <> :new.ID_FURNIZOR then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'ID_FURNIZOR','N', :OLD.ID_FURNIZOR, :NEW.ID_FURNIZOR, PACK_SESIUNE.get_id_util() ) ; +end if; + +if :old.ID_MASINA <> :new.ID_MASINA then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'ID_MASINA','N', :OLD.ID_MASINA, :NEW.ID_MASINA, PACK_SESIUNE.get_id_util()) ; +end if; + +if :old.ID_PARTENER <> :new.ID_PARTENER then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'ID_PARTENER','N', :OLD.ID_PARTENER, :NEW.ID_PARTENER, PACK_SESIUNE.get_id_util() ) ; +end if; + +if :old.NRINMAT <> :new.NRINMAT then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'NRINMAT','C', :OLD.NRINMAT, :NEW.NRINMAT, PACK_SESIUNE.get_id_util() ) ; +end if; + +if :old.SERIES <> :new.SERIES then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'SERIES','C', :OLD.SERIES, :NEW.SERIES, PACK_SESIUNE.get_id_util() ) ; +end if; + +if :old.SERIEM <> :new.SERIEM then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'SERIEM','C', :OLD.SERIEM, :NEW.SERIEM, PACK_SESIUNE.get_id_util() ) ; +end if; + +if :old.CULOARE <> :new.CULOARE then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'CULOARE','C', :OLD.CULOARE, :NEW.CULOARE, PACK_SESIUNE.GET_ID_UTIL() ) ; +end if; + +if :old.KMINT <> :new.KMINT then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'KMINT','N', :OLD.KMINT, :NEW.KMINT, PACK_SESIUNE.GET_ID_UTIL() ) ; +end if; + +if :old.DATAACHI <> :new.DATAACHI then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'DATAACHI','D', :OLD.DATAACHI, :NEW.DATAACHI, PACK_SESIUNE.GET_ID_UTIL() ) ; +end if; + +if :old.NRACHI <> :new.NRACHI then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'NRACHI','N', :OLD.NRACHI, :NEW.NRACHI, PACK_SESIUNE.GET_ID_UTIL() ) ; +end if; + +if :old.SERIEF <> :new.SERIEF then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'SERIEF','C', :OLD.SERIEF, :NEW.SERIEF, PACK_SESIUNE.GET_ID_UTIL() ) ; +end if; + +if :old.SERIECV <> :new.SERIECV then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'SERIECV','C', :OLD.SERIECV, :NEW.SERIECV, PACK_SESIUNE.GET_ID_UTIL() ) ; +end if; + +if :old.ANFABRICATIE <> :new.ANFABRICATIE then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'ANFABRICATIE','N', :OLD.ANFABRICATIE, :NEW.ANFABRICATIE, PACK_SESIUNE.GET_ID_UTIL() ) ; +end if; + +if :old.STERS <> :new.STERS then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL() ) ; +end if; + +if :old.INACTIV <> :new.INACTIV then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_masiniclienti', :OLD.id_masiniclient,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL() ) ; +end if; + +end; +/ + +prompt +prompt Creating trigger TRG_DEV_MASINICLIENTI_BEFOINS +prompt ============================================== +prompt +create or replace trigger TRG_dev_masiniclienti_BEFOINS +before insert on dev_masiniclienti +referencing old as old new as new +for each row +begin +select SEQ_dev_masiniclienti.NEXTVAL into :new.id_masiniclient from dual; +end; +/ + +prompt +prompt Creating trigger TRG_DEV_MECANICI_BEFOINS +prompt ========================================= +prompt +create or replace trigger TRG_dev_mecanici_BEFOINS +before insert on dev_mecanici +referencing old as old new as new +for each row +begin +select SEQ_dev_mecanici.NEXTVAL into :new.id_mecanic from dual; +end; +/ + +prompt +prompt Creating trigger TRG_DEV_MECANICI_BEFOUPD +prompt ========================================= +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_MECANICI_BEFOUPD +BEFORE UPDATE ON DEV_MECANICI +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + +if :old.ID_MECANIC <> :new.ID_MECANIC then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_mecanici', :OLD.id_mecanic,'ID_MECANIC','N', :OLD.ID_MECANIC, :NEW.ID_MECANIC, PACK_SESIUNE.GET_ID_UTIL() ) ; +end if; + +if :old.ID_SALARIAT <> :new.ID_SALARIAT then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_mecanici', :OLD.id_mecanic,'ID_SALARIAT','N', :OLD.ID_SALARIAT, :NEW.ID_SALARIAT, PACK_SESIUNE.GET_ID_UTIL() ) ; +end if; + +if :old.ID_SECTIE <> :new.ID_SECTIE then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_mecanici', :OLD.id_mecanic,'ID_SECTIE','N', :OLD.ID_SECTIE, :NEW.ID_SECTIE, PACK_SESIUNE.GET_ID_UTIL() ) ; +end if; + +if :old.STERS <> :new.STERS then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_mecanici', :OLD.id_mecanic,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL() ) ; +end if; + +if :old.INACTIV <> :new.INACTIV then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_mecanici', :OLD.id_mecanic,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL() ) ; +end if; + +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_ANSAMBLE_BEFOINS +prompt ============================================= +prompt +create or replace trigger TRG_dev_nom_ansamble_BEFOINS +before insert on dev_nom_ansamble +referencing old as old new as new +for each row +begin +select SEQ_dev_nom_ansamble.NEXTVAL into :new.id_ansamblu from dual; +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_ANSAMBLE_BEFOUPD +prompt ============================================= +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_NOM_ANSAMBLE_BEFOUPD +BEFORE UPDATE ON DEV_NOM_ANSAMBLE +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + +if :old.STERS <> :new.STERS then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_ansamble', :OLD.id_ansamblu,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.INACTIV <> :new.INACTIV then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_ansamble', :OLD.id_ansamblu,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_ANSAMBLU <> :new.ID_ANSAMBLU then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_ansamble', :OLD.id_ansamblu,'ID_ANSAMBLU','N', :OLD.ID_ANSAMBLU, :NEW.ID_ANSAMBLU, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.DENUMIRE <> :new.DENUMIRE then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_ansamble', :OLD.id_ansamblu,'DENUMIRE','C', :OLD.DENUMIRE, :NEW.DENUMIRE, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_ASIGURAT_BEFOUPD +prompt ============================================= +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_NOM_ASIGURAT_BEFOUPD +BEFORE UPDATE ON DEV_NOM_ASIGURATORI +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + +if :old.STERS <> :new.STERS then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_asiguratori', :OLD.id_asigurator,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.INACTIV <> :new.INACTIV then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_asiguratori', :OLD.id_asigurator,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_ASIGURATOR <> :new.ID_ASIGURATOR then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_asiguratori', :OLD.id_asigurator,'ID_ASIGURATOR','N', :OLD.ID_ASIGURATOR, :NEW.ID_ASIGURATOR, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ASIGURATOR <> :new.ASIGURATOR then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_asiguratori', :OLD.id_asigurator,'ASIGURATOR','C', :OLD.ASIGURATOR, :NEW.ASIGURATOR, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_DELEGATI_BEFOINS +prompt ============================================= +prompt +create or replace trigger TRG_dev_nom_delegati_BEFOINS +before insert on dev_nom_delegati +referencing old as old new as new +for each row +begin +select SEQ_dev_nom_delegati.NEXTVAL into :new.id_nom_delegati from dual; +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_DELEGATI_BEFOUPD +prompt ============================================= +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_NOM_DELEGATI_BEFOUPD +BEFORE UPDATE ON DEV_NOM_DELEGATI +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + +if :old.STERS <> :new.STERS then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_delegati', :OLD.id_nom_delegati,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.INACTIV <> :new.INACTIV then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_delegati', :OLD.id_nom_delegati,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_NOM_DELEGATI <> :new.ID_NOM_DELEGATI then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_delegati', :OLD.id_nom_delegati,'ID_NOM_DELEGATI','N', :OLD.ID_NOM_DELEGATI, :NEW.ID_NOM_DELEGATI, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.DELEGAT <> :new.DELEGAT then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_delegati', :OLD.id_nom_delegati,'DELEGAT','C', :OLD.DELEGAT, :NEW.DELEGAT, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ELIBERATDE <> :new.ELIBERATDE then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_delegati', :OLD.id_nom_delegati,'ELIBERATDE','C', :OLD.ELIBERATDE, :NEW.ELIBERATDE, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_PARTENER <> :new.ID_PARTENER then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_delegati', :OLD.id_nom_delegati,'ID_PARTENER','N', :OLD.ID_PARTENER, :NEW.ID_PARTENER, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.BI <> :new.BI then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_delegati', :OLD.id_nom_delegati,'BI','C', :OLD.BI, :NEW.BI, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_FURNIZOR_BEFOUPD +prompt ============================================= +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_NOM_FURNIZOR_BEFOUPD +BEFORE UPDATE ON DEV_NOM_FURNIZORIMASINI +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + +if :old.ID_FURNIZOR <> :new.ID_FURNIZOR then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_furnizorimasini', :OLD.id_furnizor,'ID_FURNIZOR','N', :OLD.ID_FURNIZOR, :NEW.ID_FURNIZOR, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.DENUMIRE <> :new.DENUMIRE then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_furnizorimasini', :OLD.id_furnizor,'DENUMIRE','C', :OLD.DENUMIRE, :NEW.DENUMIRE, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.STERS <> :new.STERS then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_furnizorimasini', :OLD.id_furnizor,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.INACTIV <> :new.INACTIV then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_furnizorimasini', :OLD.id_furnizor,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_INSPECTO_BEFOUPD +prompt ============================================= +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_NOM_INSPECTO_BEFOUPD +BEFORE UPDATE ON DEV_NOM_INSPECTORI +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + +if :old.STERS <> :new.STERS then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_inspectori', :OLD.id_inspector,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.INACTIV <> :new.INACTIV then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_inspectori', :OLD.id_inspector,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_INSPECTOR <> :new.ID_INSPECTOR then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_inspectori', :OLD.id_inspector,'ID_INSPECTOR','N', :OLD.ID_INSPECTOR, :NEW.ID_INSPECTOR, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.INSPECTOR <> :new.INSPECTOR then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_inspectori', :OLD.id_inspector,'INSPECTOR','C', :OLD.INSPECTOR, :NEW.INSPECTOR, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_ASIGURATOR <> :new.ID_ASIGURATOR then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_inspectori', :OLD.id_inspector,'ID_ASIGURATOR','N', :OLD.ID_ASIGURATOR, :NEW.ID_ASIGURATOR, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_INSPECTORI_BEFOINS +prompt =============================================== +prompt +create or replace trigger TRG_dev_nom_inspectori_BEFOINS +before insert on dev_nom_inspectori +referencing old as old new as new +for each row +begin +select SEQ_dev_nom_inspectori.NEXTVAL into :new.id_inspector from dual; +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_MARCI_BEFOINS +prompt ========================================== +prompt +create or replace trigger TRG_dev_nom_marci_BEFOINS +before insert on dev_nom_marci +referencing old as old new as new +for each row +begin +select SEQ_dev_nom_marci.NEXTVAL into :new.id_marca from dual; +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_MARCI_BEFOUPD +prompt ========================================== +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_NOM_MARCI_BEFOUPD +BEFORE UPDATE ON DEV_NOM_MARCI +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + +if :old.STERS <> :new.STERS then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_marci', :OLD.id_marca,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.INACTIV <> :new.INACTIV then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_marci', :OLD.id_marca,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_MARCA <> :new.ID_MARCA then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_marci', :OLD.id_marca,'ID_MARCA','N', :OLD.ID_MARCA, :NEW.ID_MARCA, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.MARCA <> :new.MARCA then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_marci', :OLD.id_marca,'MARCA','C', :OLD.MARCA, :NEW.MARCA, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_MASINI_BEFOINS +prompt =========================================== +prompt +create or replace trigger TRG_dev_nom_masini_BEFOINS +before insert on dev_nom_masini +referencing old as old new as new +for each row +begin +select SEQ_dev_nom_masini.NEXTVAL into :new.id_masina from dual; +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_MASINI_BEFOUPD +prompt =========================================== +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_NOM_MASINI_BEFOUPD +BEFORE UPDATE ON DEV_NOM_MASINI +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + +if :old.STERS <> :new.STERS then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_masini', :OLD.id_masina,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.INACTIV <> :new.INACTIV then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_masini', :OLD.id_masina,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_MASINA <> :new.ID_MASINA then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_masini', :OLD.id_masina,'ID_MASINA','N', :OLD.ID_MASINA, :NEW.ID_MASINA, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_MARCA <> :new.ID_MARCA then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_masini', :OLD.id_masina,'ID_MARCA','N', :OLD.ID_MARCA, :NEW.ID_MARCA, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.MASINA <> :new.MASINA then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_masini', :OLD.id_masina,'MASINA','C', :OLD.MASINA, :NEW.MASINA, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.SCTIP <> :new.SCTIP then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_masini', :OLD.id_masina,'SCTIP','C', :OLD.SCTIP, :NEW.SCTIP, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.CLASA <> :new.CLASA then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_masini', :OLD.id_masina,'CLASA','C', :OLD.CLASA, :NEW.CLASA, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_NORME_BEFOINS +prompt ========================================== +prompt +create or replace trigger TRG_dev_nom_norme_BEFOINS +before insert on dev_nom_norme +referencing old as old new as new +for each row +begin +select SEQ_dev_nom_norme.NEXTVAL into :new.id_norme from dual; +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_NORME_BEFOUPD +prompt ========================================== +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_NOM_NORME_BEFOUPD +BEFORE UPDATE ON DEV_NOM_NORME +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + +if :old.STERS <> :new.STERS then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_norme', :OLD.id_norme,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.INACTIV <> :new.INACTIV then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_norme', :OLD.id_norme,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_NORME <> :new.ID_NORME then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_norme', :OLD.id_norme,'ID_NORME','N', :OLD.ID_NORME, :NEW.ID_NORME, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_ANSAMBLU <> :new.ID_ANSAMBLU then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_norme', :OLD.id_norme,'ID_ANSAMBLU','N', :OLD.ID_ANSAMBLU, :NEW.ID_ANSAMBLU, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_MASINA <> :new.ID_MASINA then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_norme', :OLD.id_norme,'ID_MASINA','N', :OLD.ID_MASINA, :NEW.ID_MASINA, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + + +if :old.DENOP <> :new.DENOP then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_norme', :OLD.id_norme,'DENOP','C', :OLD.DENOP, :NEW.DENOP, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.CODOP <> :new.CODOP then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_norme', :OLD.id_norme,'CODOP','C', :OLD.CODOP, :NEW.CODOP, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.TIMPN <> :new.TIMPN then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_norme', :OLD.id_norme,'TIMPN','N', :OLD.TIMPN, :NEW.TIMPN, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_PRETURI_BEFOINS +prompt ============================================ +prompt +create or replace trigger TRG_dev_nom_preturi_BEFOINS +before insert on dev_nom_preturi +referencing old as old new as new +for each row +begin +select SEQ_dev_nom_preturi.NEXTVAL into :new.id_pret from dual; +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_PRETURI_BEFOUPD +prompt ============================================ +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_NOM_PRETURI_BEFOUPD +BEFORE UPDATE ON DEV_NOM_PRETURI +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + +if :old.STERS <> :new.STERS then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_preturi', :OLD.id_pret,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.INACTIV <> :new.INACTIV then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_preturi', :OLD.id_pret,'INACTIV','N', :OLD.INACTIV, :NEW.INACTIV, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_PRET <> :new.ID_PRET then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_preturi', :OLD.id_pret,'ID_PRET','N', :OLD.ID_PRET, :NEW.ID_PRET, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_MARCA <> :new.ID_MARCA then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_preturi', :OLD.id_pret,'ID_MARCA','N', :OLD.ID_MARCA, :NEW.ID_MARCA, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_ASIGURATORI <> :new.ID_ASIGURATORI then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_preturi', :OLD.id_pret,'ID_ASIGURATORI','N', :OLD.ID_ASIGURATORI, :NEW.ID_ASIGURATORI, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.PRET <> :new.PRET then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_preturi', :OLD.id_pret,'PRET','N', :OLD.PRET, :NEW.PRET, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.PRET_VAL <> :new.PRET_VAL then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_preturi', :OLD.id_pret,'PRET_VAL','N', :OLD.PRET_VAL, :NEW.PRET_VAL, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_VALUTA <> :new.ID_VALUTA then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_preturi', :OLD.id_pret,'ID_VALUTA','N', :OLD.ID_VALUTA, :NEW.ID_VALUTA, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.CURS <> :new.CURS then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_nom_preturi', :OLD.id_pret,'CURS','N', :OLD.CURS, :NEW.CURS, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_RESP_BEFOINS +prompt ========================================= +prompt +create or replace trigger TRG_DEV_NOM_RESP_BEFOINS +before insert on DEV_NOM_RESP +referencing old as old new as new +for each row +begin +select SEQ_DEV_NOM_RESP.NEXTVAL into :new.ID_RESP from dual; +end; +/ + +prompt +prompt Creating trigger TRG_DEV_NOM_RESP_BEFOUPD +prompt ========================================= +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_NOM_RESP_BEFOUPD +BEFORE UPDATE ON DEV_NOM_RESP +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + + if :old.ID_RESP <> :new.ID_RESP then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('DEV_NOM_RESP', + :OLD.ID_RESP, + 'ID_RESP', + 'N', + :OLD.ID_RESP, + :NEW.ID_RESP, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.NUME <> :new.NUME then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('DEV_NOM_RESP', + :OLD.ID_RESP, + 'NUME', + 'C', + :OLD.NUME, + :NEW.NUME, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.BI <> :new.BI then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('DEV_NOM_RESP', + :OLD.ID_RESP, + 'BI', + 'C', + :OLD.BI, + :NEW.BI, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.CNPRESP <> :new.CNPRESP then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('DEV_NOM_RESP', + :OLD.ID_RESP, + 'CNPRESP', + 'C', + :OLD.CNPRESP, + :NEW.CNPRESP, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ALES <> :new.ALES then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('DEV_NOM_RESP', + :OLD.ID_RESP, + 'ALES', + 'N', + :OLD.ALES, + :NEW.ALES, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.STERS <> :new.STERS then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('DEV_NOM_RESP', + :OLD.ID_RESP, + 'STERS', + 'N', + :OLD.STERS, + :NEW.STERS, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + +end; +/ + +prompt +prompt Creating trigger TRG_DEV_OPER_BEFOINS +prompt ===================================== +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_OPER_BEFOINS +BEFORE INSERT ON DEV_OPER +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + select SEQ_dev_oper.NEXTVAL into :new.id_oper from dual; + pack_sesiune.dev_idOper := :new.id_oper; +end; +/ + +prompt +prompt Creating trigger TRG_DEV_OPER_BEFOUPD +prompt ===================================== +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_OPER_BEFOUPD +BEFORE UPDATE ON DEV_OPER +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + +if :old.ID_OPER <> :new.ID_OPER then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_oper', :OLD.id_oper,'ID_OPER','N', :OLD.ID_OPER, :NEW.ID_OPER, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_ORDL <> :new.ID_ORDL then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_oper', :OLD.id_oper,'ID_ORDL','N', :OLD.ID_ORDL, :NEW.ID_ORDL, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_NORME <> :new.ID_NORME then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_oper', :OLD.id_oper,'ID_NORME','N', :OLD.ID_NORME, :NEW.ID_NORME, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_FACT <> :new.ID_FACT then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_oper', :OLD.id_oper,'ID_FACT','N', :OLD.ID_FACT, :NEW.ID_FACT, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.TIMPN <> :new.TIMPN then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_oper', :OLD.id_oper,'TIMPN','N', :OLD.TIMPN, :NEW.TIMPN, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.PRET <> :new.PRET then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_oper', :OLD.id_oper,'PRET','N', :OLD.PRET, :NEW.PRET, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.DATAI <> :new.DATAI then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_oper', :OLD.id_oper,'DATAI','D', :OLD.DATAI, :NEW.DATAI, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_SECTIE <> :new.ID_SECTIE then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_oper', :OLD.id_oper,'ID_SECTIE','N', :OLD.ID_SECTIE, :NEW.ID_SECTIE, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_UTIL <> :new.ID_UTIL then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_oper', :OLD.id_oper,'ID_UTIL','N', :OLD.ID_UTIL, :NEW.ID_UTIL, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.DATAORA <> :new.DATAORA then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_oper', :OLD.id_oper,'DATAORA','D', :OLD.DATAORA, :NEW.DATAORA, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.id_UTILS <> :new.id_UTILS then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_oper', :OLD.id_oper,'ID_UTILS','N', :OLD.id_UTILS, :NEW.id_UTILS, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.DATAORAS <> :new.DATAORAS then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_oper', :OLD.id_oper,'DATAORAS','D', :OLD.DATAORAS, :NEW.DATAORAS, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.STERS <> :new.STERS then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_oper', :OLD.id_oper,'STERS','N', :OLD.STERS, :NEW.STERS, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.VALIDAT <> :new.VALIDAT then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_oper', :OLD.id_oper,'STERS','N', :OLD.VALIDAT, :NEW.VALIDAT, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.NOU <> :new.NOU then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_oper', :OLD.id_oper,'NOU','N', :OLD.NOU, :NEW.NOU, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +if :old.ID_UTILI <> :new.ID_UTILI then + INSERT INTO LOG +(tabel, id_tabel, camp, tip_camp, valoarev, valoaren,id_util) +values +('dev_oper', :OLD.id_oper,'ID_UTILI','N', :OLD.ID_UTILI, :NEW.ID_UTILI, PACK_SESIUNE.GET_ID_UTIL()) ; +end if; + +end; +/ + +prompt +prompt Creating trigger TRG_DEV_OPER_MECANIC_BEFOUPD +prompt ============================================= +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_OPER_MECANIC_BEFOUPD +BEFORE UPDATE ON DEV_OPER_MECANICI +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + + if :old.ID_OPERMECANIC <> :new.ID_OPERMECANIC then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('DEV_OPER_MECANICI', + :OLD.ID_OPERMECANIC, + 'ID_OPERMECANIC', + 'N', + :OLD.ID_OPERMECANIC, + :NEW.ID_OPERMECANIC, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ID_MECANIC <> :new.ID_MECANIC then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('DEV_OPER_MECANICI', + :OLD.ID_OPERMECANIC, + 'ID_MECANIC', + 'N', + :OLD.ID_MECANIC, + :NEW.ID_MECANIC, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ID_OPER <> :new.ID_OPER then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('DEV_OPER_MECANICI', + :OLD.ID_OPERMECANIC, + 'ID_OPER', + 'N', + :OLD.ID_OPER, + :NEW.ID_OPER, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ORE <> :new.ORE then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('DEV_OPER_MECANICI', + :OLD.ID_OPERMECANIC, + 'ORE', + 'N', + :OLD.ORE, + :NEW.ORE, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.STERS <> :new.STERS then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('DEV_OPER_MECANICI', + :OLD.ID_OPERMECANIC, + 'STERS', + 'N', + :OLD.STERS, + :NEW.STERS, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.INACTIV <> :new.INACTIV then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('DEV_OPER_MECANICI', + :OLD.ID_OPERMECANIC, + 'INACTIV', + 'N', + :OLD.INACTIV, + :NEW.INACTIV, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + +end; +/ + +prompt +prompt Creating trigger TRG_DEV_OPER_MECANICI_BEFOINS +prompt ============================================== +prompt +create or replace trigger TRG_DEV_OPER_MECANICI_BEFOINS +before insert on DEV_OPER_MECANICI +referencing old as old new as new +for each row +begin +select SEQ_DEV_OPER_MECANICI.NEXTVAL into :new.ID_OPERMECANIC from dual; +end; +/ + +prompt +prompt Creating trigger TRG_DEV_ORDL_BEFOINS +prompt ===================================== +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_ORDL_BEFOINS +BEFORE INSERT ON DEV_ORDL +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + select SEQ_DEV_ORDL.NEXTVAL into :new.ID_ORDL from dual; + pack_sesiune.dev_idOrdl := :new.id_ordl; +end; +/ + +prompt +prompt Creating trigger TRG_DEV_ORDL_BEFOUPD +prompt ===================================== +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_ORDL_BEFOUPD +BEFORE UPDATE ON DEV_ORDL +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + + if :old.ID_ORDL <> :new.ID_ORDL then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'ID_ORDL', + 'N', + :OLD.ID_ORDL, + :NEW.ID_ORDL, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.LUNA <> :new.LUNA then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'LUNA', + 'N', + :OLD.LUNA, + :NEW.LUNA, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.AN <> :new.AN then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'AN', + 'N', + :OLD.AN, + :NEW.AN, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ID_INSPECTOR <> :new.ID_INSPECTOR then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'ID_INSPECTOR', + 'N', + :OLD.ID_INSPECTOR, + :NEW.ID_INSPECTOR, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ID_LUCRARE <> :new.ID_LUCRARE then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'ID_LUCRARE', + 'N', + :OLD.ID_LUCRARE, + :NEW.ID_LUCRARE, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.TERMEN <> :new.TERMEN then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'TERMEN', + 'D', + :OLD.TERMEN, + :NEW.TERMEN, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.DATAI <> :new.DATAI then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'DATAI', + 'D', + :OLD.DATAI, + :NEW.DATAI, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ORAI <> :new.ORAI then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'ORAI', + 'N', + :OLD.ORAI, + :NEW.ORAI, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.DATAE <> :new.DATAE then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'DATAE', + 'D', + :OLD.DATAE, + :NEW.DATAE, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ORAE <> :new.ORAE then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'ORAE', + 'N', + :OLD.ORAE, + :NEW.ORAE, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.VALIDAT <> :new.VALIDAT then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'VALIDAT', + 'N', + :OLD.VALIDAT, + :NEW.VALIDAT, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.TIP_INCAS <> :new.TIP_INCAS then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'TIP_INCAS', + 'C', + :OLD.TIP_INCAS, + :NEW.TIP_INCAS, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ID_UTIL_AD <> :new.ID_UTIL_AD then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'ID_UTIL_AD', + 'N', + :OLD.ID_UTIL_AD, + :NEW.ID_UTIL_AD, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ID_UTIL_VALID <> :new.ID_UTIL_VALID then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'ID_UTIL_VALID', + 'N', + :OLD.ID_UTIL_VALID, + :NEW.ID_UTIL_VALID, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.DATAORAAD <> :new.DATAORAAD then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'DATAORAAD', + 'D', + :OLD.DATAORAAD, + :NEW.DATAORAAD, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.DATAORAVALID <> :new.DATAORAVALID then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'DATAORAVALID', + 'D', + :OLD.DATAORAVALID, + :NEW.DATAORAVALID, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ID_UTILS <> :new.ID_UTILS then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'ID_UTILS', + 'N', + :OLD.ID_UTILS, + :NEW.ID_UTILS, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.DATAORAS <> :new.DATAORAS then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'DATAORAS', + 'D', + :OLD.DATAORAS, + :NEW.DATAORAS, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ID_FACT <> :new.ID_FACT then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'ID_FACT', + 'N', + :OLD.ID_FACT, + :NEW.ID_FACT, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ID_MASINICLIENT <> :new.ID_MASINICLIENT then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'ID_MASINICLIENT', + 'N', + :OLD.ID_MASINICLIENT, + :NEW.ID_MASINICLIENT, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ID_ASIGURATOR <> :new.ID_ASIGURATOR then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'ID_ASIGURATOR', + 'N', + :OLD.ID_ASIGURATOR, + :NEW.ID_ASIGURATOR, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ID_CONTRACT <> :new.ID_CONTRACT then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'ID_CONTRACT', + 'N', + :OLD.ID_CONTRACT, + :NEW.ID_CONTRACT, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.AVANS <> :new.AVANS then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'AVANS', + 'N', + :OLD.AVANS, + :NEW.AVANS, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.STERS <> :new.STERS then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'STERS', + 'N', + :OLD.STERS, + :NEW.STERS, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.VALCTVA <> :new.VALCTVA then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'VALCTVA', + 'N', + :OLD.VALCTVA, + :NEW.VALCTVA, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ID_TIP <> :new.ID_TIP then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'ID_TIP', + 'N', + :OLD.ID_TIP, + :NEW.ID_TIP, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.INCHIS_FORTAT <> :new.INCHIS_FORTAT then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'INCHIS_FORTAT', + 'N', + :OLD.INCHIS_FORTAT, + :NEW.INCHIS_FORTAT, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.KMINT <> :new.KMINT then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_ordl', + :OLD.id_ordl, + 'KMINT', + 'N', + :OLD.KMINT, + :NEW.KMINT, + PACK_SESIUNE.GET_ID_UTIL()); + end if; +end; +/ + +prompt +prompt Creating trigger TRG_DEV_TIP_DEVIZ +prompt ================================== +prompt +create or replace trigger TRG_DEV_TIP_DEVIZ +before insert on DEV_TIP_DEVIZ +referencing old as old new as new +for each row +begin +select SEQ_DEV_TIP_DEVIZ.NEXTVAL into :new.ID_TIP from dual; +end; +/ + +prompt +prompt Creating trigger TRG_DEV_TIP_DEVIZ_BEFOUPD +prompt ========================================== +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_TIP_DEVIZ_BEFOUPD + BEFORE UPDATE ON DEV_TIP_DEVIZ + REFERENCING OLD AS OLD NEW AS NEW + FOR EACH ROW +begin + + if :old.ID_TIP <> :new.ID_TIP then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('DEV_TIP_DEVIZ', + :OLD.ID_TIP, + 'ID_TIP', + 'N', + :OLD.ID_TIP, + :NEW.ID_TIP, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.DENUMIRE <> :new.DENUMIRE then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + + values + ('DEV_TIP_DEVIZ', + :OLD.ID_TIP, + 'DENUMIRE', + 'C', + :OLD.DENUMIRE, + :NEW.DENUMIRE, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.STERS <> :new.STERS then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + + ('DEV_TIP_DEVIZ', + :OLD.ID_TIP, + 'STERS', + 'N', + :OLD.STERS, + :NEW.STERS, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + +end; +/ + +prompt +prompt Creating trigger TRG_DEV_TIPURI_MOTOA_BEFOUPD +prompt ============================================= +prompt +CREATE OR REPLACE TRIGGER TRG_DEV_TIPURI_MOTOA_BEFOUPD +BEFORE UPDATE ON DEV_TIPURI_MOTOARE +REFERENCING OLD AS OLD NEW AS NEW +FOR EACH ROW +begin + + if :old.DENUMIRE <> :new.DENUMIRE then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_tipuri_motoare', + :OLD.id_tipmotor, + 'DENUMIRE', + 'C', + :OLD.DENUMIRE, + :NEW.DENUMIRE, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.STERS <> :new.STERS then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_tipuri_motoare', + :OLD.id_tipmotor, + 'STERS', + 'N', + :OLD.STERS, + :NEW.STERS, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.INACTIV <> :new.INACTIV then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_tipuri_motoare', + :OLD.id_tipmotor, + 'INACTIV', + 'N', + :OLD.INACTIV, + :NEW.INACTIV, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + + if :old.ID_TIPMOTOR <> :new.ID_TIPMOTOR then + INSERT INTO LOG + (tabel, id_tabel, camp, tip_camp, valoarev, valoaren, id_util) + values + ('dev_tipuri_motoare', + :OLD.id_tipmotor, + 'ID_TIPMOTOR', + 'N', + :OLD.ID_TIPMOTOR, + :NEW.ID_TIPMOTOR, + PACK_SESIUNE.GET_ID_UTIL()); + end if; + +end; +/ + +prompt +prompt Creating trigger TRG_DEV_TIPURI_MOTOARE_BEFOINS +prompt =============================================== +prompt +create or replace trigger TRG_dev_tipuri_motoare_BEFOINS +before insert on dev_tipuri_motoare +referencing old as old new as new +for each row +begin +select SEQ_dev_tipuri_motoare.NEXTVAL into :new.id_tipmotor from dual; +end; +/ + + +spool off diff --git a/Scripturi_instalare/viewuri.sql b/Scripturi_instalare/viewuri.sql new file mode 100644 index 0000000..6d06cd5 --- /dev/null +++ b/Scripturi_instalare/viewuri.sql @@ -0,0 +1,917 @@ +-------------------------------------------------------- +-- View-uri pentru ROAAUTO v 1.4.151 -- +-- Created by marius.atanasiu on 2/2/2006, 9:43:41 AM -- +-------------------------------------------------------- + +spool viewuri.log + +prompt +prompt Creating view DEV_VORDL_FACTURATE +prompt ================================= +prompt +create or replace view dev_vordl_facturate as +select distinct b.id_lucrare, + max(b.dataact) keep(dense_rank first order by b.id_set desc) over(partition by b.id_lucrare) as dataact, + max(b.nract) keep(dense_rank first order by b.id_set desc, b.dataact desc) over(partition by b.id_lucrare) as nract, + max(case + when b.id_set in (31003, 31004, 31005, 31011, 31012) then + 1 + else + 0 + end) over(partition by b.id_lucrare) as facturat + from mv_ordl_sume_act b + where extract(month from b.dataact) + extract(year from b.dataact) * 12 <= + pack_sesiune.getluna() + + pack_sesiune.getAn() * 12 +/ + +prompt +prompt Creating view DEV_VORDL_FACTURI +prompt =============================== +prompt +create or replace view dev_vordl_facturi as +select a.id_lucrare, + (case + when pack_sesiune.getAn() * 12 + + pack_sesiune.getLuna() >= + pack_sesiune.GET_ANRON() * 12 + + pack_sesiune.GET_LUNARON() then + NVL(b.manopera_ron + b.materiale_ron + b.tva_ron, -1.000) + else + NVL(b.manopera_rol + b.materiale_rol + b.tva_rol, -1.000) + end) as valctva, + a.dataact, + a.nract, + a.facturat + from dev_vordl_facturate a + left join mv_ordl_sume_act b on a.nract = b.nract + and a.id_lucrare = b.id_lucrare + and a.dataact = b.dataact +/ + +prompt +prompt Creating view DEV_COMENZI_VALIDATE +prompt ================================== +prompt +create or replace view dev_comenzi_validate as +select a.id_ordl, + a.id_lucrare, + a.id_masiniclient, + a.id_tip, + a.datai, + a.id_inspector, + a.id_asigurator, + (case + when extract(month from a.dataoravalid) + + extract(year from a.dataoravalid) * 12 <= + pack_sesiune.getluna() + + pack_sesiune.getan() * 12 then + 1 + else + 0 + end) as validat, + (case + when extract(month from a.dataoravalid) + + extract(year from a.dataoravalid) * 12 <= + pack_sesiune.getluna() + + pack_sesiune.getan() * 12 then + a.dataoravalid + else + null + end) as dataoravalid, + (case + when extract(month from a.dataoravalid) + + extract(year from a.dataoravalid) * 12 <= + pack_sesiune.getluna() + + pack_sesiune.getan() * 12 then + b.utilizator + else + null + end) as util_valid, + c.nrord + from dev_ordl a + left join syn_utilizatori b on a.id_util_valid = b.id_util + left join nom_lucrari c on a.id_lucrare = c.id_lucrare + where a.sters = 0 +/ + +prompt +prompt Creating view DEV_ISTORIC_COMENZI +prompt ================================= +prompt +create or replace view dev_istoric_comenzi as +select a.id_ordl, + a.id_lucrare, + a.id_masiniclient, + a.id_tip, + a.datai, + nvl(a.validat, 0) as validat, + a.dataoravalid, + a.util_valid, + a.nrord, + nvl(c.facturat, 0) as facturat, + c.dataact as datafact, + nvl(c.nract, 0) as nrfact, + d.id_partener, + d.nrinmat, + b.masina, + b1.marca, + e.nume, + g.asigurator, + h.inspector, + i.denumire as tip_comanda + from dev_comenzi_validate a + left join dev_vordl_facturi c on a.id_lucrare = c.id_lucrare + left join dev_masiniclienti d on a.id_masiniclient = d.id_masiniclient + left join dev_nom_masini b on d.id_masina = b.id_masina + left join dev_nom_marci b1 on b.id_marca = b1.id_marca + left join nom_parteneri e on d.id_partener = e.id_part + left join dev_nom_asiguratori g on a.id_asigurator = g.id_asigurator + left join dev_nom_inspectori h on a.id_inspector = h.id_inspector + left join dev_tip_deviz i on a.id_tip = i.id_tip +/ + +prompt +prompt Creating view DEV_ANALIZA_MANASIG +prompt ================================= +prompt +create or replace view dev_analiza_manasig as +Select 'GARANTIE' As tip, + NVL(a.asigurator, 'FARA ASIGURATOR') as asig, + last_day(to_date(a.dataoravalid)) as luna, + Nvl(Sum(round(b.timpn, 3)), 0) As timp_n + From dev_istoric_comenzi a + Left Join dev_oper b On a.id_ordl = b.id_ordl + Where a.validat = 1 + and a.id_tip = 2 + and b.sters = 0 + Group By a.asigurator, last_day(to_date(a.dataoravalid)) +Union all +Select 'REGIE' As tip, + NVL(a.asigurator, 'FARA ASIGURATOR') as asig, + last_day(to_date(a.dataoravalid)) as luna, + Nvl(Round(Sum(b.timpn), 3), 0) As timp_n + From dev_istoric_comenzi a + Left Join dev_oper b On a.id_ordl = b.id_ordl + Where a.Validat = 1 + And a.id_tip > 2 + and b.sters = 0 + Group By a.asigurator, last_day(to_date(a.dataoravalid)) +Union all +Select 'POST GARANTIE' As tip, + NVL(a.asigurator, 'FARA ASIGURATOR') as asig, + last_day(to_date(a.datafact)) as luna, + Nvl(Round(Sum(b.timpn), 3), 0) As timp_n + From dev_istoric_comenzi a + Left Join dev_oper b On a.id_ordl = b.id_ordl + Where a.facturat = 1 + and b.sters = 0 + Group By a.asigurator, last_day(to_date(a.datafact)) +/ + +prompt +prompt Creating view DEV_VORDL +prompt ======================= +prompt +create or replace view dev_vordl as +select o.*,p.nume,p.cod_fiscal,p.adresa,p.telefon,p.banca,p.cont_banca,p.reg_comert, +l.nrord, +m.nrinmat,m.series,m.seriem, +asig.asigurator, +mar.marca,mas.masina,ins.inspector,ut.utilizator as util_valid,k.denumire as tip_comanda + from dev_ordl o + left join dev_masiniclienti m on o.id_masiniclient = m.id_masiniclient + left join nom_parteneri p on m.id_partener = p.id_part + left join nom_lucrari l on o.id_lucrare = l.id_lucrare + left join dev_nom_asiguratori asig on o.id_asigurator = asig.id_asigurator + left join dev_nom_masini mas on m.id_masina = mas.id_masina + left join dev_nom_marci mar on mas.id_marca = mar.id_marca + left join dev_nom_inspectori ins on o.id_inspector = ins.id_inspector + left join dev_tip_deviz k on o.id_tip=k.id_tip + left join syn_vutilizatori ut on o.id_util_valid=ut.id_util + where o.sters = 0 +/ + +prompt +prompt Creating view DEV_DETALII_COMENZI +prompt ================================= +prompt +create or replace view dev_detalii_comenzi as +select a.id_ordl,a.validat,a.dataoravalid,a.id_tip,a.tip_comanda, +nvl(b.facturat,0) as facturat,b.dataact as datafact,nvl(b.nract,0) as nrfact +from dev_vordl a +left join dev_vordl_facturi b on a.id_lucrare=b.id_lucrare +/ + +prompt +prompt Creating view DEV_ANALIZA_SALARII +prompt ================================= +prompt +create or replace view dev_analiza_salarii as +select a.id_ordl, + a.id_tip, + (case + when pack_sesiune.getAn() * 12 + + pack_sesiune.getLuna() < + pack_sesiune.GET_ANRON() * 12 + + pack_sesiune.GET_LUNARON() then + b.pret + else + (case b.nou + when 0 then + round(b.pret / 10000, 2) + else + b.pret + end) end) as pret, + c.ore, + d.id_mecanic, + e.nume, + e.prenume + from dev_detalii_comenzi a + left join dev_oper b on a.id_ordl = b.id_ordl + left join dev_oper_mecanici c on b.id_oper = c.id_oper + left join dev_mecanici d on c.id_mecanic = d.id_mecanic + left join sal_personal e on d.id_salariat = e.id_salariat + where b.sters = 0 + and ((a.id_tip = 1 and + (a.facturat = 1 and (extract(month from a.datafact) = + pack_sesiune.getluna() and + extract(year from a.datafact) = + pack_sesiune.getan()))) or + (a.id_tip > 1 and + (a.validat = 1 and (extract(month from a.dataoravalid) = + pack_sesiune.getluna() and + extract(year from a.dataoravalid) = + pack_sesiune.getan())))) +/ + +prompt +prompt Creating view DEV_ANALIZA_SALARII_REG +prompt ===================================== +prompt +create or replace view dev_analiza_salarii_reg as +select distinct id_mecanic,nume||' '||prenume as nume, +sum(case when id_tip=1 then ore else 0 end) over (partition by id_mecanic) as ore, +sum(case when id_tip=1 then round(pret*ore,2) else 0 end) over (partition by id_mecanic) as manopera, +sum(case when id_tip!=1 then ore else 0 end) over (partition by id_mecanic) as ore_reg, +sum(case when id_tip!=1 then round(pret*ore,2) else 0 end) over (partition by id_mecanic) as manopera_reg +from dev_analiza_salarii +/ + +prompt +prompt Creating view DEV_DATE_SUPLIMENTARE +prompt =================================== +prompt +create or replace view dev_date_suplimentare as +select a.id_ordl,a.kmint,a.termen,b.asigurator,c.inspector,d.id_partener,d.series,e.masina,f.marca +from dev_ordl a +left join dev_nom_asiguratori b on a.id_asigurator=b.id_asigurator +left join dev_nom_inspectori c on a.id_inspector=c.id_inspector +left join dev_masiniclienti d on a.id_masiniclient=d.id_masiniclient +left join dev_nom_masini e on d.id_masina=e.id_masina +left join dev_nom_marci f on e.id_marca=f.id_marca +where a.sters=0 +/ + +prompt +prompt Creating view DEV_DATE_SUPLIMENTARE_RAP +prompt ======================================= +prompt +create or replace view dev_date_suplimentare_rap as +select a.id_ordl,a.termen,a.kmint, +b.asigurator, +c.inspector, +d.seriem,d.nrinmat,d.series,d.nrachi,d.dataachi, +e.masina, +f.marca, +g.telefon,g.cod_fiscal,g.adresa, +h.denumire as furnizor +from dev_ordl a +left join dev_nom_asiguratori b on a.id_asigurator=b.id_asigurator +left join dev_nom_inspectori c on a.id_inspector=c.id_inspector +left join dev_masiniclienti d on a.id_masiniclient=d.id_masiniclient +left join dev_nom_masini e on d.id_masina=e.id_masina +left join dev_nom_marci f on e.id_marca=f.id_marca +left join nom_parteneri g on d.id_partener=g.id_part +left join dev_nom_furnizorimasini h on d.id_furnizor=h.id_furnizor +/ + +prompt +prompt Creating view DEV_NORMARE_COMENZI +prompt ================================= +prompt +create or replace view dev_normare_comenzi as +select a.id_ordl,a.id_lucrare,a.id_tip,a.datai,a.id_inspector,a.id_asigurator, +nvl(a.validat,0) as validat,a.dataoravalid,a.nrord,a.id_masiniclient, +nvl(b.facturat,0) as facturat,b.dataact as datafact,b.nract as nrfact, +d.nrinmat, +e.nume, +i.denumire as tip_comanda +from dev_comenzi_validate a +left join dev_vordl_facturi b on a.id_lucrare=b.id_lucrare +left join dev_masiniclienti d on a.id_masiniclient=d.id_masiniclient +left join nom_parteneri e on d.id_partener=e.id_part +left join dev_tip_deviz i on a.id_tip=i.id_tip +/ + +prompt +prompt Creating view DEV_FACTURI_ASIG +prompt ============================== +prompt +create or replace view dev_facturi_asig as +select a.nrord,a.datai,a.nume,c.asigurator, + b.nract,b.dataact, + (case + when pack_sesiune.getAn()*12+pack_sesiune.getLuna()>=pack_sesiune.GET_ANRON()*12+pack_sesiune.GET_LUNARON() + then + b.manopera_ron + else + b.manopera_rol end) + as manopera, + (case + when pack_sesiune.getAn()*12+pack_sesiune.getLuna()>=pack_sesiune.GET_ANRON()*12+pack_sesiune.GET_LUNARON() + then + b.materiale_ron + else + b.materiale_rol end) as materiale, + (case + when pack_sesiune.getAn()*12+pack_sesiune.getLuna()>=pack_sesiune.GET_ANRON()*12+pack_sesiune.GET_LUNARON() + then + b.manopera_ron+b.materiale_ron+b.tva_ron + else + b.manopera_rol+b.materiale_rol+b.tva_rol end) + as valctva +from dev_normare_comenzi a +join mv_ordl_sume_act b on a.id_lucrare=b.id_lucrare +left join dev_nom_asiguratori c on a.id_asigurator=c.id_asigurator +where a.id_asigurator<>0 +order by c.asigurator,b.dataact +/ + +prompt +prompt Creating view DEV_FACTURI_CLIENTI +prompt ================================= +prompt +create or replace view dev_facturi_clienti as +select a.nrord,a.datai,d.nume,d.telefon, + b.nract,b.dataact, + (case + when pack_sesiune.getAn()*12+pack_sesiune.getLuna()>=pack_sesiune.GET_ANRON()*12+pack_sesiune.GET_LUNARON() + then b.manopera_ron + else + b.manopera_rol end) + as manopera, + (case + when pack_sesiune.getAn()*12+pack_sesiune.getLuna()>=pack_sesiune.GET_ANRON()*12+pack_sesiune.GET_LUNARON() + then + b.materiale_ron + else + b.materiale_rol end) as materiale, + (case + when pack_sesiune.getAn()*12+pack_sesiune.getLuna()>=pack_sesiune.GET_ANRON()*12+pack_sesiune.GET_LUNARON() + then + b.manopera_ron+b.materiale_ron+b.tva_ron + else + b.manopera_rol+b.materiale_rol+b.tva_rol end) + as valctva +from dev_normare_comenzi a +join mv_ordl_sume_act b on a.id_lucrare=b.id_lucrare +left join dev_masiniclienti c on a.id_masiniclient=c.id_masiniclient +left join nom_parteneri d on c.id_partener=d.id_part +order by b.dataact +/ + +prompt +prompt Creating view DEV_VORDL_MAN +prompt =========================== +prompt +create or replace view dev_vordl_man as +select a.id_ordl, + sum((case + when pack_sesiune.getAn() * 12 + + pack_sesiune.getLuna() >= + pack_sesiune.GET_ANRON() * 12 + + pack_sesiune.GET_LUNARON() then + a.manopera_ron + else + a.manopera_rol + end)) as manopera + from mv_ordl_man a + where a.luni <= pack_sesiune.getluna() + + pack_sesiune.getan() * 12 + group by a.id_ordl +/ + +prompt +prompt Creating view DEV_VORDL_MAT +prompt =========================== +prompt +create or replace view dev_vordl_mat as +select a.id_lucrare, + sum((case + when pack_sesiune.getAn() * 12 + + pack_sesiune.getLuna() >= + pack_sesiune.GET_ANRON() * 12 + + pack_sesiune.GET_LUNARON() then + a.materiale_ron + else + a.materiale_rol + end)) as materiale + from mv_ordl_mat a + where a.luni <= pack_sesiune.getluna() + + pack_sesiune.getan() * 12 + group by a.id_lucrare +/ + +prompt +prompt Creating view DEV_FACTURI_EMISE +prompt =============================== +prompt +create or replace view dev_facturi_emise as +select row_number() over(partition by a.nrord order by a.datai, a.nrord) as nrcrt, + a.dataoravalid,a.datafact,a.validat,a.facturat,e.inspector,f.asigurator,a.id_tip, + a.nrord, + a.datai, + d.nume, + b.nract, + b.dataact, + NVL(a1.manopera,0) as manopera, + NVL(a2.materiale,0) as materiale, + a.nrinmat, + (case + when pack_sesiune.getAn() * 12 + + pack_sesiune.getLuna() >= + pack_sesiune.GET_ANRON() * 12 + + pack_sesiune.GET_LUNARON() then + b.manopera_ron + b.materiale_ron + b.tva_ron + else + b.manopera_rol + b.materiale_rol + b.tva_rol + end) as valctva + from dev_normare_comenzi a + join mv_ordl_sume_act b on a.id_lucrare = b.id_lucrare + left join dev_vordl_man a1 on a.id_ordl = a1.id_ordl + left join dev_vordl_mat a2 on a.id_lucrare = a2.id_lucrare + left join dev_masiniclienti c on a.id_masiniclient = c.id_masiniclient + left join nom_parteneri d on c.id_partener = d.id_part + left join dev_nom_inspectori e on a.id_inspector = e.id_inspector + left join dev_nom_asiguratori f on a.id_asigurator = f.id_asigurator + order by b.dataact +/ + +prompt +prompt Creating view DEV_FACTURI_TOATE +prompt =============================== +prompt +create or replace view dev_facturi_toate as +select a.nrord,a.datai,a.nume,c.asigurator, + b.nract,b.dataact, + (case + when pack_sesiune.getAn()*12+pack_sesiune.getLuna()>=pack_sesiune.GET_ANRON()*12+pack_sesiune.GET_LUNARON() + then + b.manopera_ron + else + b.manopera_rol end) + as manopera, + (case + when pack_sesiune.getAn()*12+pack_sesiune.getLuna()>=pack_sesiune.GET_ANRON()*12+pack_sesiune.GET_LUNARON() + then + b.materiale_ron + else + b.materiale_rol end) as materiale, + (case + when pack_sesiune.getAn()*12+pack_sesiune.getLuna()>=pack_sesiune.GET_ANRON()*12+pack_sesiune.GET_LUNARON() + then + b.manopera_ron+b.materiale_ron+b.tva_ron + else + b.manopera_rol+b.materiale_rol+b.tva_rol end) + as valctva +from dev_normare_comenzi a +join mv_ordl_sume_act b on a.id_lucrare=b.id_lucrare +left join dev_nom_asiguratori c on a.id_asigurator=c.id_asigurator +order by c.asigurator,b.dataact +/ + +prompt +prompt Creating view DEV_VOPER_MECANICI +prompt ================================ +prompt +create or replace view dev_voper_mecanici as +select a.id_opermecanic, + a.id_oper, + a.ore, + a.inactiv, + a.id_mecanic, + c.nume, + c.prenume, + c.marca, + c.id_salariat, + d.sectie + from dev_oper_mecanici a + left join dev_mecanici b on a.id_mecanic = b.id_mecanic + left join sal_personal c on b.id_salariat = c.id_salariat + left join nom_sectii d on b.id_sectie = d.id_sectie + where a.sters = 0 +/ + +prompt +prompt Creating view DEV_VOPER_PRETURI +prompt =============================== +prompt +create or replace view dev_voper_preturi as +select op.timpn, + op.id_ordl, + op.id_oper, + op.dataora, + op.datai, + (case + when pack_sesiune.getAn() * 12 + + pack_sesiune.getLuna() < + pack_sesiune.GET_ANRON() * 12 + + pack_sesiune.GET_LUNARON() then + op.pret + else + (case op.nou + when 0 then + round(op.pret / 10000, 2) + else + op.pret + end) end) as pret, + op.validat, + n.denop + from dev_oper op + left join dev_nom_norme n on op.id_norme = n.id_norme + where op.sters = 0 +/ + +prompt +prompt Creating view DEV_LISTARE_MAN_TOT_COM +prompt ===================================== +prompt +create or replace view dev_listare_man_tot_com as +select sum(d.ore) as ore, + d.id_mecanic, + sum(round(c.pret * d.ore, 2)) as valoare, + d.nume, + d.prenume, + a.nrord, + a.datai, + d.sectie + from dev_comenzi_validate a + left join dev_vordl_facturi b on a.id_lucrare = b.id_lucrare + left join dev_voper_preturi c on a.id_ordl = c.id_ordl + left join dev_voper_mecanici d on c.id_oper = d.id_oper + where (extract(month from a.dataoravalid) = + pack_sesiune.getluna() and + extract(year from a.dataoravalid) = + pack_sesiune.getan() and a.validat=1 and a.id_tip > 1) + or (extract(month from b.dataact) = + pack_sesiune.getluna() and + extract(year from b.dataact) = + pack_sesiune.getan() and a.id_tip = 1 and + b.facturat = 1) + group by a.id_ordl, + a.nrord, + d.id_mecanic, + d.nume, + d.prenume, + a.datai, + d.sectie + order by d.id_mecanic +/ + +prompt +prompt Creating view DEV_LISTARE_MAN_TOT_DESF +prompt ====================================== +prompt +create or replace view dev_listare_man_tot_desf as +select d.id_opermecanic, + d.id_oper, + d.ore, + d.inactiv, + d.id_mecanic, + d.nume, + d.prenume, + d.marca, + d.id_salariat, + d.sectie, + a.id_ordl, + c.pret, + a.datai, + b.nract as nract, + b.dataact as datafact, + c.denop, + c.timpn, + a.nrord + from dev_comenzi_validate a + left join dev_vordl_facturi b on a.id_lucrare = b.id_lucrare + left join dev_voper_preturi c on a.id_ordl = c.id_ordl + left join dev_voper_mecanici d on c.id_oper = d.id_oper + where (extract(month from a.dataoravalid) = + pack_sesiune.getluna() and + extract(year from a.dataoravalid) = + pack_sesiune.getan() and a.validat=1 and a.id_tip > 1) + or (extract(month from b.dataact) = + pack_sesiune.getluna() and + extract(year from b.dataact) = + pack_sesiune.getan() and a.id_tip = 1 and + b.facturat = 1) + order by id_mecanic +/ + +prompt +prompt Creating view DEV_ORDL_FACTURARE +prompt ================================ +prompt +create or replace view dev_ordl_facturare as +select a.id_ordl,a.id_lucrare,a.datai,a.id_masiniclient, +b.nrord, +c.id_partener,c.nrinmat, +d.nume, +e.masina, +f.marca +from dev_ordl a +left join nom_lucrari b on a.id_lucrare=b.id_lucrare +left join dev_masiniclienti c on a.id_masiniclient=c.id_masiniclient +left join nom_parteneri d on c.id_partener=d.id_part +left join dev_nom_masini e on c.id_masina=e.id_masina +left join dev_nom_marci f on e.id_marca=f.id_marca +where a.sters=0 +/ + +prompt +prompt Creating view DEV_VALIDARE_COMENZI +prompt ================================== +prompt +create or replace view dev_validare_comenzi as +select a.id_ordl, + a.id_lucrare, + a.id_masiniclient, + a.id_tip, + a.datai, + nvl(a.validat, 0) as validat, + a.dataoravalid, + a.util_valid, + a.nrord, + nvl(b.manopera, 0) as manopera, + nvl(b1.materiale, 0) as materiale, + nvl(c.facturat, 0) as facturat, + c.dataact as datafact, + nvl(c.nract, 0) as nrfact, + c.valctva, + d.id_partener, + d.nrinmat, + e.nume, + g.asigurator, + h.inspector, + i.denumire as tip_comanda + from dev_comenzi_validate a + left join dev_vordl_man b on a.id_ordl = b.id_ordl + left join dev_vordl_mat b1 on a.id_lucrare = b1.id_lucrare + left join dev_vordl_facturi c on a.id_lucrare = c.id_lucrare + left join dev_masiniclienti d on a.id_masiniclient = d.id_masiniclient + left join nom_parteneri e on d.id_partener = e.id_part + left join dev_nom_asiguratori g on a.id_asigurator = g.id_asigurator + left join dev_nom_inspectori h on a.id_inspector = h.id_inspector + left join dev_tip_deviz i on a.id_tip = i.id_tip + order by a.datai, a.nrord +/ + +prompt +prompt Creating view DEV_VANSAMBLE +prompt =========================== +prompt +create or replace view dev_vansamble as +select a.* from dev_nom_ansamble a where a.sters = 0 +/ + +prompt +prompt Creating view DEV_VASIGURATORI +prompt ============================== +prompt +create or replace view dev_vasiguratori as +select a.* from dev_nom_asiguratori a where a.sters = 0 +/ + +prompt +prompt Creating view DEV_VDELEGATI +prompt =========================== +prompt +create or replace view dev_vdelegati as +select d.*,p.nume,p.cod_fiscal from dev_nom_delegati d left join nom_parteneri p on d.id_partener = p.id_part where d.sters = 0 +/ + +prompt +prompt Creating view DEV_VFURNIZORI +prompt ============================ +prompt +create or replace view dev_vfurnizori as +select f.* from dev_nom_furnizorimasini f where f.sters = 0 +/ + +prompt +prompt Creating view DEV_VINSPECTORI +prompt ============================= +prompt +create or replace view dev_vinspectori as +select i.* from dev_nom_inspectori i where i.sters = 0 +/ + +prompt +prompt Creating view DEV_VMARCI +prompt ======================== +prompt +create or replace view dev_vmarci as +select m.* from dev_nom_marci m where m.sters = 0 +/ + +prompt +prompt Creating view DEV_VMASINI +prompt ========================= +prompt +create or replace view dev_vmasini as +select m.*,s.marca from dev_nom_masini m left join dev_nom_marci s on m.id_marca = s.id_marca where m.sters = 0 +/ + +prompt +prompt Creating view DEV_VMASINICLIENTI +prompt ================================ +prompt +create or replace view dev_vmasiniclienti as +select mc.*,tm.denumire as tip_motor,m.id_marca,fm.denumire as furnizor,mm.marca,m.masina,p.nume as partener + from dev_masiniclienti mc + left join dev_tipuri_motoare tm on mc.id_tipmotor = tm.id_tipmotor + left join dev_nom_furnizorimasini fm on mc.id_furnizor = fm.id_furnizor + left join dev_nom_masini m on mc.id_masina = m.id_masina + left join dev_nom_marci mm on m.id_marca = mm.id_marca + left join nom_parteneri p on mc.id_partener = p.id_part + where mc.sters = 0 +/ + +prompt +prompt Creating view DEV_VMECANICI +prompt =========================== +prompt +create or replace view dev_vmecanici as +select m.*,s.sectie,p.nume,p.prenume,p.marca from dev_mecanici m left join nom_sectii s on m.id_sectie = s.id_sectie left join sal_personal p on m.id_salariat = p.id_salariat where m.sters = 0 +/ + +prompt +prompt Creating view DEV_VNOM_MASINI +prompt ============================= +prompt +create or replace view dev_vnom_masini as +select m.* from dev_nom_masini m where m.sters = 0 +/ + +prompt +prompt Creating view DEV_VNOM_RESP +prompt =========================== +prompt +create or replace view dev_vnom_resp as +select "ID_RESP","NUME","BI","CNPRESP","ALES","STERS" + from dev_nom_resp where sters = 0 +/ + +prompt +prompt Creating view DEV_VNORME +prompt ======================== +prompt +create or replace view dev_vnorme as +select n.*,a.denumire as ansamblu,m.masina,mar.marca from dev_nom_norme n left join dev_nom_ansamble a on n.id_ansamblu = a.id_ansamblu left join dev_nom_masini m on n.id_masina = m.id_masina left join dev_nom_marci mar on m.id_marca = mar.id_marca where n.sters = 0 +/ + +prompt +prompt Creating view DEV_VOPER +prompt ======================= +prompt +create or replace view dev_voper as +select op.timpn, + op.id_ordl, + op.id_oper, + (case + when pack_sesiune.getAn() * 12 + + pack_sesiune.getLuna() >= + extract(year from op.dataora) * 12 + + extract(month from op.dataora) then + op.dataora + else + null + end) as dataora, + op.id_sectie, + op.datai, + (case + when pack_sesiune.getAn() * 12 + + pack_sesiune.getLuna() < + pack_sesiune.GET_ANRON() * 12 + + pack_sesiune.GET_LUNARON() then + op.pret + else + (case op.nou + when 0 then + round(op.pret / 10000, 2) + else + op.pret + end) end) as pret, + (case + when pack_sesiune.getAn() * 12 + + pack_sesiune.getLuna() >= + extract(year from op.dataora) * 12 + + extract(month from op.dataora) then + op.validat + else + 0 + end) as validat, + op.nou, + n.denop, + n.timpn as timp_nom, + n.codop, + a.denumire as ansamblu, + m.masina, + s.sectie, + s.nsectie, + (case + when pack_sesiune.getAn() * 12 + + pack_sesiune.getLuna() >= + extract(year from op.dataora) * 12 + + extract(month from op.dataora) then + ut.utilizator + else + null + end) as util + from dev_oper op + left join dev_nom_norme n on op.id_norme = n.id_norme + left join dev_nom_ansamble a on n.id_ansamblu = a.id_ansamblu + left join dev_nom_masini m on n.id_masina = m.id_masina + left join nom_sectii s on op.id_sectie = s.id_sectie + left join syn_utilizatori ut on op.id_util = ut.id_util + where op.sters = 0 +/ + +prompt +prompt Creating view DEV_VOPER_DETALII_M +prompt ================================= +prompt +create or replace view dev_voper_detalii_m as +select a.id_opermecanic,a.id_oper,a.ore,a.id_mecanic,c.nume,c.prenume from dev_oper_mecanici a +left join dev_mecanici b on a.id_mecanic=b.id_mecanic +left join sal_personal c on b.id_salariat=c.id_salariat +where a.sters=0 +/ + +prompt +prompt Creating view DEV_VOPER_SIMPLU +prompt ============================== +prompt +create or replace view dev_voper_simplu as +select op.timpn, + op.id_ordl, + op.id_oper, + op.dataora, + op.datai, + op.id_sectie, + op.validat, + op.id_norme, + s.sectie, + s.nsectie + from dev_oper op + left join nom_sectii s on op.id_sectie = s.id_sectie + where op.sters = 0 +/ + +prompt +prompt Creating view DEV_VORDL_AVANSURI +prompt ================================ +prompt +create or replace view dev_vordl_avansuri as +select a.id_lucrare, +(case + when a.luna+a.an*12< +pack_sesiune.GET_LUNARON()+pack_sesiune.GET_ANRON()*12 +and +pack_sesiune.getAn()*12+pack_sesiune.getLuna()>= + pack_sesiune.GET_ANRON()*12+pack_sesiune.GET_LUNARON() +then a.suma/10000 +else +a.suma end) as suma,a.scd,a.ascd,a.scc,a.ascc,a.id_partc,a.id_partd,a.id_sectie, +b.nume as partc,c.nume as partd,d.sectie from act a +left join nom_parteneri b on a.id_partc=b.id_part +left join nom_parteneri c on a.id_partd=c.id_part +left join nom_sectii d on a.id_sectie=d.id_sectie +where a.sters=0 and a.id_set in (31001,31002) and a.scd = '4111' +/ + +prompt +prompt Creating view DEV_VPRETURI +prompt ========================== +prompt +create or replace view dev_vpreturi as +select p.*,m.marca,a.asigurator,v.nume_val + from dev_nom_preturi p + left join dev_nom_marci m on p.id_marca = m.id_marca + left join dev_nom_asiguratori a on p.id_asiguratori = a.id_asigurator + left join nom_valute v on p.id_valuta = v.id_valuta + where p.sters = 0 +/ + + +spool off diff --git a/Scripturi_instalare/viewuri_materializate.sql b/Scripturi_instalare/viewuri_materializate.sql new file mode 100644 index 0000000..d5888ae --- /dev/null +++ b/Scripturi_instalare/viewuri_materializate.sql @@ -0,0 +1,298 @@ +-------------------------------------------------------- +-- View-uri materializate pentru ROAAUTO v 1.4.151 -- +-- Created by marius.atanasiu on 2/2/2006, 9:43:11 AM -- +-------------------------------------------------------- + +spool viewuri_materializate.log + +PROMPT +PROMPT Drop view-uri materializate +PROMPT =================================== +PROMPT +begin + begin + execute immediate 'drop view MV_ORDL_MAT'; + exception + when others then + null; + end; + + begin + execute immediate 'drop view mv_ordl_man'; + exception + when others then + null; + end; + + begin + execute immediate 'drop view mv_act_suma'; + exception + when others then + null; + end; + + begin + execute immediate 'drop view mv_ordl_sume_act'; + exception + when others then + null; + end; + + begin + execute immediate 'drop table mlog$_rul'; + exception + when others then + null; + end; + begin + execute immediate 'drop table mlog$_rul1'; + exception + when others then + null; + end; + begin + execute immediate 'drop materialized view log on RUL'; + exception + when others then + null; + end; + begin + execute immediate 'DROP MATERIALIZED VIEW MV_ORDL_MAT'; + exception + when others then + null; + end; + begin + execute immediate 'DROP TABLE MV_ORDL_MAT'; + exception + when others then + null; + end; + begin + execute immediate 'drop table mlog$_dev_oper'; + exception + when others then + null; + end; + begin + execute immediate 'drop table mlog$_dev_oper1'; + exception + when others then + null; + end; + begin + execute immediate 'drop materialized view log on dev_oper'; + exception + when others then + null; + end; + begin + execute immediate 'drop MATERIALIZED VIEW mv_ordl_man'; + exception + when others then + null; + end; + begin + execute immediate 'drop table mv_ordl_man'; + exception + when others then + null; + end; + begin + execute immediate 'drop table mlog$_act'; + exception + when others then + null; + end; + begin + execute immediate 'drop table mlog$_act1'; + exception + when others then + null; + end; + begin + execute immediate 'drop materialized view log on ACT'; + exception + when others then + null; + end; + begin + execute immediate 'drop MATERIALIZED VIEW mv_ordl_sume_act'; + exception + when others then + null; + end; + begin + execute immediate 'drop table mv_ordl_sume_act'; + exception + when others then + null; + end; + begin + execute immediate 'DROP materialized view MV_ACT_SUMA'; + exception + when others then + null; + end; + begin + execute immediate 'DROP table MV_ACT_SUMA'; + exception + when others then + null; + end; +end; +/ + +PROMPT +PROMPT Creare log view materializat pe act +PROMPT =================================== +PROMPT +CREATE MATERIALIZED VIEW LOG ON act WITH PRIMARY KEY, ROWID, SEQUENCE(id_lucrare,dataact,nract,id_set,scc,scd,luna,an,suma,sters,explicatia,id_sucursala) INCLUDING NEW VALUES +/ + +PROMPT +PROMPT Creare view materializat mv_ordl_sume_act +PROMPT ========================================= +PROMPT +create materialized view MV_ORDL_SUME_ACT + refresh fast on commit + as + select id_lucrare,dataact,nract,id_set,sum(case when scc='704' then (case when luna+an*12<7+2005*12 then round(suma/10000,2) else + suma end) when explicatia like 'DISCOUNT MANOPERA%' and scc<>'4427' then (case when luna+an*12<7+2005*12 then round((-1)*(abs(suma))/10000,2) else (-1)*(abs(suma)) end) else 0 end) as manopera_ron, sum(case when scc in ('707','419') then (case when luna+an*12<7+2005*12 then round(suma/10000,2) else suma end) + when explicatia like 'DISCOUNT MATERIALE%' and scc<>'4427' then (case when luna+an*12<7+2005*12 then round((-1)*(abs(suma))/10000,2) else (-1)*(abs(suma)) end) + else 0 end) as materiale_ron,sum(case when scc='4427' then (case when luna+an*12<7+2005*12 then round(suma/10000,2) + else suma end) else 0 end) as tva_ron,sum(case when scc='704' then (case when luna+an*12<7+2005*12 then suma else 0 end) when explicatia like 'DISCOUNT MANOPERA%' and scc<>'4427' then (case when + luna+an*12<7+2005*12 then (-1)*(abs(suma)) else 0 end) else 0 end) as manopera_rol,sum(case when scc in ('707','419') then (case when luna+an*12<7+2005*12 then suma else 0 + end) when explicatia like 'DISCOUNT MATERIALE%' and scc<>'4427' then (case when luna+an*12<7+2005*12 then (-1)*(abs(suma)) else 0 end) else 0 end) as materiale_rol, + sum(case when scc='4427' then (case when luna+an*12<7+2005*12 then suma else 0 end) else 0 end) as tva_rol,count(*) as cnt, + count(case when scc='704' then (case when luna+an*12<7+2005*12 then round(suma/10000,2) + else suma end) when explicatia like 'DISCOUNT MANOPERA%' and scc<>'4427' then (case when luna+an*12<7+2005*12 then round((-1)*(abs(suma))/10000,2) else (-1)*(abs(suma)) end) + else 0 end) as cnt_manopera_ron,count(case when scc in ('707','419') then (case when luna+an*12<7+2005*12 then round(suma/10000,2) else suma end) + when explicatia like 'DISCOUNT MATERIALE%' and scc<>'4427' then (case when luna+an*12<7+2005*12 then round((-1)*(abs(suma))/10000,2) else (-1)*(abs(suma)) end) + else 0 end) as cnt_materiale_ron,count(case when scc='4427' then (case when luna+an*12<7+2005*12 then round(suma/10000,2) + else suma end) else 0 end) as cnt_tva_ron,count(case when scc='704' then (case when luna+an*12<7+2005*12 then suma else 0 end) + when explicatia like 'DISCOUNT MANOPERA%' and scc<>'4427' then (case when luna+an*12<7+2005*12 then (-1)*(abs(suma)) else 0 end) + else 0 end) as cnt_manopera_rol,count(case when scc in ('707','419') then (case when luna+an*12<7+2005*12 then suma else 0 + end) when explicatia like 'DISCOUNT MATERIALE%' and scc<>'4427' then (case when luna+an*12<7+2005*12 then (-1)*(abs(suma)) else 0 end) + else 0 end) as cnt_materiale_rol,count(case when scc='4427' then (case when luna+an*12<7+2005*12 then suma else 0 end) + else 0 end) as cnt_tva_rol from act where sters=0 and scd in ('4111', '667', '482', '711', '6588') and id_set in (31001, 31002, 31003, 31004, 31005, 31006, 31007, 31011, 31012) group by id_lucrare,dataact,nract,id_set +/ + +PROMPT +PROMPT Creare view materializat MV_ACT_SUMA +PROMPT ========================================= +PROMPT +create materialized view MV_ACT_SUMA + REFRESH FAST ON COMMIT + AS + select an, luna, id_sucursala, + sum(case when TO_NUMBER(SUBSTR(SCD, 1, 1)) between 1 and 7 then suma else 0 end) as sumaD, + sum(case when TO_NUMBER(SUBSTR(SCC, 1, 1)) between 1 and 7 then suma else 0 end) as sumaC, + sum(case when TO_NUMBER(SUBSTR(SCD, 1, 1)) = 8 then suma else 0 end) as sumaD_8, + sum(case when TO_NUMBER(SUBSTR(SCC, 1, 1)) = 8 then suma else 0 end) as sumaC_8, + sum(case when TO_NUMBER(SUBSTR(SCD, 1, 1)) = 9 then suma else 0 end) as sumaD_9, + sum(case when TO_NUMBER(SUBSTR(SCC, 1, 1)) = 9 then suma else 0 end) as sumaC_9, + count(*) as nr, + count(case when TO_NUMBER(SUBSTR(SCD, 1, 1)) between 1 and 7 then suma else 0 end) as nrsumaD, + count(case when TO_NUMBER(SUBSTR(SCC, 1, 1)) between 1 and 7 then suma else 0 end) as nrsumaC, + count(case when TO_NUMBER(SUBSTR(SCD, 1, 1)) = 8 then suma else 0 end) as nrsumaD_8, + count(case when TO_NUMBER(SUBSTR(SCC, 1, 1)) = 8 then suma else 0 end) as nrsumaC_8, + count(case when TO_NUMBER(SUBSTR(SCD, 1, 1)) = 9 then suma else 0 end) as nrsumaD_9, + count(case when TO_NUMBER(SUBSTR(SCC, 1, 1)) = 9 then suma else 0 end) as nrsumaC_9 + from act + where sters = 0 + group by an, luna, id_sucursala +/ + +PROMPT +PROMPT Creare log view materializat pe dev_oper +PROMPT ======================================== +PROMPT +CREATE MATERIALIZED VIEW LOG ON dev_oper WITH PRIMARY KEY,ROWID, SEQUENCE(id_ordl,datai,pret,timpn,nou,sters) INCLUDING NEW VALUES +/ + +PROMPT +PROMPT Creare view materializat mv_ordl_man +PROMPT ==================================== +PROMPT +create materialized view MV_ORDL_MAN refresh fast on commit as + select id_ordl,extract(month from datai) + extract(year from datai) * 12 as luni, + sum(case + when nou = 0 then + round(round(pret / 10000, 2) * timpn, 2) + else + round(pret * timpn, 2) + end) as manopera_ron, + sum(case + when nou = 0 then + round(pret * timpn, 2) + else + 0 + end) as manopera_rol, + count(*) as cnt, + count(case + when nou = 0 then + round(round(pret / 10000, 2) * timpn, 2) + else + round(pret * timpn, 2) + end) as cnt_manopera_ron, + count(case + when nou = 0 then + round(pret * timpn, 2) + else + 0 + end) as cnt_manopera_rol + from dev_oper + where sters = 0 + group by id_ordl, + extract(month from datai) + extract(year from datai) * 12 +/ + +PROMPT +PROMPT Creare log view materializat pe rul +PROMPT =================================== +PROMPT +CREATE MATERIALIZED VIEW LOG ON RUL WITH ROWID, SEQUENCE(AN,LUNA,PRETV,CANTE,ID_LUCRARE,STERS) INCLUDING NEW VALUES; +/ + +PROMPT +PROMPT Creare view materializat mv_ordl_mat +PROMPT ==================================== +PROMPT +CREATE MATERIALIZED VIEW MV_ORDL_MAT +REFRESH FAST ON COMMIT AS +SELECT STERS, + ID_LUCRARE, + LUNA, + AN, + SUM(CASE + WHEN LUNA + AN * 12 < 7 + 2005 * 12 THEN + ROUND(PRETV * CANTE, 2) + ELSE + 0 + END) materiale_rol, + COUNT(CASE + WHEN LUNA + AN * 12 < 7 + 2005 * 12 THEN + ROUND(PRETV * CANTE, 2) + ELSE + 0 + END) cnt_materiale_rol, + SUM(CASE + WHEN LUNA + AN * 12 < 7 + 2005 * 12 THEN + ROUND(ROUND(PRETV / 10000, 2) * CANTE, 2) + ELSE + ROUND(PRETV * CANTE, 2) + END) materiale_ron, + COUNT(CASE + WHEN LUNA + AN * 12 < 7 + 2005 * 12 THEN + ROUND(ROUND(PRETV / 10000, 2) * CANTE, 2) + ELSE + ROUND(PRETV * CANTE, 2) + END) cnt_materiale_ron, + COUNT(*) cnt + FROM RUL + WHERE (STERS = 0) + GROUP BY STERS, ID_LUCRARE, LUNA, AN +/ + +spool off diff --git a/changelog_roaauto.txt b/changelog_roaauto.txt new file mode 100644 index 0000000..eb50f80 --- /dev/null +++ b/changelog_roaauto.txt @@ -0,0 +1,1993 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +23/09/2015 +ROAAUTO - 2.2.4 + +:eroare: + S-a corectat o eroare la vizualizare "Facturare > Facturi in luna curenta". +--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/citeste.txt b/citeste.txt new file mode 100644 index 0000000..1b24448 --- /dev/null +++ b/citeste.txt @@ -0,0 +1,23 @@ +==================== +== WISHLIST +==================== +- programari +- avertizari/task-uri atunci cand se depaseste o anumita perioada de la ultima vizita la service sau, daca are mai mult de doua vizite in istoric, sa-i calculez o medie si sa-l avertizez cam cand consider ca ar fi trebuit sa faca 50,000 km - 75,000 km - 100,000 km, etc. + ITP, RCA, CASCO, revizii + revizii obligatorii la x km/nr ani + Sa se genereze automat task-uri atribuite la brand manageri (land rover, hyundai...) + +- Pe baza task-ului salvat anterior sa se creeze comanda rapid +- Cand vine o masina la service sa se sesizeze daca face obiectul unei rechemari la service pentru un defect din fabricatie. + + + + + ==================== + == + ==================== + - sa modific poDateFactura ca sa contina si datele comenzii ( le vede si acum pe formularul de factura prin ocomenzi, dar s-ar putea sa am probleme atunci cand selecteaza mai multe comenzi pentru facturare, etc. ) + - la preturi : daca selecteaza in alta valuta, ar trebui sa tina cont de cursul din ziua facturarii ; sa pot sa adaug pret fara model / asigurator; la normare sa-i selecteze automat pretul pentru asiguratorul si modelul de pe comanda ( sau sa i le arate doar pe acelea ) + - factura ITP : sa nu mai ceara asigurator, inspector, nr. dosar + + - la factura pe mai multe devize : sa-mi arate si numele clientilor si id-urile in caz ca da eroarea "Devizele trebuie sa fie ale aceluiasi client" \ No newline at end of file diff --git a/comun_plugins/plugin_sms_playsms.prg b/comun_plugins/plugin_sms_playsms.prg new file mode 100644 index 0000000..2a8715d --- /dev/null +++ b/comun_plugins/plugin_sms_playsms.prg @@ -0,0 +1,93 @@ +Local loDate +Local lcReport +loDate = Createobject("empty") +AddProperty(loDate, "to", "0723197939") +AddProperty(loDate, "message", "test " + Ttoc(Datetime())) +AddProperty(loDate, "footer", "@MMM") +lcReport = sendsms(loDate) +Messagebox(m.lcReport) +XMLTOCURSOR() +************************************** +* plugin_sms_playsms +* Apeleaza api playsms Trimite catre playsms +* http://192.168.75.101/html/playsms +*/index.php?app=ws&u=admin&h=eabd6195724d56d08a5a2ca0573451b6&op=pv&to=0723197939&msg=test+only +************************************** +Procedure sendsms + Lparameters toDate + + * toDate: .to, .message, .footer + + #Define HTTPSTATUS_OK 200 + #Define HTTPSTATUS_CREATED 201 + #Define HTTPSTATUS_ACCEPTED 202 + #Define HTTPSTATUS_MULTISTATUS 207 + #Define HTTPSTATUS_BADREQUEST 400 + #Define HTTPSTATUS_UNAUTHORIZED 401 + #Define HTTPSTATUS_FORBIDDEN 403 + #Define HTTPSTATUS_NOTFOUND 404 + #Define HTTPSTATUS_INTERNALSERVERERROR 500 + + Local loHTTP As "Microsoft.XMLHTTP" + Local lcBaseURL, lcFooter, lcMessage, lcPluginPath, lcResponse, lcTo, lcToken, lcURL, lcUser + Local lcUtilsPath, lcwwhttp, lnStatus + lcPluginPath = Addbs(Justpath(Sys(16, 0))) + lcUtilsPath = m.lcPluginPath + 'utils\' +*!* Set Path To (m.lcUtilsPath) Additive +*!* lcwwhttp = m.lcUtilsPath + 'wwhttp.prg' +*!* Do (m.lcwwhttp) + + + lcBaseURL = [http://192.168.75.101/html/playsms] + lcUser = [admin] + lcToken = [eabd6195724d56d08a5a2ca0573451b6] + + lcTo = toDate.To + lcMessage = urlencode(toDate.Message) + lcFooter = urlencode(toDate.Footer) + + lcURL = m.lcBaseURL + [/index.php?app=ws&u=] + m.lcUser + [&h=] + m.lcToken + [&op=pv&to=] + m.lcTo + [&msg=] + m.lcMessage + [&format=xml] + Iif(!Empty(m.lcFooter), [&footer=] + m.lcFooter, []) + + loHTTP = Createobject("Microsoft.XMLHTTP") + loHTTP.Open("GET", m.lcURL, .F.) + loHTTP.Send() + + lnStatus = loHTTP.Status + If m.lnStatus = HTTPSTATUS_OK + lcResponse = loHTTP.responseText + Return lcResponse + Endif +Endproc && sendsms + +Function urlencode + * + * from http://www.tek-tips.com/gviewthread.cfm/lev2/4/lev3/27/pid/184/qid/597112 + * also http://fox.wikis.com/wc.dll?Wiki~VFPPortListener~VFP + * I'm confused by this code. + * I believe it doesn't translate spaces correctly + * + * a proper definition is in: http://www.ietf.org/rfc/rfc2396.txt + * starting about half way down page 5 + * unreserved characters include all alphas, all digits and the following unreserved marks + * mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")" + * + Lparameter pcinstr + * ' encode Percent signs + * ' Double Quotes + * ' CarriageReturn / LineFeeds + Local lcout, lni + lcout = '' + For lni = 1 To Len(pcinstr) + lcch = Substr(pcinstr, lni, 1) + Do Case + Case Isalpha(lcch) Or Isdigit(lcch) Or Inlist(lcch, "-", "_", ".", "!", "~", "*", "'", "(", ")") + * do nothing + Case lcch = " " + lcch = "+" + Otherwise + lcch = '%' + Right( Transform(Asc(lcch), '@0'), 2 ) + Endcase + lcout = lcout + lcch + Endfor + Return lcout +Endfunc && UrlEncode diff --git a/comun_plugins/utils/wconnect.h b/comun_plugins/utils/wconnect.h new file mode 100644 index 0000000..19e4d6d --- /dev/null +++ b/comun_plugins/utils/wconnect.h @@ -0,0 +1,263 @@ +************************************************************************ +* WCONNECT Header File +********************** +*** Author: Rick Strahl +*** (c) West Wind Technologies, 1995-2002 +*** Contact: http://www.west-wind.com/ +*** Function: Global DEFINEs used by West Wind Web Connection. +*** +*** IMPORTANT: Any changes made here or in WCONNECT_OVERRIDE.H +*** require a full recompile of all files that use +*** this header file! +************************************************************************ + +#DEFINE WWVERSION "Version 4.20" +#DEFINE WWVERSIONDATE "May 6, 2002" + +*** DEBUGMODE effects how errors are handled. +*** If .T. errors are not handled and the server stops on errors. +*** If .F. the Web Connection error handlers kick in and +*** provide error pages and logging +#DEFINE DEBUGMODE .T. + +*** Use this flag to handle different configurations +*** You can set up conditional DEFINES for applications +*** to easily switch configurations. (Optional - not used by framework) +*** 1 - Development Server +*** 2 - Live Server +#DEFINE LOCALSITE 1 + +*** When .T. server runs as a Top Level while running file based +#DEFINE SERVER_IN_DESKTOP .F. + +*** Carriage Return/Line Break +#DEFINE CR CHR(13)+CHR(10) && DO NOT USE ANY MORE +#DEFINE CRLF CHR(13)+CHR(10) + +*** Customizable default HTTP Header +#DEFINE DEFAULT_CONTENTTYPE_HEADER ; + "HTTP/1.1 200 OK" + CRLF + ; + "Content-type: text/html" + CRLF + +#DEFINE DEFAULT_HTTP_VERSION "1.1" + +*** Post boundary used for posting multipart vars +#DEFINE POST_BOUNDARY CHR(13)+CHR(10)+ "#@$ FORM VARIABLES $@#" + CHR(13)+CHR(10) +#DEFINE MULTIPART_BOUNDARY "-----------------------------7cf2a327f01ae" + +*** SQL Connect String to database containing +*** wwSession and RequestLog files +#DEFINE WWC_USE_SQL_SYSTEMFILES .F. + +*** Determines whether the store runs with SQL Server Tables +#DEFINE WWSTORE_USE_SQL_TABLES .F. +#DEFINE WWMSGBOARD_USE_SQL_TABLES .F. + +*** Visual FoxPro Version Number Macro +#DEFINE wwVFPVERSION VAL(SUBSTR(Version(),ATC("FoxPro",VERSION())+7,2)) + +*** Determines whether TEMPLATE pages are cached (ExpandTemplate calls) +*** Note: This value specifies how often the file is checked for +*** a newer version in seconds. 0 means - don't cache. +#DEFINE WWC_CACHE_TEMPLATES 0 + +*** Maximum String size for the wwResponseString class +#DEFINE MAX_STRINGSIZE 8000 + +*** Maximum number of cells that ShowCursor generates +*** before reverting to
 list
+#DEFINE MAX_TABLE_CELLS 			15000
+
+*** Special 'NULL' String to differentiate none from empty strings
+#DEFINE WWC_NULLSTRING "*#*"
+
+*** Defines the location of the Web Connection framework
+*** the default is the current directory
+#DEFINE WWC_FRAMEWORK_PATH			".\"
+
+*** XML Size Id used for Memo Fields to differentiate memos from strings
+*** This value is compatible with ADO's usage
+#DEFINE XML_SCHEMA_MEMOSIZE			2147483647
+#DEFINE XML_XMLDOM_PROGID			   "MSXML2.DOMDocument"
+**"MSXML2.DOMDocument.4.0"
+
+*** Determines whether wwXML::XMLTOCURSOR tries to use
+*** VFP 7's XMLTOCURSOR. NOTE: Requires SP1!!!!
+*** This can drastically improve performance for large data sets
+#DEFINE WWXML_USE_VFP_XMLTOCURSOR   .F.
+
+*** Class Names - These classes are defined here and used in the code
+***               so if you subclass an essential class you can change
+***               the class used here and automatically have the framework
+***               inherit from your subclass
+#DEFINE WWC_SERVER				wwServer
+#DEFINE WWC_SERVERFORM 			wwServerForm
+#DEFINE WWC_SERVERFORM_VFPFRAME wwServerFormVFPFrame
+
+#DEFINE WWC_PROCESS         	wwProcess
+#DEFINE WWC_WEBSERVICE			wwWebService
+
+#DEFINE WWC_SESSION 			   wwSession
+#DEFINE WWC_SQLSESSION 			wwSessionSQL
+
+#DEFINE WWC_REQUEST				wwRequest
+#DEFINE WWC_REQUESTASP			wwASPRequest
+
+#DEFINE WWC_RESPONSE			   wwResponse
+#DEFINE WWC_RESPONSEFILE    	wwResponseFile
+#DEFINE WWC_RESPONSESTRING		wwResponseStringNoBuffer
+#DEFINE WWC_RESPONSEASP			wwASPResponse
+
+#DEFINE WWC_WWDHTMLFORM       wwDhtmlForm
+#DEFINE WWC_WWDHTMLCONTROL    wwDhtmlControl            
+
+#DEFINE WWC_HTTPHEADER			wwHTTPHeader
+
+#DEFINE WWC_WWEVAL 				wwEval
+#DEFINE WWC_WWVFPSCRIPT     	wwVFPScript
+#DEFINE WWC_WWPDF				   wwPDF50
+#DEFINE WWC_WWSOAP				wwSOAP
+
+#DEFINE WWC_WWBUSINESS			wwBusiness
+
+*** Class Include flags - Use these to make the install lighter   -  New 07/05/97
+#DEFINE WWC_LOAD_WWSESSION 				.T.
+#DEFINE WWC_LOAD_WWBANNER 					.T.
+#DEFINE WWC_LOAD_WWSHOWCURSOR          .T.
+#DEFINE WWC_LOAD_WWDBFPOPUP 				.T.
+#DEFINE WWC_LOAD_WWIPSTUFF 			   .T.
+#DEFINE WWC_LOAD_WWHTTP                .T.
+#DEFINE WWC_LOAD_WWBUSINESS            .T.
+#DEFINE WWC_LOAD_WWSQL      		      .T.
+#DEFINE WWC_LOAD_WWHTTPSQL             .T.
+#DEFINE WWC_LOAD_WWVFPSCRIPT 				.T.
+#DEFINE WWC_LOAD_WWPDF						.T.
+#DEFINE WWC_LOAD_WWXML						.T.  && Don't change! Required!
+#DEFINE WWC_LOAD_WWMSMQ						.F.
+#DEFINE WWC_LOAD_WWSOAP						.T.
+#DEFINE WWC_LOAD_DYNAMICHTML_FORMRENDERING  .T.
+
+*** VERSION CONSTANTS
+#DEFINE SHAREWARE 		.F.
+#DEFINE WWC_DEMO		.T.
+#DEFINE SWTIMEOUT 		1800
+#DEFINE HTMLCLASSONLY 	.F.
+
+#DEFINE SHOWSQLERRORS 	   .F.
+#DEFINE FOXISAPI 		   .F.
+#DEFINE VISUALWEBBUILDER   .F.
+
+*** COMPATIBILITY CONSTANTS
+*** Turn on for backwards compatibility
+*** As features are removed they are bracketed in this flag.
+#DEFINE WWC_COMPATIBILITY    .F.
+
+*** Use old Style button in Form Rendering
+*** All buttons are rendered with the same name if .t.
+*** END COMPATIBILITY CONSTANTS
+
+*** Images in forms are pathed relative to the Web request
+*** and must be located in the directory specified here
+#DEFINE WWFORM_IMAGEPATH "formimages/"
+#DEFINE WWFORM_USEOLD_BUTTONSTYLE   .F.
+
+*** wwList ActiveX Control settings - Changed 9/2/2000
+#DEFINE WWLIST_USEOLDGRID .F.
+#DEFINE WWLIST_CLASSID "36E500EB-8219-11D1-A398-00600889F23B"
+#DEFINE WWLIST_CODEBASE "wwCTLS.cab"
+
+#DEFINE LISTVIEW_CLASSID "BDD1F04B-858B-11D1-B16A-00C0F0283628"
+#DEFINE LISTVIEW_CODEBASE "http://activex.microsoft.com/controls/vb6/MSComCtl.cab"
+
+*** General WinINET Constants
+#DEFINE INTERNET_OPEN_TYPE_PRECONFIG    		0
+#DEFINE INTERNET_OPEN_TYPE_DIRECT       		1
+#DEFINE INTERNET_OPEN_TYPE_PROXY             	3
+
+#DEFINE INTERNET_OPTION_CONNECT_TIMEOUT         2
+#DEFINE INTERNET_OPTION_CONNECT_RETRIES         3
+#DEFINE INTERNET_OPTION_SEND_TIMEOUT       		5
+#DEFINE INTERNET_OPTION_RECEIVE_TIMEOUT    		6
+#DEFINE INTERNET_OPTION_DATA_SEND_TIMEOUT       5
+#DEFINE INTERNET_OPTION_DATA_RECEIVE_TIMEOUT    6
+#DEFINE INTERNET_OPTION_LISTEN_TIMEOUT          11
+
+#DEFINE INTERNET_SERVICE_FTP				    1
+#DEFINE INTERNET_DEFAULT_FTP_PORT				21
+
+#DEFINE ERROR_INTERNET_EXTENDED_ERROR           12003
+
+*** WinInet Service Flags
+#DEFINE INTERNET_SERVICE_HTTP         			3
+#DEFINE INTERNET_DEFAULT_HTTP_PORT      		80
+#DEFINE INTERNET_DEFAULT_HTTPS_PORT   		  	443
+
+#DEFINE INTERNET_FLAG_RELOAD            		2147483648
+#DEFINE INTERNET_FLAG_SECURE            		8388608
+#define INTERNET_FLAG_KEEP_CONNECTION           0x00400000  
+
+#DEFINE HTTP_STATUS_PROXY_AUTH_REQ           	407 
+#define HTTP_QUERY_STATUS_CODE                  19  
+#define HTTP_QUERY_FLAG_NUMBER                  0x20000000
+#DEFINE HTTP_QUERY_RAW_HEADERS_CRLF          	22  
+
+#define HTTP_QUERY_STATUS_CODE                  19  
+#define HTTP_QUERY_STATUS_TEXT                  20  
+
+#DEFINE FTP_TRANSFER_TYPE_ASCII     			1
+#DEFINE FTP_TRANSFER_TYPE_BINARY    			2
+
+#DEFINE INTERNET_FLAG_IGNORE_CERT_DATE_INVALID  0x00002000
+
+*** Win32 API Constants
+#DEFINE ERROR_SUCCESS               			0
+
+*** Access Flags
+#DEFINE GENERIC_READ                     		0x80000000
+#DEFINE GENERIC_WRITE                    		0x40000000
+#DEFINE GENERIC_EXECUTE                  		0x20000000
+#DEFINE GENERIC_ALL                      		0x10000000
+
+*** File Attribute Flags
+#DEFINE FILE_ATTRIBUTE_NORMAL               	0x00000080
+#DEFINE FILE_ATTRIBUTE_READONLY             	0x00000001
+#DEFINE FILE_ATTRIBUTE_HIDDEN               	0x00000002
+#DEFINE FILE_ATTRIBUTE_SYSTEM               	0x00000004
+
+*** Values for FormatMessage API
+#DEFINE FORMAT_MESSAGE_FROM_SYSTEM     			4096
+#DEFINE FORMAT_MESSAGE_FROM_HMODULE    			2048
+
+*** Registry roots
+#DEFINE HKEY_CLASSES_ROOT           -2147483648  && (( HKEY ) 0x80000000 )
+#DEFINE HKEY_CURRENT_USER           -2147483647  && (( HKEY ) 0x80000001 )
+#DEFINE HKEY_LOCAL_MACHINE          -2147483646  && (( HKEY ) 0x80000002 )
+#DEFINE HKEY_USERS                  -2147483645  && (( HKEY ) 0x80000003 )
+
+*** Registry Value types
+#DEFINE REG_NONE					0    && Undefined Type (default)
+#DEFINE REG_SZ						1	 && Regular Null Terminated String
+#DEFINE REG_BINARY				3    && ??? (unimplemented)
+#DEFINE REG_DWORD					4    && Long Integer value
+#DEFINE MULTI_SZ					7	 && Multiple Null Term Strings (not implemented)
+
+*** Generic File Access Rights for NT ACLs
+#define  FILERIGHTS_READ         1179785
+#define 	FILERIGHTS_READEXECUTE	1179817
+#define 	FILERIGHTS_CHANGE			1245631
+#define	FILERIGHTS_FULL			2032127
+
+
+**** CUSTOMIZE AND OVERRIDE SETTINGS INDEPENDENTLY
+**** OF THE WC INSTALLATION
+#IF FILE("WCONNECT_OVERRIDE.H")
+	#INCLUDE WCONNECT_OVERRIDE.H
+#ENDIF
+
+*!*  WCONNECT_OVERRIDE.H would contain (for example):
+*!*			#UNDEFINE DEBUGMODE
+*!*         #DEFINE DEBUGMODE .T.
+
+*!*			#UNDEFINE SERVER_IN_DESKTOP 
+*!*         #DEFINE SERVER_IN_DESKTOP .T.
+
diff --git a/comun_plugins/utils/wwHttp.PRG b/comun_plugins/utils/wwHttp.PRG
new file mode 100644
index 0000000..7d980d3
--- /dev/null
+++ b/comun_plugins/utils/wwHttp.PRG
@@ -0,0 +1,1505 @@
+#INCLUDE "wconnect.h"
+
+*** Load Library
+SET PROCEDURE TO wwHTTP ADDIT
+
+*** Load Dependencies
+SET PROCEDURE TO wwUtils ADDIT
+
+*************************************************************
+DEFINE CLASS wwHTTP AS Custom 
+*************************************************************
+*: Author: Rick Strahl
+*:         (c) West Wind Technologies, 2000
+*:Contact: http://www.west-wind.com
+*************************************************************
+#IF .F.
+*:Help Documentation
+*:Topic:
+Class wwHTTP
+
+*:Description:
+A standalone HTTP client library. Same HTTP interfaces
+as wwIPStuff, but provided here for lighter environment.
+
+*:Example:
+
+*:Remarks:
+Requires wwIPStuff.dll for URLEncoding and Decoding of 
+strings larger than 80 characters.
+
+*:SeeAlso:
+
+*:ENDHELP
+#ENDIF
+**************************************************************
+PROTECTED cdllpath
+cdllpath = ""
+
+*-- Last Error Message Text for the last operation. Implemented only for SMTP and HTTP operations.
+cerrormsg = ""
+
+*-- Password to log on to server (applies to FTP and HTTP)
+cpassword = ""
+
+*-- Username for log in operations (FTP and HTTP).
+cusername = ""
+
+*-- Determines whether SSL is used
+lsecurelink = .F.
+
+*-- Connection timeout for Connection, Send and Read operations
+*-- if any take longer than the number of seconds here operation will abort
+nconnecttimeout = 5000
+
+PROTECTED hIPSession, hhttpsession
+hhttpsession = 0
+hipsession = 0
+
+*-- The last error code.
+nerror = 0
+
+*-- Allows to specify how the connection is opened: 1 - Direct*, 3 - Proxy (IE 4 and later) and 0 - PreConfig (using IE settings)
+nhttpconnecttype = 1
+
+*-- HTTP Server Address. Format: www.west-wind.com, or 111.111.111.111
+cserver = ""
+
+*-- HTTP Link to visit on a site. Site relative URL. Example: /default.asp, /, /wconnect.dll?wwDemo~TestPage
+clink = ""
+
+*-- The port to use for HTTP Connections. If the default value of 0 is used, the HTTP and HTTPS default ports (80 and 443) are used.
+nhttpport = 0
+
+*-- Size of the download HTTP buffer used while downloading dynamically sized requests with HTTPGetEx. This is the size of chunks that will be pulled at a time and also determines how often OnHTTPBufferUpdate is called.
+nhttpworkbuffersize = 4096
+
+*-- This property is set when calling HTTPGetEx and contains the entire HTTP header of a request
+chttpheaders = ""
+
+cUserAgent = "West Wind Internet Protocols 4.20"
+
+*-- Flag that can be set in OnHTTPBufferUpdate to allow cancellation of the current HTTP download
+lhttpcanceldownload = .F.
+
+*-- HTTP Post mode determines how requests are posted to the server. 1 - Form URLEncoded (default)  2 - Multipart forms.  This property must be set prior to calling AddPostKey and HTTPGetEx
+nhttppostmode = 1
+
+*** The POST buffer used internally 
+cPostBuffer = ""
+
+*-- Version of the wwIPStuff library. This value should match the DLL Version number.
+cversion = "4.10"
+
+*-- String that specifies the name or IP address of the proxy server and its port.
+chttpproxyname = ""
+
+*-- Address of a string variable that contains an optional list of host names or IP addresses, or both, that should not be routed through the proxy
+chttpproxybypass = ""
+
+*-- Proxy Authentication info (make sure you use nHTTPConnectType=3)
+chttpProxyUserName = ""
+chttpProxyPassword = ""
+
+*-- Optional flags used for InternetOpen calls.
+nserviceflags = 0
+nHttpServiceFlags = 0
+
+************************************************************************
+* wwHTTP :: Init
+*********************************
+***  Function: Loads the DLL
+***      Pass: lcPath  -  Path where to find the DLL. If "" is used
+***                       SYSTEM path or local is assumed. Path must
+***                       be terminated with a trailing backslash
+************************************************************************
+FUNCTION INIT
+LPARAMETER lcPath
+
+#IF .F.
+   WAIT WINDOW NOWAIT ;
+      "Welcome to West Wind Internet Protocols..." + CHR(13) + ;
+      "This is a shareware copy of wwHTTP." + CHR(13)+ CHR(13) +;
+      "Please register your copy."
+#ENDIF
+
+lcPath=IIF(VARTYPE(lcPath)="C",lcPath,"")
+
+THIS.cdllpath=lcPath+"wwIPStuff.dll"
+
+DECLARE INTEGER GetLastError;
+   IN WIN32API
+
+DO PATH WITH lcPath
+RETURN
+
+
+
+************************************************************************
+* wwHTTP :: AddPostKey
+*********************************
+***  Function: Adds POST variables to the HTTP request
+***    Assume: depends on nHTTPPostMode setting
+***      Pass: 
+***    Return:
+************************************************************************
+FUNCTION AddPostKey
+LPARAMETERS tcKey, tcValue, llFileName
+
+LOCAL lcOldAlias
+tcKey=IIF(VARTYPE(tcKey)="C",tcKey,"")
+tcValue=IIF(VARTYPE(tcValue)="C",tcValue,"")
+
+lcOldAlias=ALIAS()
+
+IF tcKey="RESET" OR PCOUNT() = 0
+   THIS.cPostBuffer  = ""
+   RETURN
+ENDIF
+
+IF !EMPTY(tcKey)
+   *** Regular URLEncoded format
+   * THIS.cPostBuffer= && No good for buffers over 1meg
+   DO CASE
+    CASE THIS.nhttppostmode = 1
+         THIS.cPostBuffer = THIS.cPostBuffer + tcKey +;
+            "="+URLEncode(tcValue)+ "&"
+    OTHERWISE
+      *** Multi-part formvars and file
+
+      *** Check for File Flag -  HTTP File Upload - Second parm is filename
+      IF llFileName
+         THIS.cPostBuffer = THIS.cPostBuffer + ;
+            "--" + MULTIPART_BOUNDARY + CR + ;
+            [Content-Disposition: form-data; name="]+tcKey+[" filename="] + tcValue + ["]+CR+CR+;
+            FILETOSTR(tcValue) + CR
+      ELSE
+         THIS.cPostBuffer = THIS.cPostBuffer + ;
+            "--" + MULTIPART_BOUNDARY + CR + ;
+            [Content-Disposition: form-data; name="]+tcKey+["]+CR+CR+;
+            tcValue+CR
+      ENDIF
+   ENDCASE
+ELSE
+   *** Raw non-encoded post - Add "-" to buffer to
+   *** allow binary data to be posted without truncation
+   THIS.cPostBuffer = THIS.cPostBuffer + tcValue
+ENDIF
+
+ENDFUNC
+
+
+
+
+********************************************************
+* wwHTTP :: HTTPConnect
+*********************************
+***  Function: Connect to an HTTP server.
+***    Assume: Sets two handle values in this class Each
+***            instance of this class can only manage
+***            one HTTP session at a time. Use this low
+***            level function for quick repeated access
+***            to HTTP pages.
+***      Pass: lcServer   - Server name
+***            lcUsername - Optional Username
+***            lcPassword - Optional Password
+***            llHTTPS    - .T. for secure connections
+***    Return: 0 on success or WinAPI Errorcode
+********************************************************
+FUNCTION HTTPConnect
+LPARAMETER lcServer, lcUserName, lcPassword, llHTTPS
+LOCAL lhIP, lhHTTP, lnError, lnHTTPPort
+
+lcServer=TRIM(IIF(!EMPTY(lcServer),lcServer,THIS.cserver))
+lcUserName=TRIM(IIF(!EMPTY(lcUserName),lcUserName,THIS.cusername))
+lcPassword=TRIM(IIF(!EMPTY(lcPassword),lcPassword,THIS.cpassword))
+
+*** Assign Default Ports
+IF THIS.nhttpport = 0
+   lnHTTPPort = IIF(llHTTPS or THIS.lSecureLink,;
+                    INTERNET_DEFAULT_HTTPS_PORT,;
+                    INTERNET_DEFAULT_HTTP_PORT)
+ELSE
+   lnHTTPPort = THIS.nhttpport
+ENDIF
+
+THIS.lsecurelink = llHTTPS OR THIS.lsecurelink
+
+THIS.cserver = lcServer
+
+THIS.nerror=0
+THIS.cerrormsg=""
+
+DECLARE INTEGER InternetCloseHandle ;
+   IN WinInet.DLL ;
+   INTEGER
+
+DECLARE INTEGER GetLastError;
+   IN WIN32API
+
+DECLARE INTEGER InternetOpen ;
+   IN WININET.DLL ;
+   STRING,;
+   INTEGER,;
+   STRING, STRING, INTEGER
+
+*** Force to Proxy Operation
+IF !EMPTY(THIS.cHttpProxyName)
+   THIS.nHTTPConnectType = 3  && Proxy
+ENDIF
+
+hInetConnection=;
+   InternetOpen(THIS.cUserAgent,;
+   THIS.nhttpconnecttype,;
+   THIS.chttpproxyname,THIS.chttpproxybypass,0)
+
+IF hInetConnection = 0
+   THIS.nerror=GetLastError()
+   THIS.cerrormsg=THIS.getsystemerrormsg(THIS.nerror)
+   RETURN THIS.nerror
+ENDIF
+
+THIS.hipsession=hInetConnection
+
+DECLARE INTEGER InternetConnect ;
+   IN WININET.DLL ;
+   INTEGER hIPHandle,;
+   STRING lpzServer,;
+   INTEGER dwPort, ;
+   STRING lpzUserName,;
+   STRING lpzPassword,;
+   INTEGER dwServiceFlags,;
+   INTEGER dwFlags,;
+   INTEGER dwReserved
+
+
+lhHTTPSession=;
+   InternetConnect(hInetConnection,;
+   lcServer,;
+   lnHTTPPort,;
+   lcUserName,;
+   lcPassword,;
+   INTERNET_SERVICE_HTTP,;
+   THIS.nserviceflags,0)
+
+
+IF (lhHTTPSession = 0)
+   =InternetCloseHandle(hInetConnection)
+   THIS.nerror = GetLastError()
+   THIS.cerrormsg = THIS.getsystemerrormsg()
+   RETURN THIS.nerror
+ENDIF
+
+THIS.hhttpsession = lhHTTPSession
+
+RETURN 0
+
+
+********************************************************
+* wwHTTP :: HTTPClose
+*********************************
+***  Function: Closes an HTTP Session.
+***    Return: nothing
+********************************************************
+FUNCTION httpclose
+
+DECLARE INTEGER InternetCloseHandle ;
+   IN WININET.DLL ;
+   INTEGER hIPSession
+
+*** Always clear the POST buffer
+THIS.cPostBuffer = ""
+
+IF THIS.hHTTPSession # 0
+  InternetCloseHandle(THIS.hhttpsession)
+  THIS.hhttpsession=0
+ENDIF
+IF THIS.hipSession # 0
+  InternetCloseHandle(THIS.hipsession)
+  THIS.hipsession=0
+ENDIF
+
+ENDFUNC
+
+************************************************************************
+* wwHTTP :: HTTPGet
+****************************************
+***  Function:
+***    Assume:
+***      Pass:
+***    Return:
+************************************************************************
+FUNCTION HTTPGet()
+LPARAMETERS lcUrl, lcUserName, lcPassword
+LOCAL lnError, lnSize, lcBuffer, szHead, loUrl, llHTTPS, lnResult,;
+   hInetConnection, hHTTPResult
+
+THIS.nerror = 0
+THIS.cerrormsg = ""
+
+IF VARTYPE(lcUserName) = "N"
+   tnBufferSize=lcUserName
+   lcUserName = ""
+   lcPassword = ""
+ELSE
+   tnBufferSize = 0
+   lcUserName=IIF(EMPTY(lcUserName),"",lcUserName)
+   lcPassword=IIF(EMPTY(lcPassword),"",lcPassword)
+ENDIF
+
+
+loUrl = THIS.InternetCrackUrl(lcUrl)
+IF ISNULL(loUrl)
+   THIS.nError = -1
+   THIS.cerrormsg = "Invalid URL passed."
+   RETURN ""
+ENDIF
+
+llHTTPS = IIF(LOWER(loUrl.cProtocol)="https",.T.,.F.)
+THIS.nHttpPort=VAL(loUrl.cPort)
+
+lnResult = THIS.HTTPConnect(loUrl.cserver,lcUserName,lcPassword,llHTTPS)
+IF lnResult # 0
+   RETURN ""
+ENDIF
+
+IF tnBufferSize # 0
+   lcData=SPACE(tnBufferSize)
+   lnSize=tnBufferSize
+ELSE
+   lcData = ""
+   lnSize = 0
+ENDIF
+
+
+lnResult = THIS.HTTPGetEx(loUrl.cPath + loUrl.cQueryString,@lcData,@lnSize)
+
+THIS.HTTPClose()
+
+IF lnResult # 0
+   THIS.cerrormsg = THIS.cerrormsg
+   RETURN ""
+ENDIF
+
+RETURN lcData
+ENDFUNC
+
+
+********************************************************
+* wwHTTP :: HTTPGetEx
+*********************************
+***  Function: Retrieves an HTTP request from the
+***            network and returns a string. Read an
+***            HTML or data file across the net.
+***    Assume: Blocking call - waits for completion
+***            before returning. Use AddPostKey
+***            to post data to server
+***            Must call HTTPConnect/HTTPClose to
+***            manage connection to Server.
+***      Pass: tcURL        - URL to retrieve
+***            tcBuffer     - HTTP result (by Reference)
+***            tnBufferSize - Size of the buffer (ref)
+***            tcHeaders    - HTTP Headers sent from
+***                           client request. Separate
+***                           key:value pairs with CR
+***            tcFileName   - Optional filename to save
+***                           content to to avoid keeping
+***                           the entire content in memory
+***    Return: WinAPI Error Code (check THIS.cErrorMsg)
+*******************************************************
+FUNCTION HTTPGetEx
+LPARAMETERS tcPage, tcBuffer, tnBufferSize, tcHeaders, tcFileName
+LOCAL hHTTPResult, lcOldAlias, lhFile
+
+tcPage=IIF(EMPTY(tcPage),THIS.clink,tcPage)
+tnBufferSize=IIF(VARTYPE(tnBufferSize)="N",;
+   tnBufferSize,LEN(tcPage))
+
+lcOldAlias=ALIAS()
+
+THIS.lhttpcanceldownload = .F.
+
+THIS.clink = tcPage
+
+IF !EMPTY(THIS.cPostBuffer)
+   IF THIS.nHTTPPostMode=1 AND RIGHT(THIS.cPostBuffer,1) = "&"
+      THIS.cPostbuffer = LEFT(THIS.cPostbuffer,LEN(THIS.cPostBuffer)-1)
+   ENDIF
+   tnPostSize=LEN(THIS.cPostBuffer)
+   lcPostBuffer= IIF(tnPostSize > 0,THIS.cPostBuffer,NULL)
+ELSE
+   tnPostSize=0
+   lcPostBuffer=NULL
+ENDIF
+
+
+THIS.nerror=0
+THIS.cerrormsg=""
+
+DECLARE INTEGER HttpOpenRequest ;
+   IN WININET.DLL ;
+   INTEGER hHTTPHandle,;
+   STRING lpzReqMethod,;
+   STRING lpzPage,;
+   STRING lpzVersion,;
+   STRING lpzReferer,;
+   STRING lpzAcceptTypes,;
+   INTEGER dwFlags,;
+   INTEGER dwContextw
+
+*** Keep alive must be used for Proxies
+IF !EMPTY(THIS.cHTTPProxyName) OR this.nHTTPConnectType = 3
+   THIS.nHTTPServiceFlags = THIS.nHTTPServiceFlags + INTERNET_FLAG_KEEP_CONNECTION 
+ENDIF
+
+hHTTPResult=HttpOpenRequest(THIS.hhttpsession,;
+   IIF( tnPostSize > 0, "POST","GET"),;
+   tcPage,;
+   NULL,NULL,NULL,;
+   INTERNET_FLAG_RELOAD + ;
+   IIF(THIS.lsecurelink,INTERNET_FLAG_SECURE,0) + ;
+   this.nHTTPServiceFlags,0) 
+
+
+IF (hHTTPResult = 0)
+   THIS.nerror=GetLastError()
+   THIS.cerrormsg=THIS.getsystemerrormsg()
+   RETURN THIS.nerror
+ENDIF
+
+THIS.wininetsettimeout(THIS.nConnectTimeOut,hHTTPResult)
+
+THIS.hhttpsession=hHTTPResult
+
+THIS.OnHttpPostConnect(hHTTPResult)
+
+
+DECLARE INTEGER HttpSendRequest    ;
+   IN WININET.DLL ;
+   INTEGER hHTTPHandle,;
+   STRING lpzHeaders,;
+   INTEGER cbHeaders,;
+   STRING lpzPost,;
+   INTEGER cbPost
+
+IF tnPostSize > 0
+   DO CASE
+      CASE THIS.nhttppostmode = 1
+         tcHeaders = "Content-Type: application/x-www-form-urlencoded"  + CRLF +;
+            IIF(!EMPTY(tcHeaders),CRLF+tcHeaders,"")
+      CASE THIS.nhttppostmode = 2
+         tcHeaders = "Content-Type: multipart/form-data; boundary=" + MULTIPART_BOUNDARY + CRLF + CRLF +;
+            IIF(EMPTY(tcHeaders),"",tcHeaders)
+
+         *** NOTE: extra dashes required to simulate browser operation!
+         lcPostBuffer = lcPostBuffer + "--" + MULTIPART_BOUNDARY + CR
+         tnPostSize=LEN(lcPostBuffer)
+      CASE THIS.nhttppostmode = 4  && XML
+         tcHeaders="Content-Type: text/xml" + CRLF +;
+            IIF(EMPTY(tcHeaders),"",tcHeaders)
+   ENDCASE
+*   tcHeaders = tcHeaders + "Content-Length: " + TRANSFORM(tnPostSize) + CRLF
+ELSE
+   tcHeaders =  IIF(!EMPTY(tcHeaders),tcHeaders,"")
+ENDIF
+
+IF !EMPTY(THIS.cHTTPProxyUserName)
+  IF !THIS.SetProxyLogin()
+      RETURN THIS.nError
+  ENDIF
+ENDIF
+polog.Log('HttpSendRequest',Program())
+lnRetval=0
+lnRetval=HttpSendRequest(hHTTPResult,;
+   tcHeaders,LEN(tcHeaders),;
+   lcPostBuffer,tnPostSize)
+
+IF lnRetval = 0
+   THIS.nerror=GetLastError()
+   THIS.cerrormsg=THIS.getsystemerrormsg()
+   =InternetCloseHandle(hHTTPResult)
+   RETURN THIS.nerror
+ENDIF
+
+DECLARE INTEGER HttpQueryInfo ;
+   IN WININET.DLL ;
+   INTEGER hHTTPHandle,;
+   INTEGER nType,;
+   STRING @cHeaders,;
+   INTEGER @cbHeaderSize,;
+   STRING cNULL
+
+*** Retrieve the HTTP Headers
+polog.Log('HttpQueryInfo 1',Program())
+lcHeaders = SPACE(1024)
+lnHeaderSize = 1024
+lnRetval = HttpQueryInfo(hHTTPResult,;
+   HTTP_QUERY_RAW_HEADERS_CRLF,;
+   @lcHeaders,@lnHeaderSize,NULL)
+THIS.chttpheaders = TRIM(STRTRAN(lcHeaders,CHR(0),""))
+ 
+*** Check the HTTP Result Code
+lcHeaders = SPACE(7)
+lnHeaderSize = 6
+polog.Log('HttpQueryInfo 2',Program())
+lnRetval = HttpQueryInfo(hHTTPResult,;
+   HTTP_QUERY_STATUS_CODE,;
+   @lcHeaders,@lnHeaderSize,NULL)
+lcResultCode = TRIM(STRTRAN(lcHeaders,CHR(0),""))
+
+IF lcResultCode # "200"
+   lcHeaders = SPACE(256)
+   lnHeaderSize = 255
+   lnRetval = HttpQueryInfo(hHTTPResult,;
+      HTTP_QUERY_STATUS_TEXT,;
+      @lcHeaders,@lnHeaderSize,NULL)
+   THIS.nerror=VAL(lcResultCode)
+   THIS.cErrorMsg = TRIM(STRTRAN(lcHeaders,CHR(0),""))
+   =InternetCloseHandle(hHTTPResult)
+   RETURN THIS.nerror
+ENDIF
+
+
+*** Call HTTP Event method
+polog.Log('OnHTTPBufferUpdate',Program())
+THIS.OnHTTPBufferUpdate(0,0,THIS.chttpheaders)
+
+DECLARE INTEGER InternetReadFile ;
+   IN WININET.DLL ;
+   INTEGER hHTTPHandle,;
+   STRING @lcBuffer,;
+   INTEGER cbBuffer,;
+   INTEGER @cbBuffer
+
+polog.Log('InternetReadFile',Program())
+IF tnBufferSize > 0
+   *** Use Fixed Buffer Size
+   tcBuffer=SPACE(tnBufferSize)
+   lnBufferSize=tnBufferSize
+   lnRetval=InternetReadFile(hHTTPResult,;
+      @tcBuffer,;
+      tnBufferSize,;
+      @tnBufferSize)
+ELSE
+   *** If a filename was specified output to the file instead of string
+   IF !EMPTY(tcFileName)
+      lhFile = FCREATE(tcFileName)
+      IF lhFile = -1
+         THIS.nerror=1
+         THIS.cerrormsg="Couldn't create output file"
+         =InternetCloseHandle(hHTTPResult)
+         RETURN THIS.nerror
+      ENDIF
+   ENDIF
+
+   *** Build the buffer dynamically
+   tcBuffer = ""
+   tnSize = 0
+   lnRetval = 0
+   lnBytesRead = 1
+   lnBufferReads = 0
+   DO WHILE .T.
+      lcReadBuffer = SPACE(THIS.nhttpworkbuffersize)
+      lnBytesRead = 0
+      lnSize = LEN(lcReadBuffer)
+
+      lnRetval=InternetReadFile(hHTTPResult,;
+         @lcReadBuffer,;
+         lnSize,;
+         @lnBytesRead)
+
+      IF lnRetval = 1 AND lnBytesRead > 0
+         *** Update the input parameters - result buffer and size of buffer
+         IF EMPTY(tcFileName)
+            *** Build string
+            tcBuffer = tcBuffer + LEFT(lcReadBuffer,lnBytesRead)
+         ELSE
+            *** Write to file
+            FWRITE(lhFile,lcReadBuffer,lnBytesRead)
+         ENDIF
+         tnBufferSize = tnBufferSize + lnBytesRead
+         lnBufferReads = lnBufferReads + 1
+         THIS.OnHTTPBufferUpdate(tnBufferSize,lnBufferReads,@lcReadBuffer)
+      ENDIF
+      IF THIS.lhttpcanceldownload
+         tcBuffer = "Error: Download canceled"
+         tnBufferSize = LEN(tcBuffer)
+         THIS.nError = -2
+         THIS.cErrorMsg = "Download Cancelled"
+         EXIT
+      ENDIF
+      IF (lnRetval = 1 AND lnBytesRead = 0) OR (lnRetval = 0)
+         EXIT
+      ENDIF
+   ENDDO
+   lnBufferSize = tnBufferSize
+
+   IF !EMPTY(tcFileName)
+      FCLOSE(lhFile)
+   ENDIF
+
+   THIS.OnHTTPBufferUpdate(0,-1,"")
+ENDIF
+
+IF lnRetval = 0
+   THIS.nerror=GetLastError()
+   THIS.cerrormsg=THIS.getsystemerrormsg()
+ENDIF
+
+=InternetCloseHandle(hHTTPResult);
+
+tcBuffer = (IIF(tnBufferSize > 1 AND tnBufferSize <= lnBufferSize,SUBSTR(tcBuffer,1,tnBufferSize),""))
+
+RETURN THIS.nerror
+
+
+************************************************************************
+* wwHTTP :: HTTPGetAsync
+*********************************
+***  Function: Sends an HTTP request but doesn't wait for completion.
+***            You can use this one for stress testing. Each request
+***            fires off a new thread so make sure you let the
+***            thread count catch up before overrunning your machine.
+***            Why - use for stress testing.
+***      Pass: lcUrl   -    Location to open
+***    Return: nothing
+************************************************************************
+FUNCTION httpgetasync
+LPARAMETERS lcUrl
+lcUrl=IIF(TYPE("lcUrl")="C",lcUrl,"")
+
+DECLARE INTEGER HTTPGetAsync ;
+   IN (THIS.cDLLPath) ;
+   STRING cURL
+
+HTTPGetAsync(lcUrl)
+RETURN
+
+
+
+************************************************************************
+* wwHTTP :: HTTPGetHeader
+*********************************
+***  Function: Retrieves just the HTTP header of a page request.
+***    Assume: Must call HTTPConnect/HTTPClose to manage connection
+***            to Server
+***      Pass: tcPage    -    The Server relative page to view
+***            tcHeader  -    Buffer to receive headers (by reference)
+***            tnSize    -    Size of the Buffer (by Reference)
+***    Return: Win32API Error Code
+************************************************************************
+LPARAMETERS tcPage, tcHeaders, tnHeaderSize
+LOCAL lnError, lnSize, lcBuffer
+
+tcHeaders=IIF(TYPE("tcHeaders")="C",tcHeaders,"")
+tnHeaderSize=IIF(TYPE("tnHeaderSize")="N",tnHeaderSize,2048)
+
+IF !EMPTY(THIS.cPostBuffer)
+   tnPostSize=LEN(THIS.cPostBuffer)
+   lcPostBuffer= IIF(tnPostSize > 0,THIS.cPostBuffer,NULL)
+ELSE
+   tnPostSize=0
+   lcPostBuffer=NULL
+ENDIF
+
+DECLARE INTEGER HttpOpenRequest ;
+   IN WININET.DLL ;
+   INTEGER hHTTPHandle,;
+   STRING lpzReqMethod,;
+   STRING lpzPage,;
+   STRING lpzVersion,;
+   STRING lpzReferer,;
+   STRING lpzAcceptTypes,;
+   INTEGER dwFlags,;
+   INTEGER dwContextw
+
+hHTTPResult=HttpOpenRequest(THIS.hhttpsession,;
+   IIF( tnPostSize > 0, "POST","GET"),;
+   tcPage,;
+   NULL,NULL,NULL,;
+   INTERNET_FLAG_RELOAD + IIF(THIS.lsecurelink,INTERNET_FLAG_SECURE,0),0)
+
+
+IF (hHTTPResult = 0)
+   THIS.nerror=GetLastError()
+   THIS.cerrormsg=THIS.getsystemerrormsg()
+   RETURN THIS.nerror
+ENDIF
+
+
+DECLARE INTEGER HttpSendRequest    ;
+   IN WININET.DLL ;
+   INTEGER hHTTPHandle,;
+   STRING lpzHeaders,;
+   INTEGER cbHeaders,;
+   STRING lpzPost,;
+   INTEGER cbPost
+
+lcHeaders=TRIM(tcHeaders)
+
+lnRetval=HttpSendRequest(hHTTPResult,;
+   lcHeaders,LEN(lcHeaders),;
+   lcPostBuffer,tnPostSize)
+
+IF lnRetval = 0
+   THIS.nerror=GetLastError()
+   THIS.cerrormsg=THIS.getsystemerrormsg()
+   RETURN THIS.nerror
+ENDIF
+
+DECLARE INTEGER HttpQueryInfo ;
+   IN WININET.DLL ;
+   INTEGER hHTTPHandle,;
+   INTEGER nType,;
+   STRING @cHeaders,;
+   INTEGER @cbHeaderSize,;
+   STRING cNULL
+
+lnRetval = HttpQueryInfo(hHTTPResult,;
+   HTTP_QUERY_RAW_HEADERS_CRLF,;
+   @tcHeaders,@tnHeaderSize,NULL)
+IF (lnRetval = 0)
+   THIS.nerror=GetLastError()
+   THIS.cerrormsg=THIS.getsystemerrormsg()
+   RETURN THIS.nerror
+ENDIF
+
+InternetCloseHandle(hHTTPResult);
+
+tcHeaders = (IIF(tnHeaderSize > 1,SUBSTR(tcHeaders,1,tnHeaderSize-1),""))
+
+RETURN lnError
+
+
+********************************************************
+* wwHTTP :: HTTPGetExAsync
+*********************************
+***  Function: Retrieves an HTTP request from the
+***            network asynchronously. This means the
+***            request fires and returns immediately
+***            without an error code. Operation runs on
+***            new thread in the background after returing
+***            control to VFP.
+***
+***            This method is fully self contained.
+***            You don't need to call HTTPOpen or HTTPClose.
+***
+***            This method allows full configuration
+***            of the request with: POST data, SSL,
+***            Passwords and creation of an output
+***            file.
+***
+***            Use AddPostKey to add POST vars. Use lSecureLink
+***            to enable SSL operation. Use cUserName and cPassword
+***            for passwords.
+***
+***            Output file option allows for async
+***            downloads and later checking for a result.
+***            Using a timer it's possible to fire 'events'
+***            when the download is complete.
+***
+***      Pass: tcURL        - Server relative link (/default.asp)
+***            tcResultFile - File where result get stored to
+***                           Make sure this is file unique...
+***            tnResultSize - If you're saving the result you
+***                           can use this to specify the size
+***                           Default is a small 256 (used for
+***                           not checking results).
+***      Used: lSecureLink, cUserName, cPassword, AddPostKey()
+***    Return: nothing
+***            If tcResultFile is passed you can check
+***            for this file. On success you'll get the
+***            document. On failure you get:
+***            Error: 
+*******************************************************
+FUNCTION httpgetexasync
+LPARAMETERS tcPage, tcResultFile, tnResultSize, tcHeaders
+LOCAL hHTTPResult
+
+*** Post Buffer and lSecureLink also apply via properties
+tcServer=THIS.cserver
+tcPage=IIF(EMPTY(tcPage),"/",tcPage)
+tcUserName=THIS.cusername
+tcPassword=THIS.cpassword
+tcResultFile=IIF(EMPTY(tcResultFile),"",tcResultFile)
+tnResultSize=IIF(EMPTY(tnResultSize),256,tnResultSize)
+
+IF !EMPTY(THIS.cPostBuffer)
+   tnPostSize=LEN(THIS.cPostBuffer)
+   lcPostBuffer= IIF(tnPostSize > 0,THIS.cPostBuffer,NULL)
+ELSE
+   tnPostSize=0
+   lcPostBuffer=NULL
+ENDIF
+
+
+IF tnPostSize > 0
+   IF EMPTY(tcHeaders)
+      IF THIS.nhttppostmode = 1
+         tcHeaders = "Content-Type: application/x-www-form-urlencoded"  + CR+;
+            IIF(!EMPTY(tcHeaders),CR+tcHeaders,"")
+      ELSE
+         tcHeaders = "Content-Type: multipart/form-data; boundary=" + MULTIPART_BOUNDARY + CR + CR +;
+            IIF(EMPTY(tcHeaders),"",tcHeaders)
+
+         IF tnPostSize > 0
+            lcPostBuffer = lcPostBuffer + MULTIPART_BOUNDARY + CR
+            tnPostSize=LEN(lcPostBuffer)
+         ENDIF
+      ENDIF
+   ENDIF
+ELSE
+   tcHeaders =  IIF(!EMPTY(tcHeaders),tcHeaders,"")
+ENDIF
+
+lcOldAlias=ALIAS()
+
+
+DECLARE HTTPGetExAsync ;
+   IN WWIPSTUFF.DLL ;
+   INTEGER hInternet,;
+   INTEGER hHTTP,;
+   STRING SERVER,;
+   STRING PAGE,;
+   STRING BUFFER,;
+   INTEGER BufferSize,;
+   STRING HEADER,;
+   STRING POST,;
+   INTEGER POSTSIZE,;
+   INTEGER SECURE,;
+   INTEGER CONNECTTYPE,;
+   STRING Username, STRING PASSWORD,;
+   STRING ResultFile,;
+   INTEGER ResultSize
+
+tcBuffer = SPACE(256)
+tnBufSize = LEN(tcBuffer)
+lnRet = httpgetexasync(THIS.hipsession, THIS.hhttpsession,;
+   tcServer,;
+   tcPage,;
+   tcBuffer,tnBufSize,;
+   tcHeaders,;
+   lcPostBuffer, tnPostSize,;
+   IIF(THIS.lsecurelink,1,0),;
+   THIS.nhttpconnecttype,;
+   tcUserName, tcPassword,;
+   tcResultFile,tnResultSize)
+
+*** Cause HTTPClose() to have no effect on these
+*** handles - the C thread code will clean these up
+THIS.hIPSession = 0
+THIS.hHTTPSession = 0
+
+RETURN
+
+
+************************************************************************
+* wwIPStuff :: HTTPGetHeader
+*********************************
+***  Function: Retrieves just the HTTP header of a page request.
+***    Assume: Must call HTTPConnect/HTTPClose to manage connection
+***            to Server
+***      Pass: tcPage    -    The Server relative page to view
+***            tcHeader  -    Buffer to receive headers (by reference)
+***            tnSize    -    Size of the Buffer (by Reference)
+***    Return: Win32API Error Code
+************************************************************************
+FUNCTION HTTPGetHeader
+LPARAMETERS tcPage, tcHeaders, tnHeaderSize
+LOCAL lnError, lnSize, lcBuffer
+
+tcHeaders=IIF(TYPE("tcHeaders")="C",tcHeaders,"")
+tnHeaderSize=IIF(TYPE("tnHeaderSize")="N",tnHeaderSize,2048)
+
+IF USED("wwPostBuffer")
+   SELE wwPostBuffer
+   tnPostSize=LEN(wwPostBuffer.cPostBuffer)
+   lcPostBuffer= IIF(tnPostSize > 0,wwPostBuffer.cPostBuffer,NULL)
+ELSE
+   tnPostSize=0
+   lcPostBuffer=NULL
+ENDIF
+
+DECLARE INTEGER HttpOpenRequest ;
+   IN WININET.DLL ;
+   INTEGER hHTTPHandle,;
+   STRING lpzReqMethod,;
+   STRING lpzPage,;
+   STRING lpzVersion,;
+   STRING lpzReferer,;
+   STRING lpzAcceptTypes,;
+   INTEGER dwFlags,;
+   INTEGER dwContextw
+
+hHTTPResult=HttpOpenRequest(THIS.hHTTPSession,;
+   IIF( tnPostSize > 0, "POST","GET"),;
+   tcPage,;
+   NULL,NULL,NULL,;
+   INTERNET_FLAG_RELOAD + IIF(THIS.lSecureLink,INTERNET_FLAG_SECURE,0),0)
+
+
+IF (hHTTPResult = 0)
+   THIS.nError=GetLastError()
+   THIS.cErrorMsg=THIS.GetSystemErrorMsg()
+   RETURN THIS.nError
+ENDIF
+
+
+DECLARE INTEGER HttpSendRequest    ;
+   IN WININET.DLL ;
+   INTEGER hHTTPHandle,;
+   STRING lpzHeaders,;
+   INTEGER cbHeaders,;
+   STRING lpzPost,;
+   INTEGER cbPost
+
+lcHeaders=TRIM(tcHeaders)
+
+lnRetval=HttpSendRequest(hHTTPResult,;
+   lcHeaders,LEN(lcHeaders),;
+   lcPostBuffer,tnPostSize)
+
+IF lnRetval = 0
+   THIS.nError=GetLastError()
+   THIS.cErrorMsg=THIS.GetSystemErrorMsg()
+   RETURN THIS.nError
+ENDIF
+
+DECLARE INTEGER HttpQueryInfo ;
+   IN WININET.DLL ;
+   INTEGER hHTTPHandle,;
+   INTEGER nType,;
+   STRING @cHeaders,;
+   INTEGER @cbHeaderSize,;
+   STRING cNULL
+
+lnRetval = HttpQueryInfo(hHTTPResult,;
+   HTTP_QUERY_RAW_HEADERS_CRLF,;
+   @tcHeaders,@tnHeaderSize,NULL)
+
+IF (lnRetval = 0)
+   THIS.nError=GetLastError()
+   THIS.cErrorMsg=THIS.GetSystemErrorMsg()
+   RETURN THIS.nError
+ENDIF
+
+InternetCloseHandle(hHTTPResult);
+
+tcHeaders = (IIF(tnHeaderSize > 1,SUBSTR(tcHeaders,1,tnHeaderSize-1),""))
+
+RETURN lnRetVal
+
+
+
+*-- Gets called whenever the buffer is updated on an HTTPGetEx update. Only applies if the buffer size is set to 0 (Automatic sizing)
+FUNCTION OnHTTPBufferUpdate
+   LPARAMETER lnBytesDownloaded,lnBufferReads,lcCurrentChunk
+ENDFUNC
+
+*-- Event that fires in HttpGetEx calls after the Connection is established
+*-- Can be used to set WinInet options or otherwise insert code to fire
+*-- before the request is sent to the server
+FUNCTION OnHttpPostConnect
+   LPARAMETERS lnHttpHandle
+ENDFUNC
+
+*-- Cancels an HTTPGetEx download if the buffer is sized dynamically
+FUNCTION httpcanceldownload
+   THIS.lhttpcanceldownload = .T.
+ENDFUNC
+  
+
+
+************************************************************************
+* wwHTTP :: UnZipFiles
+*********************************
+***  Function: Unzips files to a specified directory
+***    Assume: Requires DynaZip DLLs (dunzip32.dll)
+***      Pass: lcZipFile
+***            lcDestination  -  Dir to unzip to
+***            lcFileSpec     -  Files to unzip (*.*)
+***    Return: DynaZip Error Code or 0 on success
+************************************************************************
+FUNCTION UnZipFiles
+LPARAMETERS lcZipFile, lcDestination, lcFileSpec
+
+lcFileSpec=IIF(type("lcFileSpec")="C",lcFileSpec,"*.*")
+lcDestination=IIF(type("lcDestination")="C",lcDestination,SYS(5) + CURDIR())
+
+DECLARE INTEGER UnZip ;
+   IN (THIS.cDLLPath) ;
+   STRING ZipFile,;
+   STRING Destination,;
+   STRING FileSpec
+
+RETURN UnZip(lcZipFile,lcDestination,lcFileSpec)
+
+************************************************************************
+* wwHTTP :: ZipFiles
+*********************************
+***  Function: Zips files
+***    Assume: Function requires DynaZip DLLs (dzip32.dll)
+***      Pass: lcZipFile   - Fully qualified ZIP file name 
+***            lcFileList  - Comma Delimited file list (Wildcards OK)
+***    Return: DynaZip error code or 0
+************************************************************************
+FUNCTION ZipFiles
+LPARAMETERS lcZipFile, lcFileList, lnCompression, llRecurse
+
+lnCompression=IIF(type("lnCompression")="N",lnCompression,9)
+ 
+DECLARE INTEGER Zip ;
+   IN (THIS.cDLLPath) ;
+   STRING ZipFile,;
+   STRING FileList,;
+   INTEGER lnCompression,;
+   INTEGER lnRecurse
+
+RETURN Zip(lcZipFile,lcFileList,lnCompression,IIF(llRecurse,1,0))
+
+************************************************************************
+* wwHTTP :: DecodeDBF
+*********************************
+***  Function: Decodes a DBF file encoded EncodeDBF back into its
+***            DBF/FPT format
+***      Pass:
+***    Return:
+************************************************************************
+   FUNCTION DecodeDBF
+   LPARAMETERS lcBuffer,lcDBF
+   LOCAL lnSeparator, lcHeader, lcFname, lnSize1, lnSize2, lcDBF, lcFile1, lcFile2
+
+   IF LEN(lcBuffer)<105
+      RETURN .F.
+   ENDIF
+
+   lcHeader=SUBSTR(lcBuffer,1,105)
+   lcFname=TRIM(SUBSTR(lcBuffer,6,40))
+   lnSize1=VAL(SUBSTR(lcBuffer,46,10))
+   lnSize2=VAL(SUBSTR(lcBuffer,96,10))
+
+   *** Use parm or the filename specified in the header
+   lcDBF=IIF(EMPTY(lcDBF),lcFname,UPPER(lcDBF))
+
+   IF lcHeader # "wwDBF"
+      WAIT WINDOW NOWAIT "Invalid Decode File Header"
+      RETURN .F.
+   ENDIF
+
+   lcFile1=""
+   lcFile2=""
+
+   IF lnSize1 > 0
+      lcFile1=SUBSTR(lcBuffer,106,lnSize1)
+      IF LEN(lcFile1) < lnSize1
+         WAIT WINDOW NOWAIT "Invalid File Size: "+;
+            STR(LEN(lcFile1)) +" of "+ STR(lnSize1)
+         RETURN .F.
+      ENDIF
+   ENDIF
+   IF lnSize2 > 0
+      lcFile2=SUBSTR(lcBuffer,106 + lnSize1, lnSize2)
+      lnSizex=LEN(lcFile2)
+      IF LEN(lcFile2) < lnSize2 - 1
+         WAIT WINDOW NOWAIT "Invalid Memo File Size: " +;
+            STR(LEN(lcFile2)) +" of "+ STR(lnSize2)
+         RETURN .F.
+      ENDIF
+   ENDIF
+
+   =File2Var(lcDBF,lcFile1)
+
+   IF !EMPTY(lcFile2)
+      =File2Var(STRTRAN(lcDBF,".DBF",".FPT"),lcFile2)
+   ENDIF
+
+   RETURN .T.
+
+ENDFUNC
+* wwHTTP :: DecodeDBF
+
+
+********************************************************
+* wwHTTP :: EncodeDBF
+*********************************
+***  Function: This function encodes a DBF file ready to
+***            be sent up to a server using HTTPGetEx in
+***            the POST buffer. The file will be URL
+***            encoded.
+***    Assume: Note you can send a ZIP file here, too!
+***            105 byte header on top of file contains
+***            5 byte ID (wwDBF) filename (40 bytes) and
+***            size(10 bytes) for each file
+***      Pass: lcDBF     - Full DBF filename w/ ext
+***            llHasMemo - .t. or (.f.)
+***    Return: Encoded Buffer or "" on failure
+********************************************************
+FUNCTION EncodeDBF
+LPARAMETERS lcDBF, llHasMemo, lcEncodedName
+LOCAL lcBuffer1, lcBuffer2, lcDBF, lcHeader, lcFPT
+
+lcDBF=IIF(VARTYPE(lcDBF)="C",UPPER(lcDBF),"")
+IF EMPTY(lcEncodedName)
+   lcEncodedName = JUSTFNAME(lcDBF) 
+ENDIF
+
+IF !FILE(lcDBF)
+   RETURN ""
+ENDIF
+
+lcBuffer1=File2Var(lcDBF)
+lcHeader = "wwDBF" + PADR(lcEncodedName,40) + ;
+   STR(LEN(lcBuffer1),10)
+IF !llHasMemo
+   lcHeader=lcHeader+ SPACE(50)  && Pad out header
+   RETURN lcHeader + lcBuffer1
+ENDIF
+
+lcFPT=STRTRAN(LOWER(lcDBF),".dbf",".fpt")
+
+lcBuffer2=File2Var(lcFPT)
+lcHeader=lcHeader + PADR(FORCEEXT(lcEncodedName,"fpt"),40) + ;
+   STR(LEN(lcBuffer2),10)
+
+RETURN lcHeader + lcBuffer1 + lcBuffer2
+ENDFUNC
+
+************************************************************************
+* wwHTTP :: SetProxyLogin
+****************************************
+***  Function: Sets the HTTP Proxy username and password
+***    Assume: thanks to Erik Moore for providing this method
+***      Pass: tcUserName
+***            tcPassword
+***            hIPHandle   - HTTP Request handle (optional)
+***    Return: .T. or .F.
+************************************************************************
+PROTECTED FUNCTION SetProxyLogin(tcUserName, tcPassword, hIPHandle)
+
+LOCAL lcUsername, lcPassword, lpBuffer, lpdwBufferLength, nSuccess
+
+lcUserName = IIF(!EMPTY(tcUserName),tcUserName,THIS.cHTTPProxyUserName)
+lcPassword = IIF(!EMPTY(tcPassword),tcPassword,THIS.cHTTPProxyPassword)
+hIPHandle = IIF(EMPTY(hIPHandle),THIS.hHTTPSession,hIPHandle)
+
+IF EMPTY(lcUsername)
+   RETURN
+ENDIF   
+
+DECLARE INTEGER InternetSetOption IN WinInet.dll ;
+    INTEGER hInternet, ;
+    INTEGER dwOption, ;
+    STRING @lpBuffer, ;
+    LONG lpdwBufferLength
+
+INTERNET_OPTION_PROXY_USERNAME = 43
+INTERNET_OPTION_PROXY_PASSWORD = 44
+
+IF !EMPTY(lcUserName)
+    lpBuffer = lcUserName 
+    dwBufferLength = LEN(lpBuffer) 
+    dwOption = INTERNET_OPTION_PROXY_USERNAME
+    nSuccess = InternetSetOption(hIPHandle, dwOption, @lpBuffer, dwBufferLength)
+    IF nSuccess <> 1
+         THIS.nError = GetLastError()
+         THIS.cErrorMsg = THIS.GetSystemErrorMsg(THIS.nError)
+         RETURN .F.
+     ENDIF
+ENDIF
+
+IF !EMPTY(lcPassword)
+   lpBuffer = lcpassword
+   dwBufferLength = LEN(lpBuffer) 
+   dwOption = INTERNET_OPTION_PROXY_PASSWORD
+   nSuccess = InternetSetOption(hIPHandle, dwOption, @lpBuffer, dwBufferLength)
+   IF nSuccess <> 1
+      THIS.nError = GetLastError()
+      THIS.cErrorMsg = THIS.GetSystemErrorMsg(THIS.nError)
+      RETURN .F.
+   ENDIF
+ENDIF
+
+RETURN .T.
+ENDFUNC
+
+
+
+
+************************************************************************
+* wwHTTP :: HTTPPing
+****************************************
+***  Function: Checks whether a site is up by a timeout value
+***    Assume: IE 5.5 or later is installed
+***      Pass: lnTimeout   -   in seconds
+***            lcServer    -   (ie. www.west-wind.com)
+***            lcLink      -   optional link to hit (/default.htm)
+***    Return:
+************************************************************************
+FUNCTION httpping
+LPARAMETER lnTimeout, lcServer, lcLink
+LOCAL lcFile, llSuccess, lnHandle
+
+IF EMPTY(lcLink)
+   lcLink = "/"
+ENDIF
+
+lnSaveTimeout = THIS.nConnectTimeout
+THIS.nConnectTimeout = lnTimeout
+  
+lcResult = THIS.HTTPGet("http://" + lcServer + lcLink)
+
+THIS.nConnectTimeout = lnSaveTimeout
+
+IF THIS.nError = 0
+   RETURN .T.
+ENDIF
+
+RETURN .F.
+
+
+************************************************************************
+* wwHTTP :: InternetCrackUrl
+*********************************
+***  Function: Breaks out a URL into its component pieces
+***      Pass: lcURL  -  URL to crack
+***    Return: loUrl  or NULL
+************************************************************************
+FUNCTION InternetCrackUrl
+LPARAMETERS lcUrl
+LOCAL  lnAT, lcProtocol, lcQuerystring, lcPort, lcServer
+
+*lcUrl = LOWER(lcUrl)
+
+*** Find the querystring first
+lnAT = AT("?",lcUrl)
+IF lnAT > 0
+   lcQuerystring = SUBSTR(lcUrl,lnAT)
+   lcUrl = LEFT(lcUrl,lnAT-1)
+ELSE
+   lcQuerystring = ""
+ENDIF
+
+lnAT = AT("://",lcUrl)
+IF lnAT < 1
+   RETURN .NULL.
+ENDIF
+
+lcProtocol = lower(LEFT(lcUrl,lnAT-1))
+DO CASE
+CASE lcProtocol == "http"
+   lcPort = "80"
+CASE lcProtocol == "https"
+   lcPort = "443"
+CASE lcProtocol == "ftp"
+   lcPort = "21"
+OTHERWISE
+   *** Assume HTTP
+   lcPort = "80"   
+ENDCASE
+
+lcUrl = SUBSTR(lcUrl,lnAT + 3)
+lnAT = AT(":",lcUrl)
+
+IF lnAT > 0
+   lcPort = Extract(lcUrl,":","/",,.T.)
+   lcServer = LEFT(lcUrl,lnAT-1)
+   lcUrl = SUBSTR(lcUrl,lnAT + LEN(lcPort) + 1)
+ELSE
+   lnAT = AT("/",lcUrl)
+   IF lnAT = 0
+      lcServer = lcUrl
+      lcUrl = ""
+   ELSE
+      lcServer = SUBSTR(lcUrl,1,lnAT-1)
+      lcURL = SUBSTR(lcUrl,lnAt) 
+   ENDIF
+ENDIF
+
+loUrl = CREATE("RELATION")
+loUrl.ADDPROPERTY("cProtocol",lcProtocol)
+loUrl.ADDPROPERTY("cServer",lcServer)
+loUrl.ADDPROPERTY("cPath",lcUrl)  && What's left of the url
+loUrl.ADDPROPERTY("cquerystring",lcQuerystring)
+loUrl.ADDPROPERTY("cPort",lcPort)
+
+*** Not implementented
+loURL.AddProperty("cUserName","")
+loUrl.AddProperty("cPassword","")
+
+RETURN loUrl
+ENDFUNC
+* wwHTTP :: InternetCrackUrl   FUNCTION InternetCrackUrl
+
+********************************************************
+* wwHTTP :: WinInetSetTimeout
+*********************************
+***  Function: Sets various timeout for use with a
+***            WinInet Connection
+***      Pass: dwTimeoutSecs - Secs to wait for timeout
+********************************************************
+FUNCTION wininetsettimeout
+LPARAMETERS dwTimeoutSecs, lnHandle
+
+dwTimeoutSecs=IIF(VARTYPE(dwTimeoutSecs)="N",;
+   dwTimeoutSecs,THIS.nconnecttimeout) 
+   
+IF dwTimeoutSecs = 0
+   *** Just use the default
+   RETURN
+ENDIF   
+
+IF EMPTY(lnHandle)
+   lnHandle = THIS.hIPSession
+ENDIF      
+
+DECLARE INTEGER InternetSetOption ;
+   IN WININET.DLL ;
+   INTEGER HINTERNET,;
+   INTEGER dwFlags,;
+   INTEGER @dwValue,;
+   INTEGER 
+
+
+dwTimeoutSecs=dwTimeoutSecs * 1000   && to milliseconds
+llRetVal=InternetSetOption(lnHandle,;
+   INTERNET_OPTION_CONNECT_TIMEOUT,;
+   @dwTimeoutSecs,4)
+
+llRetVal=InternetSetOption(lnHandle,;
+   INTERNET_OPTION_RECEIVE_TIMEOUT,;
+   @dwTimeoutSecs,4)
+
+llRetVal=InternetSetOption(lnHandle,;
+   INTERNET_OPTION_SEND_TIMEOUT,;
+   @dwTimeoutSecs,4)
+
+*   dwTimeoutSecs=1  &&// Retry only 1 time
+*   llRetVal=InternetSetOption(lnHandle,;
+*      INTERNET_OPTION_CONNECT_RETRIES,;
+*      @dwTimeoutSecs,4)
+RETURN
+
+
+
+************************************************************************
+* wwHTTP :: GetLastInternetError
+*********************************
+***  Function: Retrieves the last WinInet error using WinInet's error
+***            responses.
+***    Assume: Currently not used by class internally
+***            Under Construction
+***      Pass: lnError   -  Error Code to resolve(Optional)
+***    Return: Error Message or ""
+************************************************************************
+   FUNCTION getlastinterneterror
+   LPARAMETERS lnError
+
+   lnError=IIF(TYPE("lnError")="N",lnError,THIS.nerror)
+
+   DECLARE INTEGER InternetGetLastResponseInfo ;
+      IN WININET.DLL ;
+      INTEGER @lpdwError,;
+      STRING @lpszBuffer,;
+      INTEGER @lpcbSize
+
+   lcErrorMsg=SPACE(1024)
+   lnSize=LEN(lcErrorMsg)
+
+   =InternetGetLastResponseInfo(@lnError,@lcErrorMsg,@lnSize)
+
+   IF lnSize < 2
+      RETURN ""
+   ENDIF
+
+   RETURN SUBSTR(lcErrorMsg,1,lnSize)
+ENDFUNC
+
+************************************************************************
+* wwHTTP :: GetPostBuffer
+*********************************
+***  Function: Returns the entire Post Buffer as a string
+************************************************************************
+FUNCTION getpostbuffer
+RETURN THIS.cPostBuffer
+ENDFUNC
+
+
+********************************************************
+* wwHTTP :: GetSystemErrorMsg
+*********************************
+***  Function: Returns an Error Message for the last
+***            error value set in nError property.
+***    Assume: nError was set by last operation
+***    Return: Error String or ""
+********************************************************
+FUNCTION getsystemerrormsg
+LPARAMETERS lnErrorNo, llAPI
+LOCAL szMsgBuffer,lnSize
+
+lnErrorNo=IIF(TYPE("lnErrorNo")="N",lnErrorNo,THIS.nerror)
+
+IF lnErrorNo = ERROR_INTERNET_EXTENDED_ERROR
+   RETURN THIS.getlastinterneterror()
+ENDIF
+
+szMsgBuffer=SPACE(500)
+DECLARE INTEGER FormatMessage ;
+   IN WIN32API ;
+   INTEGER dwFlags ,;
+   INTEGER lpvSource,;
+   INTEGER dwMsgId,;
+   INTEGER dwLangId,;
+   STRING @lpBuffer,;
+   INTEGER nSize,;
+   INTEGER  Arguments
+
+DECLARE INTEGER GetModuleHandle ;
+   IN WIN32API ;
+   STRING
+
+lnModule=GetModuleHandle("wininet.dll")
+IF lnModule # 0 AND !llAPI
+   lnSize=FormatMessage(FORMAT_MESSAGE_FROM_HMODULE,lnModule,lnErrorNo,;
+      0,@szMsgBuffer,LEN(szMsgBuffer),0)
+ELSE
+   lnSize=0
+ENDIF
+
+IF lnSize > 2
+   szMsgBuffer=SUBSTR(szMsgBuffer,1, lnSize -2  )
+ELSE
+   *** REtry with 12000 less - WinInet return Windows API file error codes
+   lnSize=FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,0,lnErrorNo,;
+      0,@szMsgBuffer,LEN(szMsgBuffer),0)
+
+   IF lnSize > 2
+      szMsgBuffer="Win32 API: " + SUBSTR(szMsgBuffer,1, lnSize-2 )
+   ELSE
+      szMsgBuffer=""
+   ENDIF
+ENDIF
+
+RETURN szMsgBuffer
+ENDFUNC
+
+
+
+************************************************************************
+* wwHTTP :: Destroy
+*********************************
+***  Function: Clears HTTP Session Handles if open
+************************************************************************
+FUNCTION DESTROY
+
+IF THIS.hipsession # 0 OR THIS.hhttpsession # 0
+   THIS.httpclose()
+ENDIF
+
+ENDFUNC
+
+
+
+ENDDEFINE
+*
+*-- EndDefine: wwHTTP
+**************************************************
diff --git a/comun_plugins/utils/wwapi.PRG b/comun_plugins/utils/wwapi.PRG
new file mode 100644
index 0000000..cd4dcf0
--- /dev/null
+++ b/comun_plugins/utils/wwapi.PRG
@@ -0,0 +1,929 @@
+#INCLUDE WCONNECT.H
+
+#DEFINE MAX_INI_BUFFERSIZE  		512
+#DEFINE MAX_INI_ENUM_BUFFERSIZE 	8196
+
+*************************************************************
+DEFINE CLASS wwAPI AS Custom
+*************************************************************
+***    Author: Rick Strahl
+***            (c) West Wind Technologies, 1997
+***   Contact: (541) 386-2087  / rstrahl@west-wind.com
+***  Function: Encapsulates several Windows API functions
+*************************************************************
+
+*** Custom Properties
+nLastError=0
+
+FUNCTION Init
+************************************************************************
+* wwAPI :: Init
+*********************************
+***  Function: DECLARES commonly used DECLAREs so they're not redefined
+***            on each call to the methods.
+************************************************************************
+
+DECLARE INTEGER GetPrivateProfileString ;
+   IN WIN32API ;
+   STRING cSection,;
+   STRING cEntry,;
+   STRING cDefault,;
+   STRING @cRetVal,;
+   INTEGER nSize,;
+   STRING cFileName
+
+DECLARE INTEGER GetCurrentThread ;
+   IN WIN32API 
+   
+DECLARE INTEGER GetThreadPriority ;
+   IN WIN32API ;
+   INTEGER tnThreadHandle
+
+DECLARE INTEGER SetThreadPriority ;
+   IN WIN32API ;
+   INTEGER tnThreadHandle,;
+   INTEGER tnPriority
+
+*** Open Registry Key
+DECLARE INTEGER RegOpenKey ;
+        IN Win32API ;
+        INTEGER nHKey,;
+        STRING cSubKey,;
+        INTEGER @nHandle
+
+*** Create a new Key
+DECLARE Integer RegCreateKey ;
+        IN Win32API ;
+        INTEGER nHKey,;
+        STRING cSubKey,;
+        INTEGER @nHandle
+
+*** Close an open Key
+DECLARE Integer RegCloseKey ;
+        IN Win32API ;
+        INTEGER nHKey
+  
+ENDFUNC
+* Init
+
+FUNCTION MessageBeep
+************************************************************************
+* wwAPI :: MessageBeep
+**********************
+***  Function: MessageBeep API call runs system sounds
+***      Pass: lnSound   -   Uses FoxPro.h MB_ICONxxxxx values
+***    Return: nothing
+************************************************************************
+LPARAMETERS lnSound
+DECLARE INTEGER MessageBeep ;
+   IN WIN32API AS MsgBeep ;
+   INTEGER nSound
+=MsgBeep(lnSound)
+ENDFUNC
+* MessageBeep
+
+FUNCTION ReadRegistryString
+************************************************************************
+* wwAPI :: ReadRegistryString
+*********************************
+***  Function: Reads a string value from the registry.
+***      Pass: tnHKEY    -  HKEY value (in CGIServ.h)
+***            tcSubkey  -  The Registry subkey value
+***            tcEntry   -  The actual Key to retrieve
+***            tlInteger -  Optional - Return an DWORD value
+***    Return: Registry String or .NULL. on not found
+************************************************************************
+LPARAMETERS tnHKey, tcSubkey, tcEntry, tlInteger
+LOCAL lnRegHandle, lnResult, lnSize, lcDataBuffer, tnType
+
+tnHKey=IIF(vartype(tnHKey)="N",tnHKey,HKEY_LOCAL_MACHINE)
+
+lnRegHandle=0
+
+*** Open the registry key
+lnResult=RegOpenKey(tnHKey,tcSubKey,@lnRegHandle)
+IF lnResult#ERROR_SUCCESS
+   *** Not Found
+   RETURN .NULL.
+ENDIF   
+
+*** Return buffer to receive value
+IF !tlInteger
+*** Need to define here specifically for Return Type
+*** for lpdData parameter or VFP will choke.
+*** Here it's STRING.
+DECLARE INTEGER RegQueryValueEx ;
+        IN Win32API ;
+        INTEGER nHKey,;
+        STRING lpszValueName,;
+        INTEGER dwReserved,;
+        INTEGER @lpdwType,;
+        STRING @lpbData,;
+        INTEGER @lpcbData
+        
+	lcDataBuffer=space(MAX_INI_BUFFERSIZE)
+	lnSize=LEN(lcDataBuffer)
+	lnType=REG_DWORD
+
+	lnResult=RegQueryValueEx(lnRegHandle,tcEntry,0,@lnType,;
+                         @lcDataBuffer,@lnSize)
+ELSE
+*** Need to define here specifically for Return Type
+*** for lpdData parameter or VFP will choke. 
+*** Here's it's an INTEGER
+DECLARE INTEGER RegQueryValueEx ;
+        IN Win32API AS RegQueryInt;
+        INTEGER nHKey,;
+        STRING lpszValueName,;
+        INTEGER dwReserved,;
+        Integer @lpdwType,;
+        INTEGER @lpbData,;
+        INTEGER @lpcbData
+
+	lcDataBuffer=0
+	lnSize=4
+	lnType=REG_DWORD
+	lnResult=RegQueryInt(lnRegHandle,tcEntry,0,@lnType,;
+	                         @lcDataBuffer,@lnSize)
+	IF lnResult = ERROR_SUCCESS
+	   RETURN lcDataBuffer
+	ELSE
+       RETURN -1
+	ENDIF
+ENDIF
+=RegCloseKey(lnRegHandle)
+
+IF lnResult#ERROR_SUCCESS 
+   *** Not Found
+   RETURN .NULL.
+ENDIF   
+
+IF lnSize<2
+   RETURN ""
+ENDIF
+   
+*** Return string and strip out NULLs
+RETURN SUBSTR(lcDataBuffer,1,lnSize-1)
+ENDFUNC
+* ReadRegistryString
+
+************************************************************************
+* Registry :: WriteRegistryString
+*********************************
+***  Function: Writes a string value to the registry.
+***            If the value doesn't exist it's created. If the key
+***            doesn't exist it is also created, but this will only
+***            succeed if it's the last key on the hive.
+***      Pass: tnHKEY    -  HKEY value (in WCONNECT.h)
+***            tcSubkey  -  The Registry subkey value
+***            tcEntry   -  The actual Key to write to
+***            tcValue   -  Value to write or .NULL. to delete key
+***            tlCreate  -  Create if it doesn't exist
+***    Assume: Use with extreme caution!!! Blowing your registry can
+***            hose your system!
+***    Return: .T. or .NULL. on error
+************************************************************************
+FUNCTION WriteRegistryString
+LPARAMETERS tnHKey, tcSubkey, tcEntry, tcValue,tlCreate
+LOCAL lnRegHandle, lnResult, lnSize, lcDataBuffer, tnType
+
+tnHKey=IIF(type("tnHKey")="N",tnHKey,HKEY_LOCAL_MACHINE)
+
+lnRegHandle=0
+
+lnResult=RegOpenKey(tnHKey,tcSubKey,@lnRegHandle)
+IF lnResult#ERROR_SUCCESS
+   IF !tlCreate
+      RETURN .F.
+   ELSE
+      lnResult=RegCreateKey(tnHKey,tcSubKey,@lnRegHandle)
+      IF lnResult#ERROR_SUCCESS
+         RETURN .F.
+      ENDIF  
+   ENDIF
+ENDIF   
+
+*** Need to define here specifically for Return Type!
+*** Here lpbData is STRING.
+DECLARE INTEGER RegSetValueEx ;
+        IN Win32API ;
+        INTEGER nHKey,;
+        STRING lpszEntry,;
+        INTEGER dwReserved,;
+        INTEGER fdwType,;
+        STRING lpbData,;
+        INTEGER cbData
+
+*** Check for .NULL. which means delete key
+IF !ISNULL(tcValue)
+  *** Nope - write new value
+  lnSize=LEN(tcValue)
+  if lnSize=0
+     tcValue=CHR(0)
+  ENDIF
+
+  lnResult=RegSetValueEx(lnRegHandle,tcEntry,0,REG_SZ,;
+                         tcValue,lnSize)
+ELSE
+  *** Delete a value from a key
+  DECLARE INTEGER RegDeleteValue ;
+          IN Win32API ;
+          INTEGER nHKEY,;
+          STRING cEntry
+
+  *** DELETE THE KEY
+  lnResult=RegDeleteValue(lnRegHandle,tcEntry)
+ENDIF                         
+
+=RegCloseKey(lnRegHandle)
+                        
+IF lnResult#ERROR_SUCCESS
+   RETURN .F.
+ENDIF   
+
+RETURN .T.
+ENDPROC
+* WriteRegistryString
+
+FUNCTION EnumKey
+************************************************************************
+* wwAPI :: EnumRegistryKey
+*********************************
+***  Function: Returns a registry key name based on an index
+***            Allows enumeration of keys in a FOR loop. If key
+***            is empty end of list is reached.
+***      Pass: tnHKey    -   HKEY_ root key
+***            tcSubkey  -   Subkey string
+***            tnIndex   -   Index of key name to get (0 based)
+***    Return: "" on error - Key name otherwise
+************************************************************************
+LPARAMETERS tnHKey, tcSubKey, tnIndex 
+LOCAL lcSubKey, lcReturn, lnResult, lcDataBuffer
+
+lnRegHandle=0
+
+*** Open the registry key
+lnResult=RegOpenKey(tnHKey,tcSubKey,@lnRegHandle)
+IF lnResult#ERROR_SUCCESS
+   *** Not Found
+   RETURN .NULL.
+ENDIF   
+
+DECLARE Integer RegEnumKey ;
+  IN WIN32API ;
+  INTEGER nHKey, ;
+  INTEGER nIndex, ;
+  STRING @cSubkey, ;  
+  INTEGER nSize
+
+lcDataBuffer=SPACE(MAX_INI_BUFFERSIZE)
+lnSize=MAX_INI_BUFFERSIZE
+lnResult=RegENumKey(lnRegHandle, tnIndex, @lcDataBuffer, lnSize)
+
+=RegCloseKey(lnRegHandle)
+
+IF lnResult#ERROR_SUCCESS 
+   *** Not Found
+   RETURN .NULL.
+ENDIF   
+
+RETURN TRIM(CHRTRAN(lcDataBuffer,CHR(0),""))
+ENDFUNC
+* EnumRegistryKey
+
+
+FUNCTION GetProfileString
+************************************************************************
+* wwAPI :: GetProfileString
+***************************
+***  Modified: 09/26/95
+***  Function: Read Profile String information from a given
+***            text file using Windows INI formatting conventions
+***      Pass: pcFileName   -    Name of INI file
+***            pcSection    -    [Section] in the INI file ("Drivers")
+***            pcEntry      -    Entry to retrieve ("Wave")
+***                              If this value is a null string
+***                              all values for the section are
+***                              retrieved seperated by CHR(13)s
+***    Return: Value(s) or .NULL. if not found
+************************************************************************
+LPARAMETERS pcFileName,pcSection,pcEntry, pnBufferSize
+LOCAL lcIniValue, lnResult
+
+*pcFileName=IIF(TYPE("pcFileName")="C",pcFileName,"")
+*pcSection=IIF(TYPE("pcSection")="C",pcSection,"")
+
+*** Default to 0, which means all entries!
+*pcEntry=IIF(TYPE("pcEntry")="C",pcEntry,0)
+
+*** Initialize buffer for result
+lcIniValue=SPACE(IIF( type("pnBufferSize")="N",pnBufferSize,MAX_INI_BUFFERSIZE) )
+
+lnResult=GetPrivateProfileString(pcSection,pcEntry,"*None*",;
+   @lcIniValue,LEN(lcIniValue),pcFileName)
+
+*** Strip out Nulls
+IF TYPE("pcEntry")="N" AND pcEntry=0
+   *** 0 was passed to get all entry labels
+   *** Seperate all of the values with a Carriage Return
+   lcIniValue=TRIM(CHRTRAN(lcIniValue,CHR(0),CHR(13)) )
+ELSE
+   *** Individual Entry
+   lcIniValue=SUBSTR(lcIniValue,1,lnResult)
+ENDIF
+
+*** On error the result contains "*None"
+IF lcIniValue="*None*"
+   lcIniValue=.NULL.
+ENDIF
+
+RETURN lcIniValue
+ENDFUNC
+* GetProfileString
+
+************************************************************************
+* wwAPI :: GetProfileSections
+*********************************
+***  Function: Retrieves all sections of an INI File
+***      Pass: @laSections   -   Empty array to receive sections
+***            lcIniFile     -   Name of the INI file
+***            lnBufSize     -   Size of result buffer (optional)
+***    Return: Count of Sections  
+************************************************************************
+FUNCTION aProfileSections
+LPARAMETERS laSections, lcIniFile
+LOCAL lnBufsize, lcBuffer, lnSize, lnResult, lnCount
+
+lnBufsize=IIF(EMPTY(lnBufsize),16484,lnBufsize)
+
+DECLARE INTEGER GetPrivateProfileSectionNames ;
+   IN WIN32API ;
+   STRING @lpzReturnBuffer,;
+   INTEGER nSize,;
+   STRING lpFileName
+   
+lcBuffer = SPACE(lnBufSize)
+lnSize = lEN(lcBuffer)   
+lnResult = GetPrivateProfileSectionNames(@lcBuffer,lnSize,lcIniFile)
+IF lnResult < 3
+   RETURN 0
+ENDIF
+
+lnCount = aParseString(@laSections,TRIM(lcBuffer),CHR(0))
+lnCount = lnCount - 2
+IF lnCount > 0
+  DIMENSION laSections[lnCount]
+ENDIF
+
+RETURN lnCount
+ENDFUNC
+* wwAPI :: aProfileSections
+
+************************************************************************
+* wwAPI :: WriteProfileString
+*********************************
+***  Function: Writes a value back to an INI file
+***      Pass: pcFileName    -   Name of the file to write to
+***            pcSection     -   Profile Section
+***            pcKey         -   The key to write to
+***            pcValue       -   The value to write
+***    Return: .T. or .F.
+************************************************************************
+FUNCTION WriteProfileString
+LPARAMETERS pcFileName,pcSection,pcEntry,pcValue
+
+   DECLARE INTEGER WritePrivateProfileString ;
+      IN WIN32API ;
+      STRING cSection,STRING cEntry,STRING cEntry,;
+      STRING cFileName
+
+   lnRetVal=WritePrivateProfileString(pcSection,pcEntry,pcValue,pcFileName)
+
+   if lnRetval=1
+      RETURN .t.
+   endif
+   
+   RETURN .f.
+ENDFUNC
+* WriteProfileString
+
+FUNCTION GetTempPath
+************************************************************************
+* wwAPI :: GetTempPath
+***********************
+***  Function: Returns the OS temporary files path
+***    Return: Temp file path with trailing "\"
+************************************************************************
+LOCAL lcPath, lnResult
+
+*** API Definition:
+*** ---------------
+*** DWORD GetTempPath(cchBuffer, lpszTempPath)
+***
+*** DWORD cchBuffer;	/* size, in characters, of the buffer	*/
+*** LPTSTR lpszTempPath;	/* address of buffer for temp. path name	*/
+DECLARE INTEGER GetTempPath ;
+   IN WIN32API AS GetTPath ;
+   INTEGER nBufSize, ;
+   STRING @cPathName
+
+lcPath=SPACE(256)
+lnSize=LEN(lcPath)
+
+lnResult=GetTPath(lnSize,@lcPath)
+
+IF lnResult=0
+   lcPath=""
+ELSE
+   lcPath=SUBSTR(lcPath,1,lnResult)
+ENDIF
+
+RETURN lcPath
+ENDFUNC
+* eop GetTempPath
+
+FUNCTION GetEXEFile
+************************************************************************
+* wwAPI :: GetEXEFileName
+*********************************
+***  Function: Returns the Module name of the EXE file that started
+***            the current application. Unlike Application.Filename
+***            this function correctly returns the name of the EXE file
+***            for Automation servers too!
+***    Return: Filename or ""  (VFP.EXE is returned in Dev Version)
+************************************************************************
+DECLARE integer GetModuleFileName ;
+   IN WIN32API ;
+   integer hinst,;
+   string @lpszFilename,;
+   integer @cbFileName
+   
+lcFilename=space(256)
+lnBytes=255   
+
+=GetModuleFileName(0,@lcFileName,@lnBytes)
+
+lnBytes=AT(CHR(0),lcFileName)
+IF lnBytes > 1
+  lcFileName=SUBSTR(lcFileName,1,lnBytes-1)
+ELSE
+  lcFileName=""
+ENDIF       
+
+RETURN lcFileName
+ENDFUNC
+* GetEXEFileName
+
+
+************************************************************************
+* WinApi :: ShellExecute
+*********************************
+***    Author: Rick Strahl, West Wind Technologies
+***            http://www.west-wind.com/ 
+***  Function: Opens a file in the application that it's
+***            associated with.
+***      Pass: lcFileName  -  Name of the file to open
+***            lcWorkDir   -  Working directory
+***            lcOperation -  
+***    Return: 2  - Bad Association (invalid URL)
+***            31 - No application association
+***            29 - Failure to load application
+***            30 - Application is busy 
+***
+***            Values over 32 indicate success
+***            and return an instance handle for
+***            the application started (the browser) 
+************************************************************************
+***         FUNCTION ShellExecute
+***         LPARAMETERS lcFileName, lcWorkDir, lcOperation
+***         
+***         lcWorkDir=IIF(type("lcWorkDir")="C",lcWorkDir,"")
+***         lcOperation=IIF(type("lcOperation")="C",lcOperation,"Open")
+***         
+***         DECLARE INTEGER ShellExecute ;
+***             IN SHELL32.DLL ;
+***             INTEGER nWinHandle,;
+***             STRING cOperation,;   
+***             STRING cFileName,;
+***             STRING cParameters,;
+***             STRING cDirectory,;
+***             INTEGER nShowWindow
+***            
+***         RETURN ShellExecute(0,lcOperation,lcFilename,"",lcWorkDir,1)
+***         ENDFUNC
+***         * ShellExecute
+
+************************************************************************
+* wwAPI :: CopyFile
+*********************************
+***  Function: Copies File. Faster than Fox Copy and handles
+***            errors internally.
+***      Pass: tcSource -  Source File
+***            tcTarget -  Target File
+***            tnFlag   -  0* override, 1 don't
+***    Return: .T. or .F.
+************************************************************************
+FUNCTION CopyFile
+LPARAMETERS lcSource, lcTarget,nFlag
+LOCAL lnRetVal 
+
+*** Copy File and overwrite
+nFlag=IIF(type("nFlag")="N",nFlag,0)
+
+DECLARE INTEGER CopyFile ;
+   IN WIN32API ;
+   STRING @cSource,;
+   STRING @cTarget,;
+   INTEGER nFlag
+
+lnRetVal=CopyFile(@lcSource,@lcTarget,nFlag)
+
+RETURN IIF(lnRetVal=0,.F.,.T.)
+ENDPROC
+* CopyFile
+
+FUNCTION GetUserName
+
+
+DECLARE INTEGER GetUserName ;
+     IN WIN32API ;
+     STRING@ cComputerName,;
+     INTEGER@ nSize
+
+lcComputer=SPACE(80)
+lnSize=80
+
+=GetUserName(@lcComputer,@lnSize)
+IF lnSize < 2
+   RETURN ""
+ENDIF   
+
+RETURN SUBSTR(lcComputer,1,lnSize-1)
+
+FUNCTION GetComputerName
+************************************************************************
+* wwAPI :: GetComputerName
+*********************************
+***  Function: Returns the name of the current machine
+***    Return: Name of the computer
+************************************************************************
+
+DECLARE INTEGER GetComputerName ;
+     IN WIN32API ;
+     STRING@ cComputerName,;
+     INTEGER@ nSize
+
+lcComputer=SPACE(80)
+lnSize=80
+
+=GetComputername(@lcComputer,@lnSize)
+IF lnSize < 2
+   RETURN ""
+ENDIF   
+
+RETURN SUBSTR(lcComputer,1,lnSize)
+ENDFUNC
+* GetComputerName
+
+
+FUNCTION LogonUser
+************************************************************************
+* wwAPI :: LogonUser
+*********************************
+***  Function: Check whether a username and password is valid
+***    Assume: Account checking must have admin rights
+***      Pass: Username, Password and optionally a server
+***    Return: .T. or .F.
+************************************************************************
+LPARAMETERS lcUsername, lcPassword, lcServer
+
+IF EMPTY(lcUsername)
+   RETURN .F.
+ENDIF
+IF EMPTY(lcPassword)
+   lcPassword = ""
+ENDIF
+IF EMPTY(lcServer)
+   lcServer = "."
+ENDIF         
+
+#define LOGON32_LOGON_INTERACTIVE   2
+#define LOGON32_LOGON_NETWORK       3
+#define LOGON32_LOGON_BATCH         4
+#define LOGON32_LOGON_SERVICE       5
+
+#define LOGON32_PROVIDER_DEFAULT    0
+
+DECLARE INTEGER LogonUser in WIN32API ;
+       String lcUser,;
+       String lcServer,;
+       String lcPassword,;
+       INTEGER dwLogonType,;
+       Integer dwProvider,;
+       Integer @dwToken
+       
+lnToken = 0
+lnResult = LogonUser(lcUsername,lcServer,lcPassword,;
+                     LOGON32_LOGON_NETWORK,LOGON32_PROVIDER_DEFAULT,@lnToken) 
+
+DECLARE INTEGER CloseHandle IN WIN32API INTEGER
+CloseHandle(lnToken)
+
+RETURN IIF(lnResult=1,.T.,.F.)
+ENDFUNC
+* wwAPI :: LogonUser
+
+FUNCTION GetSystemDir
+************************************************************************
+* wwAPI :: GetSystemDir
+*********************************
+***  Function: Returns the Windows System directory path
+***      Pass: llWindowsDir - Optional: Retrieve the Windows dir
+***    Return: Windows System directory or "" if failed
+************************************************************************
+LPARAMETER llWindowsDir
+LOCAL lcPath, lnSize
+
+lcPath=SPACE(256)
+
+IF !llWindowsDir
+	DECLARE INTEGER GetSystemDirectory ;
+	   IN Win32API ;
+	   STRING  @pszSysPath,;
+	   INTEGER cchSysPath
+	lnsize=GetSystemDirectory(@lcPath,256) 
+ELSE
+	DECLARE INTEGER GetWindowsDirectory ;
+	   IN Win32API ;
+	   STRING  @pszSysPath,;
+	   INTEGER cchSysPath
+	lnsize=GetWindowsDirectory(@lcPath,256) 
+ENDIF 
+
+if lnSize > 0
+   RETURN SUBSTR(lcPath,1,lnSize) + "\"
+ENDIF
+   
+RETURN ""
+ENDFUNC
+* GetSystemDir
+   
+
+FUNCTION GetCurrentThread
+************************************************************************
+* wwAPI :: GetCurrentThread
+*********************************
+***  Function: Returns handle to the current Process/Thread
+***    Return: Process Handle or 0
+************************************************************************
+RETURN GetCurrentThread()
+ENDFUNC
+* GetProcess
+
+************************************************************************
+* wwAPI :: GetThreadPriority
+*********************************
+***  Function: Gets the current Priority setting of the thread.
+***            Use to save and reset priority when bumping it up.
+***      Pass: tnThreadHandle
+************************************************************************
+FUNCTION GetThreadPriority
+LPARAMETER tnThreadHandle
+RETURN GetThreadPriority(tnThreadHandle)
+ENDFUNC
+* GetThreadPriority
+
+FUNCTION SetThreadPriority
+************************************************************************
+* wwAPI :: SetThreadPriority
+*********************************
+***  Function: Sets a thread process priority. Can dramatically
+***            increase performance of a task.
+***      Pass: tnThreadHandle
+***            tnPriority         0 - Normal
+***                               1 - Above Normal
+***                               2 - Highest Priority
+***                              15 - Time Critical
+***                              31 - Real Time (doesn't work w/ Win95)
+************************************************************************
+LPARAMETER tnThreadHandle,tnPriority
+RETURN SetThreadPriority(tnThreadHandle,tnPriority)
+ENDFUNC
+* GetThreadPriority
+
+
+FUNCTION PlayWave
+************************************************************************
+* wwapi :: PlayWave
+*******************
+***     Class: WinAPI
+***  Function: Plays the Wave File or WIN.INI
+***            [Sounds] Entry specified in the
+***            parameter. If the .WAV file or
+***            System Sound can't be found,
+***            SystemDefault beep is played
+***    Assume: Runs only under Windows
+***            uses MMSYSTEM.DLL  (Win 3.1)
+***                 WINMM.DLL  (32 bit Win)
+***      Pass: pcWaveFile - Full path of Wave file
+***                         or System Sound Entry
+***            pnPlayType - 1 - sound plays in background (default)
+***                         0 - sound plays - app waits
+***                         2 - No default sound if file doesn't exist
+***                         4 - Kill currently playing sound 
+***                         8 - Continous  
+***                         Values can be added together for combinations
+***  Examples:
+***    do PlayWav with "SystemQuestion"
+***    do PlayWav with "C:\Windows\System\Ding.wav"
+***    if PlayWav("SystemAsterisk")
+***
+***    Return: .t. if Wave was played .f. otherwise
+*************************************************************************
+LPARAMETER pcWaveFile,pnPlayType
+LOCAL lhPlaySnd,llRetVal
+
+pnPlayType=IIF(TYPE("pnPlayType")="N",pnPlayType,1)
+
+llRetVal=.f.
+
+DECLARE INTEGER PlaySound ;
+   IN WINMM.dll  ;
+   STRING cWave, INTEGER nModule, INTEGER nType
+
+IF PlaySound(pcWaveFile,0,pnPlayType)=1
+   llRetVal=.t.
+ENDIF
+
+RETURN llRetVal
+ENDFUNC
+*EOF PLAYWAV
+
+
+FUNCTION CreateGUID
+************************************************************************
+* wwapi::CreateGUID
+********************
+***    Author: Rick Strahl, West Wind Technologies
+***            http://www.west-wind.com/
+***  Modified: 01/26/98
+***  Function: Creates a globally unique identifier using Win32
+***            COM services. The vlaue is guaranteed to be unique
+***    Format: {9F47F480-9641-11D1-A3D0-00600889F23B}
+***    Return: GUID as a string or "" if the function failed 
+*************************************************************************
+LPARAMETERS llRaw
+LOCAL lcStruc_GUID, lcGUID, lnSize
+
+DECLARE INTEGER CoCreateGuid ;
+  IN Ole32.dll ;
+  STRING @lcGUIDStruc
+  
+DECLARE INTEGER StringFromGUID2 ;
+  IN Ole32.dll ;
+  STRING cGUIDStruc, ;
+  STRING @cGUID, ;
+  LONG nSize
+  
+*** Simulate GUID strcuture with a string
+lcStruc_GUID = REPLICATE(" ",16) 
+lcGUID = REPLICATE(" ",80)
+lnSize = LEN(lcGUID) / 2
+IF CoCreateGuid(@lcStruc_GUID) # 0
+   RETURN ""
+ENDIF
+
+IF llRaw
+   RETURN lcStruc_GUID
+ENDIF   
+
+*** Now convert the structure to the GUID string
+IF StringFromGUID2(lcStruc_GUID,@lcGuid,lnSize) = 0
+  RETURN ""
+ENDIF
+
+*** String is UniCode so we must convert to ANSI
+RETURN  StrConv(LEFT(lcGUID,76),6)
+* Eof CreateGUID
+
+FUNCTION Sleep(lnMilliSecs)
+************************************************************************
+* wwAPI :: Sleep
+*********************************
+***  Function: Puts the computer into idle state. More efficient and
+***            no keyboard interface than Inkey()
+***      Pass: tnMilliseconds
+***    Return: nothing
+************************************************************************
+
+lnMillisecs=IIF(type("lnMillisecs")="N",lnMillisecs,0)
+
+DECLARE Sleep ;
+  IN WIN32API ;
+  INTEGER nMillisecs
+ 	
+=Sleep(lnMilliSecs) 	
+ENDFUNC
+* Sleep
+
+************************************************************************
+* wwAPI :: GetLastError
+*********************************
+***  Function:
+***    Assume:
+***      Pass:
+***    Return:
+************************************************************************
+FUNCTION GetLastError
+DECLARE INTEGER GetLastError IN Win32API 
+RETURN GetLastError()
+ENDFUNC
+* wwAPI :: GetLastError
+
+************************************************************************
+* wwAPI :: GetSystemErrorMsg
+*********************************
+***  Function: Returns the Message text for a Win32API error code.
+***      Pass: lnErrorNo  -  WIN32 Error Code
+***    Return: Error Message or "" if not found
+************************************************************************
+FUNCTION GetSystemErrorMsg
+LPARAMETERS lnErrorNo,lcDLL
+LOCAL szMsgBuffer,lnSize
+
+szMsgBuffer=SPACE(500)
+
+DECLARE INTEGER FormatMessage ;
+     IN WIN32API ;
+     INTEGER dwFlags ,;
+     STRING lpvSource,;
+     INTEGER dwMsgId,;
+     INTEGER dwLangId,;
+     STRING @lpBuffer,;
+     INTEGER nSize,;
+     INTEGER  Arguments
+
+lnSize=FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,0,lnErrorNo,;
+                     0,@szMsgBuffer,LEN(szMsgBuffer),0)
+
+IF LEN(szMsgBUffer) > 1
+  szMsgBuffer=SUBSTR(szMsgBuffer,1, lnSize-1 )
+ELSE
+  szMsgBuffer=""  
+ENDIF
+    		   
+RETURN szMsgBuffer
+
+
+#IF .F.    &&!DEBUGMODE
+************************************************************************
+* wwAPI :: Error
+*********************************
+***  Function: Sets an Error number of the error occurred
+************************************************************************
+FUNCTION Error
+LPARAMETERS nError, cMethod, nLine
+THIS.nLastError=nError
+ENDFUNC
+* Error
+#ENDIF
+
+ENDDEFINE
+*EOC wwAPI
+
+
+************************************************************************
+FUNCTION GetTimeZone
+*********************************
+***  Function: Returns the TimeZone offset from GMT including
+***            daylight savings. Result is returned in minutes.
+************************************************************************
+
+DECLARE integer GetTimeZoneInformation IN Win32API ;
+   STRING @ TimeZoneStruct
+   
+lcTZ = SPACE(256)
+
+lnDayLightSavings = GetTimeZoneInformation(@lcTZ)
+
+lnOffset = CharToBin(SUBSTR(lcTZ,1,4))
+
+*** Subtract an hour if daylight savings is active
+IF lnDaylightSavings = 2
+   lnOffset = lnOffset - 60
+ENDIF
+
+RETURN lnOffSet
+
+
+**** Binary Numeric conversion routines!
+*** Converts DWORD string to binary unsigned integer
+FUNCTION CharToBin(tcWord)
+  LOCAL i, lnWord
+
+  lnWord = 0
+  FOR i = 1 TO LEN(tcWord)
+    lnWord = lnWord + (ASC(SUBSTR(tcWord, i, 1)) * (2 ^ (8 * (i - 1))))
+  ENDFOR
+
+RETURN lnWord
diff --git a/comun_plugins/utils/wwipstuff.dll b/comun_plugins/utils/wwipstuff.dll
new file mode 100644
index 0000000..bc65953
Binary files /dev/null and b/comun_plugins/utils/wwipstuff.dll differ
diff --git a/comun_plugins/utils/wwutils.PRG b/comun_plugins/utils/wwutils.PRG
new file mode 100644
index 0000000..5a4e0c5
--- /dev/null
+++ b/comun_plugins/utils/wwutils.PRG
@@ -0,0 +1,1731 @@
+************************************************************************
+* FUNCTION Utils
+******************
+***    Author: Rick Strahl
+***            (c) West Wind Technologies, 1995-98
+***   Contact: (541) 386-2087  / rstrahl@west-wind.com
+***  Modified: 12/22/97
+***  Function: A set of utility classes and functions used by 
+***            the various classes and processing code.
+*************************************************************************
+#INCLUDE FOXPRO.H
+#INCLUDE WCONNECT.H
+
+SET PROCEDURE TO wwUtils ADDITIVE
+
+
+*************************************************************
+DEFINE CLASS wwEnv AS Custom
+*************************************************************
+***  Function: Saves environment settings.
+*************************************************************
+
+*** Custom Properties
+PROTECTED cSetting,vOldValue
+
+
+************************************************************************
+* wwEnv :: Init
+*********************************
+***  Function: Saves and restores environment settings
+***    Assume: Limited to simple ON/OFF settings
+***            Very limited!!! Test carefully.
+***      Pass: tcSetting  -   SET value to set
+***            tvNewValue -   Value to set to
+***    Return:
+************************************************************************
+FUNCTION Init
+LPARAMETERS tcSetting,tvNewValue
+THIS.Set(tcSetting, tvNewValue)
+ENDFUNC
+* Init
+
+************************************************************************
+* wwEnv :: Set
+*********************************
+FUNCTION Set
+LPARAMETERS tcSetting,tvNewValue
+THIS.cSetting=tcSetting
+
+THIS.vOldValue=SET( tcSetting )
+
+IF TYPE("tvNewValue")="C" AND ;
+   INLIST(UPPER(tvNewValue),"ON","OFF") 
+   SET &tcSetting &tvNewValue
+ELSE
+   SET &tcSetting TO (tvNewValue)   
+ENDIF
+
+ENDFUNC
+* Set
+************************************************************************
+* wwEnv :: Destroy
+*********************************
+FUNCTION Destroy
+LOCAL lcSetting,lvValue
+
+lcSetting=THIS.cSetting
+lvValue=THIS.vOldValue
+
+IF TYPE("lvValue")="C" AND ;
+   INLIST(UPPER(lvValue),"ON","OFF") 
+   SET &lcSetting &lvValue
+ELSE
+   SET &lcSetting TO (lvValue)   
+ENDIF
+
+ENDFUNC
+* Destroy
+
+ENDDEFINE
+*EOC wwEnv
+
+
+#IF .F.
+*DEFINE CLASS wwUtils as Custom
+#ENDIF
+
+
+*************************************************************************
+****
+**** STANDALONE FUNCTIONS
+****
+*************************************************************************
+
+************************************************************************
+FUNCTION OpenExclusive
+**********************
+***  Modified: 01/27/96
+***  Function: Tries to open a table exclusively
+***    Assume: Table name can't contain a file name.
+***            Returns .F. for other reasons like file !found etc.
+***            USES wwEVAL object to test for success
+***            Parameters MUST NOT BE LPARAMETERS!!!
+***      Pass: lcTable   -  Name of table to open exclusively
+***    Return: .T. or .F.
+************************************************************************
+PARAMETERS lcTable, lcAlias
+LOCAL lcOldError, llRetVal, loEval
+
+lcTable=IIF(EMPTY(lcTable),"",lcTable)
+lcAlias=IIF(EMPTY(lcAlias),JustStem(lcTable),lcAlias)
+
+IF EMPTY(lcTable)
+   RETURN .F.
+ENDIF
+
+loEval=CREATE([WWC_wwEval])
+
+*** Use Exclusively to reindex and pack
+IF !USED(lcAlias)
+   loEval.ExecuteCommand("USE (lcTable) EXCLUSIVE IN 0 ALIAS (lcAlias)")
+ELSE
+   SELE (lcAlias)
+   loEval.ExecuteCommand("USE (lcTable) EXCLUSIVE  ALIAS (lcAlias)")
+ENDIF
+
+llRetVal=!loEval.lError
+
+*** Now try to re-open table as shared
+IF !llRetVal
+   USE (lcTable) IN 0 ALIAS(lcAlias)
+ELSE
+   SELE (lcAlias)   
+ENDIF   
+
+RETURN llRetVal
+*EOP OpenExclusive
+
+
+************************************************************************
+FUNCTION File2Var
+******************
+***  Function: Takes a file and returns the contents as a string or
+***            Takes a string and stores it in a file if a second
+***            string parameter is specified.
+***      Pass: tcFilename  -  Name of the file
+***            tcString    -  If specified the string is stored
+***                           in the file specified in tcFileName
+***    Return: file contents as a string
+************************************************************************
+LPARAMETERS tcFileName, tcString
+LOCAL lcRetVal, lnHandle, lnSize
+
+tcFileName=IIF(EMPTY(tcFileName),"",tcFileName)
+
+IF VARTYPE(tcString) # "C"
+   *** File to Text
+   lcRetVal=""
+   
+   *** Make sure file exists and can be opened for READ operation
+   lnHandle=FOPEN(tcFileName,0)
+   IF lnHandle#-1
+     lnSize = FSEEK(lnHandle,0,2)
+     FSEEK(lnHandle,0,0)
+     lcRetVal=FREAD(lnHandle,lnSize)
+     =FCLOSE(lnHandle)
+   ENDIF
+ELSE
+   tcString=IIF(EMPTY(tcString),"",tcString)
+   
+   *** Text to File
+   lnHandle=FCREATE(tcFileName)
+   IF lnHandle=-1
+      RETURN .F.
+   ENDIF
+   =FWRITE(lnHandle,tcString)
+   =FCLOSE(lnHandle)
+   RETURN .T.
+ENDIF
+
+RETURN lcRetVal
+*EOP File2Var
+
+************************************************************************
+FUNCTION Extract
+******************
+***  Function: Extracts a text value between two delimiters
+***    Assume: Delimiters case insensitive
+***            The first instance only is retrieved. Idea is
+***            to translate the delims as you go...
+***      Pass: lcString   -  Entire string
+***			   lcDelim1   -  The starting delimiter
+***            lcDelim2	  -  Ending delimiter
+***            lcDelim3	  -  Alternate ending delimiter
+***            llEndOk	  -  End of line is OK
+***    Return: Text between delimiters or ""
+*************************************************************************
+PARAMETERS lcString,lcDelim1,lcDelim2,lcDelim3, llEndOk
+PRIVATE lnX,lnLocation,lcRetVal,lcChar,lnNewString,lnEnd
+
+#IF wwVFPVersion > 6
+   IF EMPTY(lcDelim3) 
+      RETURN STREXTRACT(lcString,lcDelim1,lcDelim2,1,1 + IIF(llendOk,2,0) )
+   ENDIF
+#ENDIF
+
+lcDelim1=IIF(LEN(lcDelim1)=0,",",lcDelim1)
+lcDelim2=IIF(LEN(lcDelim2)=0,"z!x",lcDelim2)
+lcDelim3=IIF(EMPTY(lcDelim3),"z!x",lcDelim3)
+
+lnLocation=ATC(lcDelim1,lcString)
+IF lnLocation=0
+   RETURN ""
+ENDIF
+
+lnLocation=lnlocation+len(lcDelim1)
+
+*** Crate a new string of remaining text
+lcNewString=SUBSTR(lcString,lnLocation)
+
+lnEnd=ATC(lcDelim2,lcNewString)
+IF lnEnd>0
+   RETURN SUBSTR(lcNewString,1,lnEnd-1)
+ENDIF   
+*!*	IF lnEnd = 0
+*!*	   *** Empty Delimited string
+*!*	   RETURN ""
+*!*	ENDIF
+   
+lnEnd=ATC(lcDelim3,lcNewString)
+IF lnEnd>0
+   RETURN SUBSTR(lcNewString,1,lnEnd-1)
+ENDIF   
+
+IF llEndOk
+  *** Return to the end of the line
+  RETURN SUBSTR(lcNewString,1)
+ENDIF
+
+RETURN ""
+*EOP RetValue
+
+************************************************************************
+* wwUtils :: ReplaceDelimitedText
+****************************************
+***  Function: Replaces text between a set of delimiters with 
+***            a new string leaving the delimiters intact
+***    Assume: The delimited block MUST have at least 1 character
+***            in it even if it is blank or a CRLF
+***      Pass: lcSource - Full Source String
+***            lcStart  - Start delimiter
+***            lcEnd    - End Delimiter
+***            lcReplace -  Text to replace between delimiters
+***    Return: Updated String  
+************************************************************************
+FUNCTION ReplaceText
+LPARAMETERS lcSource, lcStart, lcEnd, lcReplace
+
+lcExtract = Extract(lcSource,lcStart,lcEnd,,.T.)
+  
+RETURN STRTRAN(lcSource,lcStart + lcExtract + lcEnd,lcStart + lcReplace + lcEnd)
+ENDFUNC
+
+
+************************************************************************
+FUNCTION Path
+******************
+***  Function: Adds or deletes items from the path string
+***      Pass: pcPathName   -   Filename
+***            pcMethod     -   *"ADD","DELETE"
+***    Return: New Path or ""
+************************************************************************
+PARAMETERS pcPath,pcMethod
+LOCAL lcOldPath
+
+IF VARTYPE(pcMethod) # "C"
+   pcMethod = "ADD"
+ENDIF
+
+IF EMPTY(pcPath)
+   RETURN
+ENDIF
+   
+pcPath=ADDBS(LOWER(TRIM(pcPath)))
+lcOldPath=LOWER(SET("PATH"))
+
+IF pcMethod="ADD"
+    IF EMPTY(pcPath) .OR. ;
+       !Directory(pcPath)
+       RETURN ""
+   ENDIF
+   IF AT(";" + pcPath + ";" ,";" + lcOldPath + ";")>0
+      RETURN ""
+   ENDIF
+   lcOldPath=lcOldPath+";"+pcPath
+ELSE
+   IF AT(";" + pcPath + ";" ,";" + lcOldPath + ";") < 1
+      RETURN ""
+   ENDIF
+   lcOldPath=STRTRAN(lcOldPath + ";" ,";" +pcPath+";",";")
+   lcOldPath = SUBSTR(lcOldPath,1,LEN(lcOldPath)-1)
+ENDIF   
+
+SET PATH TO &lcOldPath
+
+RETURN lcOldPath
+*EOP PATH
+
+
+************************************************************************
+FUNCTION DomainName
+*******************
+***  Modified: 04/13/96
+***  Function: Retrieves a Domain name from an URL
+***    Assume: URL starts with http:// - // required!
+***      Pass: lcUrl         -  URL to retrieve name from
+***            llNoStripWWW  -  Don't strip www.
+***    Return: Domain Name or ""
+*************************************************************************
+LPARAMETER lcUrl, llNoStripWWW
+lcText=STRTRAN(EXTRACT(lower(lcUrl),"//","/"," "),"/","")
+IF !llNoStripWWW
+  lcText=STRTRAN(lcText,"www.","")
+ENDIF
+RETURN PADR(lcText,50)
+
+
+
+************************************************************************
+FUNCTION ShowHTML
+*****************
+***  Function: Takes an HTML string and displays it in the default
+***            browser. 
+***    Assume: Uses a file to store HTML temporarily.
+***            For this reason there may be concurrency issues
+***            unless you change the file for each use
+***      Pass: lcHTML       -   HTML to display
+***            lcFile       -   Temporary File to use (Optional)
+***            loWebBrowser -   Web Browser control ref (Optional)
+************************************************************************
+LPARAMETERS lcHTML, lcFile, loWebBrowser
+
+lcHTML=IIF(EMPTY(lcHTML),"",lcHTML)
+lcFile=IIF(EMPTY(lcFile),SYS(2023)+"\ww_HTMLView.htm",lcFile)
+
+File2Var(lcFile,lcHTML)
+
+IF TYPE("loWebBrowser") = "O"
+   loWebBrowser.Navigate(lcFile)
+ELSE
+   IF TYPE("_oscreenx") = "O"
+      _oscreenx.Navigate(lcFile)
+   ENDIF
+*!*	   IF lower(JUSTEXT(lcFile)) = "txt"
+*!*	      MODI COMM (lcFile) IN MACDESKTOP
+*!*	   ELSE
+      =GoUrl(lcFile)
+*!*	   ENDIF
+ENDIF   
+
+RETURN
+*EOP ShowHTML
+
+************************************************************************
+FUNCTION ShowXML
+*****************
+***  Function: Takes an XML string and displays it in the default
+***            browser. 
+***    Assume: Uses a file to store HTML temporarily.
+***            For this reason there may be concurrency issues
+***            unless you change the file for each use
+***      Pass: lcHTML       -   HTML to display
+***            lcFile       -   Temporary File to use (Optional)
+***            loWebBrowser -   Web Browser control ref (Optional)
+************************************************************************
+LPARAMETERS lcHTML, lcFile, loWebBrowser
+IF EMPTY(lcFile)
+  lcFile=IIF(EMPTY(lcFile),SYS(2023)+"\ww_HTMLView.xml",lcFile)
+ENDIF
+ERASE (lcFile) 
+RETURN ShowHTML(lcHTML,lcFile,loWebBrowser)
+
+************************************************************************
+FUNCTION ShowText
+*****************
+***  Function: Takes an XML string and displays it in the default
+***            browser. 
+***    Assume: Uses a file to store HTML temporarily.
+***            For this reason there may be concurrency issues
+***            unless you change the file for each use
+***      Pass: lcHTML       -   HTML to display
+***            lcFile       -   Temporary File to use (Optional)
+***            loWebBrowser -   Web Browser control ref (Optional)
+************************************************************************
+LPARAMETERS lcHTML, lcFile, loWebBrowser
+IF EMPTY(lcFile)
+  lcFile=IIF(EMPTY(lcFile),SYS(2023)+"\ww_HTMLView.txt",lcFile)
+ENDIF
+
+IF VARTYPE(loWebBrowser) = "C" and loWebBrowser = "MODI"
+   FILE2VAR(lcFile,lcHTML)
+   MODIFY COMMAND (lcFile)
+   RETURN
+ENDIF   
+
+RETURN ShowHTML(lcHTML,lcFile,loWebBrowser)
+
+
+************************************************************************
+FUNCTION IsWinnt
+*****************
+***      Pass: llReturnVersionNumber
+***    Return: .t. or .f.   or Version Number or -1 if not NT
+*************************************************************************
+LPARAMETER llReturnVersionNumber
+
+loAPI=CREATE("wwAPI")
+lcVersion = loAPI.ReadRegistryString(HKEY_LOCAL_MACHINE,;
+           "SOFTWARE\Microsoft\Windows NT\CurrentVersion",;
+           "CurrentVersion")
+                          
+IF !llReturnVersionNumber
+  IF ISNULL(lcVersion)
+     RETURN .F.
+  ELSE
+     RETURN .T.
+  ENDIF
+ENDIF
+
+IF ISNULL(lcVersion)
+   RETURN -1
+ENDIF
+
+RETURN VAL(lcVersion)   
+* IsWinNt
+
+
+
+************************************************************************
+FUNCTION StripHTML
+*******************
+***  Function: Removes HTML tags from the passed text and converts
+***            it to plain text. Note formatting is totally removed!
+***    Assume: only 
and

are translated +*** any < or > in the HTML besides tags will break this +*** function. +*** Pass: lcText - HTML Text to strip +*** lcLTag - Left Tag value ("<") +*** lcRTag - Right Tag Value (">") +*** Return: Stripped HTML text +************************************************************************* +LPARAMETER lcHTMLText, lcLTag, lcRTag + +lcLTag=IIF(EMPTY(lcLTag),"<",lcLTag) +lcRTag=IIF(EMPTY(lcRTag),">",lcRTag) + +IF ATC(lcLTag,lcHTMLText) = 0 + RETURN lcHTMLText +ENDIF + +*** Start by breaking line breaks +lcHTMLText = STRTRAN(lcHTMLText,lcLTag + "BR" + lcRTag,CRLF) +lcHTMLText = STRTRAN(lcHTMLText,lcLTag + "P" + lcRTag,CRLF+CRLF) +lcHTMLText = STRTRAN(lcHTMLText,lcLTag + "br" + lcRTag,CRLF) +lcHTMLText = STRTRAN(lcHTMLText,lcLTag + "p" + lcRTag,CRLF+CRLF) +lcHTMLText = STRTRAN(lcHTMLText," "," ") + +lcExtract = "x" +DO WHILE !EMPTY(lcExtract) + lcExtract = Extract(lcHTMLText,lcLTag,lcRTag) + + IF EMPTY(lcExtract) + EXIT + ENDIF + lcHTMLText = STRTRAN(lcHTMLText,lcLTag+lcExtract+lcRTag,"") +ENDDO + +lcHTMLText = STRTRAN(lcHTMLText,"<","<") +lcHTMLText = STRTRAN(lcHTMLText,">",">") + +RETURN lcHTMLText + +************************************************************************ +FUNCTION HTMLColor +********************************* +*** Function: Converts a FoxPro Color to an HTML Hex color value +*** Pass: lnRGBColor - FoxPro RGB color number - RGB(255,255,255) +*** llNoOutput +*** Return: Hex HTML Color String "#FFFFFF" +************************************************************************ +LPARAMETER lnRGBColor + +lcColor=RIGHT(TRANSFORM(lnRGBColor,"@0"),6) + +*** Fox color is BBGGRR, HTML is RRGGBB + +RETURN "#" + SUBSTR(lcColor,5,2) + SUBSTR(lcColor,3,2) + LEFT(lcColor,2) +* HTMLColor + + +************************************************************************ +FUNCTION CharToBin +****************** +*** Function: Converts a DWORD value in binary string form back into +*** a numeric value +*** Pass: tcWord - Binary string value (from a structure?) +*** Return: numeric value of binary string +************************************************************************* +LPARAMETER tcWord + + LOCAL i, lnWord + + lnWord = 0 + FOR i = 1 TO LEN(tcWord) + lnWord = lnWord + (ASC(SUBSTR(tcWord, i, 1)) * (2 ^ (8 * (i - 1)))) + ENDFOR + +RETURN lnWord + + +**************************************************** +FUNCTION GoUrl +****************** +*** Author: Rick Strahl +*** (c) West Wind Technologies, 1996 +*** Contact: rstrahl@west-wind.com +*** Modified: 03/14/96 +*** Function: Starts associated Web Browser +*** and goes to the specified URL. +*** If Browser is already open it +*** reloads the page. +*** Assume: Works only on Win95 and NT 4.0 +*** Pass: tcUrl - The URL of the site or +*** HTML page to bring up +*** in the Browser +*** Return: 2 - Bad Association (invalid URL) +*** 31 - No application association +*** 29 - Failure to load application +*** 30 - Application is busy +*** +*** Values over 32 indicate success +*** and return an instance handle for +*** the application started (the browser) +**************************************************** +LPARAMETERS tcUrl, tcAction, tcDirectory + +tcUrl=IIF(type("tcUrl")="C",tcUrl,; + "http://www.west-wind.com/") + +tcAction=IIF(type("tcAction")="C",tcAction,"OPEN") + +tcDirectory=IIF(EMPTY(tcDirectory),SYS(2023),tcDirectory) + +DECLARE INTEGER ShellExecute ; + IN SHELL32.dll ; + INTEGER nWinHandle,; + STRING cOperation,; + STRING cFileName,; + STRING cParameters,; + STRING cDirectory,; + INTEGER nShowWindow + +DECLARE INTEGER FindWindow ; + IN WIN32API ; + STRING cNull,STRING cWinName + +RETURN ShellExecute(FindWindow(0,_SCREEN.caption),; + tcAction,tcUrl,; + "",tcDirectory,1) + +************************************************************************ +PROCEDURE StrTranC +****************** +*** Function: Like Strtran but case insensitive +*** Pass: lcString - Entire string +*** lcDelim1 - String to replace +*** lcDelim2 - String to replace with +*** Return: translated string +************************************************************************* +LPARAMETER lcString, lcSource, lcReplace + +#IF wwVFPVersion > 6 + RETURN STRTRAN(lcString,lcSource,lcReplace,1,-1,1) +#ELSE +LOCAL lnAt + +lnAt = 1 +lnReplaceSize = LEN(lcSource) +DO while .T. + lnAt = ATC(lcSource,lcString) + IF lnAT = 0 + RETURN lcString + ENDIF + + lcString = STUFF(lcString,lnAt,lnReplaceSize,lcReplace) +ENDDO + +RETURN lcString +#ENDIF + + +FUNCTION TimeToCStrict +LPARAMETER ltTime, llSQL + +lcCentury = SET("CENTURY") +lcDateMode = SET("DATE") +SET CENTURY ON +SET DATE TO YMD + +IF llSQL + lcDate = "'" + TTOC(ltTime) + "'" +ELSE + lcDate = "{^" + TTOC(ltTime) + "}" +ENDIF + +SET DATE TO &lcDateMode +SET CENTURY &lcCentury +RETURN lcDate + +************************************************************************ +FUNCTION DateToC +****************** +*** Function: Converts a date to string displaying empty dates as blanks +*** rather than displaying the empty date format +*** Pass: ldDate - Date to display +*** Return: Date String or "" if invalid date +************************************************************************* +LPARAMETER ldDate + +IF EMPTY(ldDate) + RETURN "" +ENDIF + +RETURN DTOC(ldDate) +* DateTOC + + + +************************************************************************ +FUNCTION TimeToC +****************** +*** Function: Converts a time to string displaying empty as blanks +*** and formatting the time string properly +*** Pass: ltTime - Date to display (Pass Time, Date or Char) +*** Return: Time String or "" if invalid date (Year is not returned) +************************************************************************* +LPARAMETER ltTime + +IF EMPTY(ltTime) + RETURN "" +ENDIF + +IF VARTYPE(ltTime) $ "DT" + lcTimestamp = TTOC(ltTime) +ELSE + lcTimeStamp = ltTime +ENDIF + +RETURN Substr(lcTimeStamp,1,5)+"/" + Substr(lcTimeStamp,9,8)+lower(Substr(lcTimeStamp,21,2)) +* DateTOC + +************************************************************************ +FUNCTION GetAppStartPath +********************************* +*** Function: Returns the FoxPro start path +*** of the *APPLICATION* +*** under all startmodes supported by VFP. +*** Returns the path of the starting EXE, +*** DLL, APP, PRG/FXP +*** Return: Path as a string with trailing "\" +************************************************************************ + +DO CASE + *** VFP 6 provides ServerName property for COM servers EXE/DLL/MTDLL + CASE INLIST(Application.StartMode,2,3,5) + lcPath = JustPath(Application.ServerName) + +*!* *** Interactive +*!* CASE (Application.StartMode) = 0 +*!* lcPath = SYS(5) + CURDIR() + + *** Active Document + CASE ATC(".APP",SYS(16,0)) > 0 + lcPath = JustPath(SYS(16,0)) + + *** Standalone EXE or VFP Development + OTHERWISE + lcPath = JustPath(SYS(16,0)) + IF ATC("PROCEDURE",lcPath) > 0 + lcPath = SUBSTR(lcPath,RAT(":",lcPath)-1) + ENDIF +ENDCASE + +RETURN AddBs(lcPath) +* EOF GetAppStartPath + + +************************************************************************ +FUNCTION ShortPath +****************** +*** Function: Converts a Long Windows filename into a short +*** 8.3 compliant path/filename +*** Pass: lcPath - Path to check +*** Return: lcShortFileName +************************************************************************* +LPARAMETER lcPath + +DECLARE INTEGER GetShortPathName IN Win32API; + STRING @lpszLongPath, STRING @lpszShortPath,; + INTEGER cchBuffer + +lcPath = lcPath +lcshortname = SPACE(260) +lnlength = LEN(lcshortname) +lnresult = GetShortPathName(@lcPath, @lcshortname, lnlength) +IF lnResult = 0 + RETURN "" +ENDIF +RETURN LEFT(lcShortName,lnResult) + + +************************************************************************ +FUNCTION DeleteFiles +******************** +*** Function: Returns the size of a file +*** Pass: lcFileName - Wildcard File Spec (d:\temp\*.pdf) +*** lnTimeout - Timeout in seconds +*** Return: the size of the file or -1 on error +************************************************************************ +PARAMETERS lcFileSpec, lnTimeout +PRIVATE lnX,lnFiles, loAPI + +lnTimeout=IIF(EMPTY(lnTimeout),300,lnTimeout) + +lnFiles = aDir(laFiles,lcFileSpec) +*loEval = CREATE([WWC_wwEval]) +FOR lnX=1 to lnFiles + ldtime = CTOT( DTOC(laFiles[lnX,3]) + " " + laFiles[lnX,4] ) + IF ldTime + lnTimeout < DateTime() + * loEval.ExecuteCommand( " ERASE (ADDBS(justpath(lcFileSpec)) + laFiles[lnX,1]) " ) + ERASE (ADDBS(justpath(lcFileSpec)) + laFiles[lnX,1]) + ENDIF +ENDFOR + +RETURN .T. +ENDFUNC + + +************************************************************************ +FUNCTION IsDir +****************** +*** Modified: 10/09/97 +*** Function: Checks to see whether a directory exists +*** Pass: lcPath - Path to check +*** Return: .T. or .F. +************************************************************************* +LPARAMETER lcPath +DIMENSION laTemp[1] +IF ADIR(laTemp,lcPath,"DH") < 1 + RETURN .F. +ENDIF +RETURN .T. + +************************************************************************ +FUNCTION FileSize +****************** +*** Function: Returns the size of a file +*** Pass: lcFileName +*** Return: the size of the file or -1 on error +************************************************************************ +LPARAMETERS lcFileName +LOCAL lh, lnSize + +lh = FOPEN(lcFileName) +IF lh = -1 + RETURN -1 +ENDIF + +lnSize = FSEEK(lh, 0, 2) + +FCLOSE(lh) + +RETURN lnSize +*EOP FileSize + + +************************************************************************ +FUNCTION Slash +****************** +*** Function: Converts slashes from DOS -> Web and vice versa +*** Pass: lcPath - Path to convert +*** lcStyle - "WEB" or "DOS" +*** Return: update path +************************************************************************ +LPARAMETER lcPath, lcStyle +lcStyle=IIF(type("lcStyle")="C",UPPER(lcStyle),"") +IF lcStyle="WEB" + lcPath=CHRTRAN(lcPath,"\","/") +ELSE + lcPath=CHRTRAN(lcPath,"/","\") +ENDIF +RETURN lcPath +*EOP LPARAMETER + + + +************************************************************************ +FUNCTION ProgLevel +****************** +*** Function: Returns the current Calling Stack level. Used to check +*** recursive Error calls in Error methods. +************************************************************************* + +FOR lnX=1 to 128 + IF EMPTY(SYS(16,lnX)) + exit + ENDIF +ENDFOR && lnX=1 to 128 + +*** -1 for lnX count - -1 for ProgLevel Call +RETURN lnX - 2 + + +************************************************************************ +FUNCTION AParseString +********************** +*** Modified: 07/03/97 +*** Function: Parses a delimited string into an array +*** Pass: laResult - Array containing the result strings (@) +*** lcString - The full string +*** lcDelimiter - The delimiter string +*** Return: Count of strings or 0 if null string is passed +************************************************************************* +LPARAMETER laResult, lcString, lcDelimiter +LOCAL lnLastPos, lnItemCount, i + +lnItemCount = OCCURS(lcDelimiter,lcString) + 1 +DIMENSION laResult[lnItemCount] + +lnLastPos=1 + +FOR i=1 to lnItemCount + IF i < lnItemCount + laResult[i] = SUBSTR(lcString,lnLastPos, ; + ATC(lcDelimiter,lcString,i) - lnLastPos ) + ELSE + laResult[i] = SUBSTR(lcString,lnLastPos) + ENDIF + lnLastPos = ATC(lcDelimiter,lcString,i) + LEN(lcDelimiter) +ENDFOR + +RETURN lnItemCount + +************************************************************************ +FUNCTION URLDecode +****************** +*** Function: URLDecodes a text string to normal text. +*** Assume: Uses wwIPStuff.dll +*** Pass: lcText - Text string to decode +*** Return: Decoded string or "" +************************************************************************ +LPARAMETERS lcText +LOCAL lnSize, lnLoc, lcHex, lcRetval + +*** Use wwIPStuff for large buffers +IF LEN(lcText) > 255 + DECLARE INTEGER URLDecode ; + IN WWIPSTUFF AS API_URLDecode ; + STRING @cText + + lnSize=API_URLDecode(@lcText) + + IF lnSize > 0 + lcText = SUBSTR(lcText,1,lnSize) + ELSE + lcText = "" + ENDIF + + RETURN lcText +ENDIF + +*** First convert + to spaces +lcText=STRTRAN(lcText,"+"," ") + +*** Handle Hex Encoded Control chars + +lcRetval = "" +DO WHILE .T. + *** Format: %0A ( CHR(10) ) + lnLoc = AT('%',lcText) + + *** No Hex chars + IF lnLoc > LEN(lcText) - 2 OR lnLoc < 1 + lcRetval = lcRetval + lcText + EXIT + ENDIF + + *** Now read the next 2 characters + *** Check for digits - at this point we must have hex pair! + lcHex=SUBSTR(lcText,lnLoc+1,2) + + *** Now concat the string plus the evaled hex code + lcRetval = lcRetval + LEFT(lcText,lnLoc-1) + ; + CHR( EVAL("0x"+lcHex) ) + + *** Trim out the input string + IF LEN(lcText) > lnLoc + 2 + lcText = SUBSTR(lcText,lnLoc+3) + ELSE + EXIT + ENDIF +ENDDO + +RETURN lcRetval +ENDFUNC +* EOF URLDecode + +************************************************************************ +FUNCTION GetURLEncodedKey +********************************* +*** Function: Retrieves a 'parameter' from the query string that +*** is encoded with standard CGI/ISAPI URL encoding. +*** Typical URL encoding looks like this: +*** +*** "User=Rick+Strahl&ID=0011&Address=400+Morton%0A%0DHood+River" +*** +*** Pass: lcVal - Form Variable to retrieve +*** Return: Value or "" +************************************************************************ +LPARAMETERS tcURLString, lcKey +LOCAL lnLoc,c2, cStr, lcURLString, lcRetval + +lcURLString=IIF(EMPTY(tcURLString),"","&"+tcURLString) +lcKey=IIF(EMPTY(lcKey)," ",lcKey) +lcKey=STRTRAN(lcKey," ","+") + +#IF wwVFPVersion > 6 + lcRetval = STREXTRACT(lcUrlString,"&"+lcKey+"=","&",1,3) +#ELSE + lcRetval=Extract(@lcUrlString,"&"+lcKey+"=","&",,.T.) +#ENDIF + +RETURN URLDecode(lcRetval) +ENDFUNC + + +******************************************************** +FUNCTION URLEncode +******************* +*** Function: Encodes a string in URL encoded format +*** for use on URL strings or when passing a +*** POST buffer to wwIPStuff::HTTPGetEx +*** Pass: tcValue - String to encode +*** Return: URLEncoded string or "" +******************************************************** +LPARAMETER tcValue +LOCAL lcResult, lcChar, lnSize, lnX + +*** Large Buffers use the wwIPStuff function +*** for quicker response +if LEN(tcValue) > 255 + lnSize=LEN(tcValue) + tcValue=PADR(tcValue,lnSize * 3) + + DECLARE INTEGER VFPURLEncode ; + IN WWIPSTUFF ; + STRING @cText,; + INTEGER cInputTextSize + + lnSize=VFPUrlEncode(@tcValue,lnSize) + + IF lnSize > 0 + RETURN SUBSTR(TRIM(tcValue),1,lnSize) + ENDIF + RETURN "" +ENDIF + +*** Do it in VFP Code +lcResult="" + +FOR lnX=1 to len(tcValue) + lcChar = SUBSTR(tcValue,lnX,1) + IF ATC(lcChar,"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") > 0 + lcResult=lcResult + lcChar + LOOP + ENDIF + IF lcChar=" " + lcResult = lcResult + "+" + LOOP + ENDIF + *** Convert others to Hex equivalents + lcResult = lcResult + "%" + RIGHT(transform(ASC(lcChar),"@0"),2) +ENDFOR && lnX=1 to len(tcValue) + +RETURN lcResult +* EOF URLEncode + +#IF WWC_COMPATIBILITY +************************************************************************ +FUNCTION WCSCompile +******************* +*** Modified: 12/31/97 +*** Function: Compiles WCS script files +*** Assume: Requires Runtime version +*** Called by wwMaint using VisualFoxpro.Application +*** Automation object if Runtime is installed. +*** Pass: lcFileSpec - Filespec of files to compile +*** llSilent - No error display +*** Return: "" on success or Error String +************************************************************************* +LPARAMETER lcFileSpec, llSilent +lcFileSpec=IIF(type("lcFileSpec")="C",lcFileSpec,CURDIR() + "*.wcs") + +lcPath = justpath(lcFileSpec) +lcFile = justfname(lcFileSpec) + +IF EMPTY(lcPath) + lcPath = CURDIR() +ENDIF +IF EMPTY(lcFile) + lcFile = "*.WCS" +ENDIF +lcPath = ADDBS(lcPath) + +lcFileSpec = lcPath + lcFile + + +DIMENSION laFiles[1] +lnFiles = ADIR(laFiles,lcFileSpec) +IF lnFiles < 1 + RETURN "No files to compile..." +ENDIF +oScript = CREATE("wwVFPScript",laFiles[1]) +IF TYPE("oScript") <> "O" + Return "Error: Couldn't create wwVFPScriptObject" +ENDIF +oScript.lDeleteGeneratedCode = .F. && Erase WCT files + +FOR lnX = 1 to lnFiles + lcFileName = lcPath+laFiles[lnX,1] + wait window nowait "Compiling "+lcFileName + + *** WCS - Script Text WCX - Compiled WCT - Intermediate + oScript.cFileName = lcFileName + oScript.ConvertPage() + oScript.CompilePage() +ENDFOR + +wait window nowait LTRIM(STR(lnFiles))+ " Web Connection Script file(s) compiled." + +lcErrors = "" +IF !EMPTY(oScript.cCompileErrors) + File2Var(lcPath + "WCS_Script.err",oScript.cCompileErrors) + IF !llSilent + MODI COMM (lcPath + "WCS_Script.err") + ENDIF + lcErrors = File2Var(lcPath + "WCS_Script.err") +ENDIF + +RETURN lcErrors +* EOF WCSCompile +#ENDIF + + + + +* Pass lnX/YFactor by reference +FUNCTION TwipsFactor(lnXFactor, lnYFactor) +LOCAL ln_x_pixels, ln_y_pixels, ln_twips, ln_partial_x, ln_partial_y, ; + ln_hwnd, ln_hdc + +*** Calculate the factor to be used in the HitTest method... +ln_x_pixels = 88 +ln_y_pixels = 90 +ln_twips = 1440 + +DECLARE INTEGER GetActiveWindow IN win32api +DECLARE INTEGER GetActiveWindow IN win32api +DECLARE INTEGER GetDC IN win32api INTEGER iHDC +DECLARE INTEGER GetDeviceCaps IN win32api INTEGER iHDC, INTEGER iIndex + +ln_hwnd = GetActiveWindow() +ln_hdc = GetDC(ln_hwnd) + +ln_partial_x = GetDeviceCaps(ln_hdc, ln_x_pixels) +ln_partial_y = GetDeviceCaps(ln_hdc, ln_x_pixels) + +lnXFactor = ln_twips/ln_partial_x +lnYFactor = ln_twips/ln_partial_y +RETURN + + +************************************************************************ +FUNCTION InputForm +****************** +*** Function: Creates a simple Input form that returns a value +*** Assume: Consists of this function and Form Class +*** Pass: lcValue - Initial value to retrieve +*** lcMessage - The request message +*** lcCaption - Form Caption (_Screen.Caption) +*** lnFormWidth Width of the form +*** lnFieldWidth Widht of the input field +*** lcFormat Format string for the input field +*** lcCancelValue Value returned on a Cancel operation +*** Return: Value or ("" or -1) +************************************************************************ +LPARAMETER lcValue, lcMessage, lcCaption, lnFormWidth, lnFieldWidth, lcFormat,lcCancelValue +PRIVATE pcResult +LOCAL o + +IF PCOUNT() > 6 + pcCancelValue = lcCancelValue +ELSE + pcCancelValue = NULL +ENDIF + +lcValue=IIF(EMPTY(lcValue),"",lcValue) +lcMessage=IIF(EMPTY(lcMessage),"Please enter",lcMessage) +lcCaption=IIF(EMPTY(lcCaption),_SCREEN.Caption,lcCaption) +lnFormWidth=IIF(EMPTY(lnFormWidth),300,lnFormWidth) +lnFieldWidth=IIF(EMPTY(lnFieldWidth),lnFormWidth - 20,lnFieldWidth) +lcFormat=IIF(EMPTY(lcFormat),"@K",lcFormat) + + +lcType = VARTYPE(lcCancelValue) +pcResult = lcValue + +o=CREATE("frmInput") +o.Width = lnFormWidth +o.nFieldWidth = lnFieldWidth +o.Caption = lcCaption +o.cMessage = lcMessage +o.cFormat = lcFormat + +IF lcFormat = "PASSWORD" + o.cFormat = "@K" + o.txtInput.PasswordChar = "*" +ENDIF + + +o.Show() + +IF TYPE("pcResult")="C" + lcValue = TRIM(pcResult) +ELSE + lcValue = pcResult +ENDIF +RETURN lcValue + + +************************************************** +*-- Form: frminput +*-- ParentClass: form +*-- BaseClass: form +DEFINE CLASS frminput AS form + nFieldWidth = 250 + cMessage = "Please enter:" + cFormat = "" + + Top = 0 + Left = 0 + Height = 90 + Width = 300 + ControlBox = .F. + Name = "frmInput" + WindowType = 1 + AutoCenter = .t. + Showwindow = 1 + BorderStyle = 2 + MinButton = .f. + ShowWindow = 1 + MaxButton = .f. + + ADD OBJECT lblMessage AS label WITH ; + AutoSize = .T., ; + Caption = "Message Text:", ; + Height = 17, ; + Left = 7, ; + Top = 11, ; + Width = 81, ; + Name = "lblMessage",; + Font = "Tahoma" ,; + FontSize = 8 + + ADD OBJECT txtinput AS textbox WITH ; + ControlSource = "pcResult", ; + Height = 22, ; + Left = 5, ; + Top = 28, ; + Width = 373, ; + Name = "txtInput",; + Font = "Tahoma" ,; + Default = .T.,; + FontSize = 8 + ADD OBJECT cmdOk AS commandbutton WITH ; + Top = 55, ; + Left = THISFORM.width - 150, ; + Height = 25, ; + Width = 70, ; + Caption = "OK", ; + Default = .T., ; + Fontname="Tahoma",; + Fontsize = 8,; + Cancel = .F.,; + Name = "cmdOK" + + ADD OBJECT cmdCancel AS commandbutton WITH ; + Top = 55, ; + Left = THISFORM.Width - 75, ; + Height = 25, ; + Width = 70, ; + Caption = "\ 0 + THIS.txtInput.Format = THIS.cFormat + ELSE + THIS.txtInput.InputMask = THIS.cFormat + ENDIF + ENDIF + ENDPROC + PROCEDURE cmdOk.Click + RELEASE THISFORM + ENDPROC + PROCEDURE cmdCancel.Click + LOCAL lcType + + IF ISNULL(pcCancelValue) + lcType = TYPE("pcResult") + DO CASE + CASE lcType $ "CM" + pcResult = "" + CASE lcType $ "NIBY" + pcResult = -99999999 + CASE lcType $ "DT" + pcResult = {} + CASE lcType = "L" + pcResult = .f. + ENDCASE + ELSE + pcResult = pcCancelValue + ENDIF + RELEASE THISFORM + ENDPROC +ENDDEFINE +* +*-- EndDefine: frminput +************************************************** + + +************************************************** +FUNCTION IsCOMObject +********************* +*** Function: Checks to see if a COM object +*** or ActiveX control exists +*** Assume: Uses wwAPI +*** Pass: lcProgId - Prog Id of the Class +*** lcClassId - (Optional) If passed in +*** by reference gets ClassId +*** lcClassDescript - (Optional) by ref +*** Return: .T. or .F. +***************************************************** +LPARAMETER lcProgId,lcClassId, lcClassDescript + +IF EMPTY(lcProgId) + RETURN .F. +ENDIF + +loAPI = CREATE("wwAPI") + +*** Retrieve ClassId and Server Name +lcClassId = ; + loAPI.ReadRegistryString(HKEY_CLASSES_ROOT,; + lcProgId + "\CLSID",; + "") +IF ISNULL(lcClassId) + lcClassId = "" + lcClassDescription = "" + RETURN .F. +ENDIF + +lcClassDescript = ; + loAPI.ReadRegistryString(HKEY_CLASSES_ROOT,; + lcProgId,"") + +IF ISNULL(lcClassDescript) + lcClassDescript = "" +ENDIF + +RETURN .T. +* +FUNCTION CopyObject + LPARAMETERS loinput + LOCAL loobject, lafields[1], lnx, lcfield, lctype, llclass, lncount, z, lnlength + IF TYPE("loInput.Class") = "C" + loobject = CREATEOBJECT(loinput.CLASS) + ELSE + loobject = CREATEOBJECT("EMPTY") + ENDIF + lncount = AMEMBERS(lafields, loinput) + FOR lnx = 1 TO lncount + lcfield = LOWER(lafields(lnx)) + IF AT("," + lcfield + ",", "'" + ",activecontrol,classlibrary,baseclass,comment,controls,objects,controlcount," + "class,name,parent,parentalias,parentclass,helpcontextid,whatsthishelpid," + "width,height,top,left,tag,picture,onetomany,childalias,childorder,relationalexpr,timestamp_column,") > 0 + LOOP + ENDIF + lctype = TYPE("loInput." + lcfield) + DO CASE + CASE TYPE('ALEN(loInput.' + lcfield + ')') = "N" + IF TYPE("loObject." + lcfield) = "U" + *!_err=0x1A0A_!(loobject, lcfield + "[1]") + ENDIF + lnlength = ALEN(loinput.&lcfield) + DIMENSION loobject.&lcfield[lnLength] + FOR z = 1 TO lnlength + IF TYPE("loInput." + lcfield + "[z]") = "O" + loobject.&lcfield[z] = CopyObject(EVAL( "loInput." + lcfield + "[z]")) + ELSE + loobject.&lcfield[z] = EVAL("loInput." + lcfield) + ENDIF + ENDFOR + CASE lctype = "O" + IF TYPE("loObject." + lcfield) = "U" + *!_err=0x1A0A_!(loobject, lcfield) + ENDIF + loobject.&lcfield = CopyObject(EVAL("loInput."+lcfield)) + OTHERWISE + IF TYPE("loObject." + lcfield) = "U" + *!_err=0x1A0A_!(loobject, lcfield) + ENDIF + loobject.&lcfield = EVAL("loInput." + lcfield) + ENDCASE + ENDFOR + RETURN loobject +ENDFUNC +* +PROCEDURE CopyObjectProperties + LPARAMETERS loinput, loobject, lnobjectstructureobject + IF (EMPTY(lnobjectstructureobject)) + lnobjectstructure = 1 + ENDIF + IF lnobjectstructureobject = 1 + lncount = AMEMBERS(lafields, loinput) + ELSE + lncount = AMEMBERS(lafields, loobject) + ENDIF + FOR lnx = 1 TO lncount + lcfield = LOWER(lafields(lnx)) + IF AT("," + lcfield + ",", "'" + ",activecontrol,classlibrary,baseclass,comment,controls,objects,controlcount," + "class,name,parent,parentalias,parentclass,helpcontextid,whatsthishelpid," + "width,height,top,left,tag,picture,onetomany,childalias,childorder,relationalexpr,timestamp_column,") > 0 + LOOP + ENDIF + lctype = TYPE("loInput." + lcfield) + IF lctype = "O" .OR. lctype = "U" .OR. TYPE('ALEN(loInput.' + lcfield + ')') = "N" + LOOP + ENDIF + IF lnobjectstructureobject = 1 + IF TYPE("loObject." + lcfield) = "U" + LOOP + ENDIF + ELSE + IF TYPE("loInput." + lcfield) = "U" + LOOP + ENDIF + ENDIF + *_**BA=?? 730 + loobject.&lcfield = EVAL("loInput." + lcfield) + *!_err=0xBB_! 738 + *!_err=0xBE_! + DO CASE + CASE TYPE('ALEN(loInput.' + lcfield + ')') = "N" + CASE lctype = "O" + OTHERWISE + ENDCASE + ENDFOR +ENDPROC + +FUNCTION CacheFile + LPARAMETER lcFilename, lnRefreshseconds + LOCAL lcOutput, lnHandle + lcAlias = ALIAS() + IF USED("wwFileCache") + SELECT wwFilecache + ELSE + CREATE CURSOR wwFileCache (fiLename C (120), tiMeread T, coNtent M) + ENDIF + LOCATE FOR fiLename=LOWER(lcFilename) + IF FOUND() + IF lnRefreshseconds>0 .AND. wwFilecache.tiMeread dcom.txt" + &lcCMD + lcResult = FILETOSTR("DCOM.TXT") + ERASE DCOM.TXT + IF .NOT. EMPTY(lcResult) .AND. ATC("ERROR:", lcResult)>0 + MESSAGEBOX(lcProgid+CHR(13)+"Account: "+lcUsername+CHR(13)+ ; + CHR(13)+lcResult, 48, "DCOM Permissions") + RETURN .F. + ENDIF + ELSE + IF .NOT. loApi.wrIteregistrystring(-2147483646, ; + "SOFTWARE\Classes\CLSID\"+lcClassid,"AppId",lcClassid,.T.) + WAIT WINDOW NOWAIT "Unable to write AppID value..." + RETURN + ENDIF + IF .NOT. loApi.wrIteregistrystring(-2147483648,"AppID\"+lcClassid, ; + CHR(0),CHR(0),.T.) + WAIT WINDOW NOWAIT "Unable to write AppID key..." + RETURN + ENDIF + loApi.wrIteregistrystring(-2147483648,"AppID\"+lcClassid,"", ; + lcServername,.T.) + loApi.wrIteregistrystring(-2147483648,"AppID\"+lcClassid,"RunAs", ; + lcRunas,.T.) + ENDIF + WAIT WINDOW NOWAIT "DCOM security context set to: "+lcRunas + RETURN +ENDFUNC +* +FUNCTION DCOMLaunchPermissions + LPARAMETER lcProgid, lcUsername, lcErrormsg + IF .NOT. EMPTY(lcProgid) + lcClassid = "" + llResult = isComobject(lcProgid,@lcClassid) + IF EMPTY(lcClassid) + WAIT WINDOW "Invalid Prog ID" + RETURN .F. + ENDIF + ELSE + lcClassid = "" + ENDIF + lcPath = FULLPATH("dcompermissions.exe") + lcPath = shOrtpath(lcPath) + IF EMPTY(lcClassid) + lcCmd = "RUN "+lcPath+" -da "+lcClassid+" set "+lcUsername+ ; + " permit > dcom.txt" + _CLIPTEXT = lcCmd + ELSE + lcCmd = "RUN "+lcPath+" -aa "+lcClassid+" set "+lcUsername+ ; + " permit > dcom.txt" + _CLIPTEXT = lcCmd + ENDIF + &lcCMD + lcResult = FILETOSTR("DCOM.TXT") + ERASE DCOM.TXT + IF .NOT. EMPTY(lcResult) .AND. ATC("ERROR:", lcResult)>0 + MESSAGEBOX(lcProgid+CHR(13)+"Account: "+lcUsername+CHR(13)+CHR(13)+ ; + lcResult, 48, "DCOM Permissions") + RETURN .F. + ENDIF + IF EMPTY(lcClassid) + lcCmd = "RUN "+lcPath+" -dl "+lcClassid+" set "+lcUsername+ ; + " permit > dcom.txt" + _CLIPTEXT = lcCmd + ELSE + lcCmd = "RUN "+lcPath+" -al "+lcClassid+" set "+lcUsername+ ; + " permit > dcom.txt" + _CLIPTEXT = lcCmd + ENDIF + &lcCMD + lcResult = FILETOSTR("DCOM.TXT") + ERASE DCOM.TXT + IF .NOT. EMPTY(lcResult) .AND. ATC("ERROR:", lcResult)>0 + MESSAGEBOX(lcProgid+CHR(13)+"Account: "+lcUsername+CHR(13)+CHR(13)+ ; + lcResult, 48, "DCOM Permissions") + RETURN .F. + ENDIF + RETURN +ENDFUNC +* +FUNCTION FixPreTags + LPARAMETER lcHtml, lnColwidth + LOCAL lcPre, lcFixed, lcPrecount, lnAt1, lnAt2 + lnPrecount = 1 + DO WHILE .T. + lnAt1 = ATC("", lcHtml, lnPrecount) + IF lnAt1=0 .OR. lnAt2=0 + EXIT + ENDIF + lcPre = SUBSTR(lcHtml, lnAt1, lnAt2-lnAt1) + lcFixed = STRTRAN(lcPre, "

", CHR(13)+CHR(10)+CHR(13)+CHR(10)) + lcFixed = STRTRAN(lcFixed, "
", CHR(13)+CHR(10)) + lcHtml = STRTRAN(lcHtml, lcPre, lcFixed) + lnPrecount = lnPrecount+1 + ENDDO + RETURN lcHtml +ENDFUNC +* +FUNCTION FixHTMLForDisplay + LPARAMETER lcHtml + lcHTML = STRTRAN(lcHTML,"<","<") + lcHTML = STRTRAN(lcHTML,">",">") + lcHTML = STRTRAN(lcHTML,["],""") + RETURN lcHtml +ENDFUNC +* +FUNCTION DisplayMemo + LPARAMETER lcHtml + lcHtml = STRTRAN(lcHtml, CHR(13)+CHR(10), CHR(13)) + lcHtml = STRTRAN(lcHtml, CHR(10), CHR(13)) + lcHtml = STRTRAN(lcHtml, CHR(13)+CHR(13), "

") + RETURN STRTRAN(lcHtml, CHR(13), "
") +ENDFUNC +* +FUNCTION GetSystemPassword + LPARAMETER llUsername + loApi = NEWOBJECT("wwAPI", "wwapi.prg") + IF .NOT. llUsername + lcPass = loApi.reAdregistrystring("HKLM", ; + "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", ; + "DefaultPassword") + ELSE + lcPass = loApi.reAdregistrystring("HKLM", ; + "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", ; + "DefaultUserName") + ENDIF + IF ISNULL(lcPass) + RETURN "" + ENDIF + RETURN lcPass +ENDFUNC +* +FUNCTION GetPassword + LPARAMETER lcMessage + IF EMPTY(lcMessage) + lcMessage = "Please enter your password" + ENDIF + RETURN inPutform(SPACE(20),lcMessage,"Password Entry", , ,"PASSWORD") +ENDFUNC +* +FUNCTION IsDotNet + LPARAMETER lcFrameworkpath, lcVersion + LOCAL loApi, as, wwApi + lcVersion = "" + lcFrameworkpath = "" + loApi = CREATEOBJECT("wwAPI") + lcWindir = loApi.geTsystemdir(.T.) + lcVersion = loApi.reAdregistrystring(-2147483646, ; + "Software\Microsoft\ASP.Net","RootVer") + IF ISNULL(lcFrameworkpath) + RETURN .F. + ENDIF + lcFrameworkpath = ADDBS(loApi.reAdregistrystring(-2147483646, ; + "Software\Microsoft\ASP.Net\"+lcVersion,"Path")) + RETURN .T. +ENDFUNC +* +FUNCTION MergeText + LPARAMETER tcString, tcDelimiter, tcDelimiter2, llNoaspsyntax + LOCAL __Loeval + __Loeval = CREATEOBJECT('wwEval') + RETURN __Loeval.meRgetext(@tcString,tcDelimiter,tcDelimiter2,llNoaspsyntax) +ENDFUNC +* +FUNCTION MimeDateTime + LPARAMETER lvDatetime + LOCAL lcDays, lcMonths, lnCount, lcMonth, ltTime, lnOffset, lnOff, lnDiff + lcMonths = "JanFebMarAprMayJunJulAugSepOctNovDec" + IF VARTYPE(lvDatetime)="C" + DIMENSION laParts[1] + lnCount = apArsestring(@laParts,lvDatetime," ") + IF lnCount<5 + RETURN {} + ENDIF + lcMonth = TRANSFORM((ATC(laParts(3), lcMonths)+2)/3) + ltTime = CTOT(lcMonth+"/"+laParts(2)+"/"+laParts(4)+" "+laParts(5)) + IF lnCount<6 + RETURN ltTime + ENDIF + lnOffset = geTtimezone()/60 + lnOff = VAL(laParts(6))/100 + lnDiff = (lnOffset+lnOff)*3600 + RETURN ltTime-lnDiff + ELSE + IF EMPTY(lvDatetime) + lvDatetime = DATETIME() + ENDIF + lnDay = DOW(lvDatetime) + IF lnDay=0 + RETURN "" + ENDIF + lcDays = "SunMonTueWedThuFriSat" + lcMime = SUBSTR(lcDays, ((lnDay-1)*3)+1, 3)+", "+ ; + TRANSFORM(DAY(lvDatetime))+" " + lcMime = lcMime+SUBSTR(lcMonths, ((MONTH(lvDatetime)-1)*3)+1, 3)+ ; + " "+TRANSFORM(YEAR(lvDatetime))+" "+PADL(HOUR(lvDatetime), ; + 2, "0")+":"+PADL(MINUTE(lvDatetime), 2, "0")+":"+ ; + PADL(SEC(lvDatetime), 2, "0") + lnOffset = geTtimezone()/60 + RETURN lcMime+IIF(lnOffset>0, " -", " +")+ ; + PADL(TRANSFORM(ABS(lnOffset)), 2, "0")+"00" + ENDIF +ENDFUNC +* +FUNCTION PropertyDump + LPARAMETER loObject + LOCAL lnX, lnCount, lcOutput + lnCount = AMEMBERS(laFields, loObject) + lcOutput = "" + FOR lnX = 1 TO lnCount + lcType = TYPE("loObject."+laFields(lnX)) + IF ATC(lcType, "UO")=0 + lvValue = EVALUATE("loObject."+laFields(lnX)) + IF lcType="C" .AND. LEN(lvValue)>80 + lvValue = LEFT(lvValue, 80) + ENDIF + lcOutput = lcOutput+CHR(13)+CHR(10)+LOWER(laFields(lnX))+" = "+ ; + ALLTRIM(TRANSFORM(lvValue, "")) + ELSE + lcOutput = lcOutput+CHR(13)+CHR(10)+LOWER(laFields(lnX))+" = "+ ; + IIF(TYPE("loObject."+laFields(lnX))="O", "Object", ; + "NULL") + ENDIF + ENDFOR + RETURN lcOutput +ENDFUNC +* diff --git a/config.fpw b/config.fpw new file mode 100644 index 0000000..567fd64 --- /dev/null +++ b/config.fpw @@ -0,0 +1,45 @@ + + +SCREEN = OFF + + +_STARTUP = "" + +* to eliminate load time: +_BROWSER = "" +_SPELLCHK = "" +_GENMENU = "" +_GENGRAPH = "" +_GENXTAB = "" +_COVERAGE = "" +_SCCTEXT = "" +_CONVERTER = "" +_TRANSPORTER = "" +_BUILDER = "" +_WIZARD = "" + +* other special CONFIG.FPW settings you may wish to change: +* (these are the defaults) +MVCOUNT = 1025 +OUTSHOW = ON + +* Set other global settings here if you like, for example: +RESOURCE = OFF +_THROTTLE = 0 + +* See the application object's SetDataSessionSets() method +* for some additional settings you +* may like to use in your config file. +* The following are not the default settings, +* (and ordinarily will be taken care of in the +* Load of private-session forms and formsets): +TALK = OFF +MULTILOCKS = ON +EXCLUSIVE = OFF +SAFETY = OFF +editwork=c:\ +sortwork=c:\ +tmpfiles=c:\ +progwork=c:\ +STACKSIZE = 512 +CODEPAGE = 1252 \ No newline at end of file diff --git a/program1.prg b/program1.prg new file mode 100644 index 0000000..bf086f3 --- /dev/null +++ b/program1.prg @@ -0,0 +1,10 @@ + +select id, count(*) as nr from ips_voyages group by id having count(*)>1 into cursor tt +select tt +scan + sele ips_voyages + locate for id = tt.id + if found() + delete in ips_voyages + endif +endscan \ No newline at end of file diff --git a/roaauto.Stats b/roaauto.Stats new file mode 100644 index 0000000..862611b --- /dev/null +++ b/roaauto.Stats @@ -0,0 +1,11 @@ +[Sizes] +Compressed=6255396 +Certificates=286 +Bitmap=0 +CompressedResources=5120 +OriginalResources=5120 +Protected=6934528 +CompressedDataAfter=6246340 +UncompressedDataAfter=7710974 +PFSFiles=0 +ProtectedBy=4.40 (Public Build) diff --git a/roaauto.arm b/roaauto.arm new file mode 100644 index 0000000..baac4f4 --- /dev/null +++ b/roaauto.arm @@ -0,0 +1,46 @@ + +[Project] +BackupKeyOptions=3 +BitmapSeconds=1 +CertificateCount=1 +Compression=0 +IniStyle=ArmadilloV3 +Language=English (US) +MessageLanguage1=English (US) +Name=faz +ShowLoading=0 +TargetFile=roaauto.exe +Version=100 + +[Project#Certificate0] +BitmapSeconds=1 +Key=DEFAULT +KeyTypes=0x44 +Name=default + +[Project#Certificate0#ExpireType] +Revert=0 + +[Project#Certificate0#Nag] +ShowBefore=0 + +[Project#Certificate0#NagAfter] +ShowAfter=0 + +[Project#InterceptedLibs] +Lib0=+MSVBVM50.DLL +Lib1=+MSVBVM60.DLL +Lib2=+VFP5R.DLL +Lib3=+VFP6R.DLL +Lib4=+VFP7R.DLL +Lib5=+VFP8R.DLL +Lib6=+VFP9R.DLL +Lib7=+PBVM70.DLL +Lib8=+MSVCRT.DLL +Lib9=+PROJ.DLL +Lib10=+MSJAVA.DLL +Lib11=+OLE32.DLL +Lib12=+VDFVM8.DLL +Lib13=+MFC71.DLL +Lib14=-* +LibCount=15 diff --git a/roaauto.pjt b/roaauto.pjt new file mode 100644 index 0000000..140f9ed Binary files /dev/null and b/roaauto.pjt differ diff --git a/roaauto.pjx b/roaauto.pjx new file mode 100644 index 0000000..63f2503 Binary files /dev/null and b/roaauto.pjx differ diff --git a/roaauto_instructiuni.txt b/roaauto_instructiuni.txt new file mode 100644 index 0000000..9da8f5b --- /dev/null +++ b/roaauto_instructiuni.txt @@ -0,0 +1,181 @@ +Manual ROA Service Auto (ROAAUTO) + +Aplicatia ROAAUTO este realizata pentru managementul activitatii de service auto si are ca scop urmarirea completa a ciclului de executie a reparatiilor auto, de la intrarea autovehiculului in service pana la emiterea facturii de reparatii. + +Ciclul de executie: +1. Generarea comenzii (documentul care insoteste autovehiculul pe tot parcursul reparatiei); +2. Normare pe operatii a reparatiilor ce vor fi efectutate, precum si repartizarea pe mecanici a manoperei aferente acestor operatii; +3. Inregistrarea consumului de materiale pentru reparatie în programul "ROA Gestiune" (ROAGEST) +4. Verificarea si validarea devizului de reparatii; +5. Emiterea devizului si facturarea. Se pot emite facturi de avans și/sau finale. Se poate emite inclusiv o factura pentru mai multe comenzi ale aceluiasi client. + + +Rapoarte: +- facturi emise in luna aleasa; +- rapoarte de verificare a unuia sau a mai multor articole (pret vanzare, numar de bucati pe comanda si daca a fost facturata comanda, stoc precedent, intrari in luna, iesiri in luna, stoc final); +- rapoarte despre productia realizata si nefacturata (productie neterminata): bonuri materiale pe comenzi, pe responsabili, pe sectii, valori materiale bonate pe comenzi nefacturate; +- rapoarte despre manopera: manopera totala, manopera detaliata pe comenzi sau pe operatii pentru unul sau toti mecanicii, manopera pe comenzi inchise pe sectie; +- rapoarte despre orele de manopera in legatura cu societatile de asigurare, pe anumite perioade; +- rapoarte de salarizare a personalului direct productiv in functie de operatiunile de manopera executate pe comenzi; +- raport de verificare a veniturilor provenite din manopera si materiale; + +- facturile emise: pe clienti, pe asiguratori, facturi de ITP, spalare, pe sectii; +- comenzi validate pe marci de masini; +- facturare automata a devizelor; +- centralizatoare de comenzi validate; + +Normative de reparatii: +Programul este insotit de normative de reparatii pentru mai multe tipuri de autovehicule generat de utilizatori, existand posibilitatea ca aceasta baza de date sa fie completata si de catre utilizator. + + +1. Pagina "Configurare" +Clienți. Listă clienți și vehicule +Mecanici. Listă mecanici +Secții. Listă secții/centre de cost +Asiguratori. Listă asiguratori și inspectori +Mărci mașini. Listă mărci și modele mașini +Dealeri +Delegați. Listă delegați facturi +Ansamble. Ansamble vehicule (se folosesc la normative) +Norme. Normative operații service +Prețuri. Listă prețuri service +Serii numere. Inițializare plaje numere comenzi, facturi, bonuri fiscale, chitanțe + +Optiuni + +I. Setari comnezi si facturare +Setari legate facturare ITP (sectia) +419. Clienţi - creditori (P) +707. Venituri din vânzarea mărfurilor +4111. Clienţi (A) +667. Cheltuieli privind sconturile acordate (Sconturile sunt reduceri financiare acordate pentru plata anticipată a unei datorii) + +II. Setari manopera : Pretul manopera/regie + +III. Listare facturare si alte setari : Se aleg datele care se vor/nu se vor sa apara pe factura si aspectul + + +2. Pagina "Comenzi" +2.1 Generare comandă +- Se deschide comandă nouă +- Se alege tipul de comanda( post-garantie/ in garantie / regie / pregatire / productie ) +Comenzile tip post-garanție și garanție se închid prin factură. +Comanda tip regie se închide prin validare. +- Se alege clientul și vehiculul +- Se completeaza operațiile cerute de client și opțional observații și daune constatate, nr. km, ore funcționare, asigurator + +ATENTIE Bonuri de consum +- Materialele consumate pe o lucrare se adaugă pe comandă din programul de gestiune ROAGEST, pagina Mărfuri la preț de achiziție > Consum > Bon de consum pe lucrări în curs de execuție. +- Se alege obligatoriu comanda. + + +2.2 Normare comandă +- Se alege o comandă +- Se apasă butonul Normare și apare formularul "Vizualizare operații" de pe comandă +- În formularul "Vizualizare operații" se afișează operațiile de manoperă, materiale și se poate completa opțional devizul estimativ. +- În formularul "Vizualizare operații" se poate modifica numărul de ore și prețul/oră pentru fiecare operație +- În formularul "Vizualizare operații", se validează operațiile după ce au fost executate +- În formularul "Vizualizare operații" se pot modifica toate datele inițiale ale comenzii +- În formularul "Vizualizare operații" se pot adăuga, modifica, șterge și valida operații +- Pentru adăugarea de operații se apasă butonul de "Adăugare operație" din formularul "Vizualizare operații" +- La adăugarea operațiilor se alege unul sau mai mulți mecanici și prețul/oră +- În formularul "Adăugare operație", se pot adauga operații noi în normativul de operații +- În formularul "Normare" se poate modifica datele inițiale ale comezii precum: tipul comenzii, nr. km, ore funcționare + +Normare - In prima fereastra se poat vizualiza comenzile si modificare a tipul de comanda in cazul introducerii gresite (post-garantie / garantie / regie) + - Dupa selectarea comenzii se deschide pagina de normare care contine 3 ferestre: += Manopera - Vizualizare, validare, modificare fiecare tip de operatie efectuat in parte + - Adaugare/Stergere tipuri de operatie += Materiale - Materiale folosite in timpul comenzii + += Deviz estimativ - Aproximare a totalului comenzii + + + +2.3 Validare comandă +- După validarea tuturor operațiilor și înregistrarea bonurilor de consum +- Se alege o comandă și se validează +- După validare nu se mai pot adăuga operații sau bonuri de consum (gestiune) + +2.4 Vizualizare stocuri - Vizualizare gestiuni (la pret de achizitie/vanzare) + +2.5 Comenzi în luna curenta +- Se pot vizualiza si lista comenzile / devizele pentru comenzile validate +- Vizualizare operatiuni validate/nevalidate per comanda (nu se pot face modificari din aceasta fereastra) + +2.6 Istoric comenzi +- Se pot vizualiza, lista(deviz/raport comanda) toate comenzile fara a tine cont ca sunt inchise sau nu +- Vizualizare operatiuni validate/nevalidate per comanda (nu se pot face modificari din aceasta fereastra) + +2.7 Vizualizare date comenzi +- Raport clienți, comenzi, operații / materiale +- Viz. date comenzi -> Lista istoric comenzi-clienti-masini-manopera-materiale + +2.8 Rapoarte +- Vizualizare comenzi, listare deviz si raport(solicitari client, observatii, defectiuni constatate) + + +3. Pagina "Facturare" +3.1. Factura comandă (deviz) +- Se poate emite o factură de avans, indiferent daca comanda a fost validată, imediat după generarea comenzii. +- Se poate emite o factură finală pentru una sau mai multe comenzi ale aceluiași client. +- Pe factura finală se afișeaza valoarea manoperei (operații) și materialelor (bonuri de consum), avansul (dacă este cazul). +- Pe factura finală se pot adăuga articole suplimentare (ex: refacturare servicii executate de terți, cum ar fi transport sau verificări) +- Articolele suplimentare se pot crea direct în formularul de facturare. Trebuie să aibă bifa "preț de catalog". +- La emiterea facturii se poate alege "fără încasare", "bon fiscal numerar sau card", "chitanță". +- Se pot face modificare client/masina pe comanda ("Modificare client/masina pe comanda") + +3.2. Facturare ITP/ Facturare spalare auto preia setarile din configurare (1. Configurare) + +3.3. Factura diverse -> se alege dupa caz/nevoie + +3.4. Facturi in luna curenta - vizualizare facturi finalizate +Se poate realiza relistare factura si listare raport facturi + +3.5. Inchidere Regie: Vizualizare comenzi de regie +Realizare inchidere comanda din regie + +Nota: Comenzile din regie sunt considerate inchise/terminate in momentul in care sunt validate (in functie de optiunea din baza de date - nu exista configurare in program - trebuie facuta) + +Tip operatie (id_set) = 31006 +6588 = 482 -valoare totala pe fiecare sectie (materiale + manopera) +6588 = 482 +valoare totala (manopera + materiale) +711 = 332 valoare materiale (pentru inchidere materiale consumate pe lucrare) + +Se poate realiza Listare deviz pentru comenzile cu manopera + +3.6. Comenzi de regie in luna curenta - vizualizare comenzi de regie in curs de finalizare + +3.7. Inchidere comenzi de productie +Realizare inchidere comanda de productie +Tip operatie (id_set) = 31007 +Comenzile din productie sunt considerate inchise/terminate in momentul in care sunt validate + +Se poate realiza Listare deviz + +3.8. Rapoarte - Vizualizare/Listare diferite tipuri de rapoarte in functie de nevoie utilizatorului (asiguratori, facturi emise, ITP, spalare, finale, validare marci -> se alege un brand pt vizualizare) + +4. Pagina "Manoperă" + +Se distribuie manopera pe mecanici + +4.1 Manopera luna curenta: lucrari in luna curenta, Editare si distribuire timp normat mecanici pe lucrari, setii si operatii + +4.2 Manopera comenzi inchise: lucrari inchise in luna curenta, Editare si distribuire timp normat mecanici pe lucrari, setii si operatii + +4.3 Raport de salarizare - Listare rapoarte de salarizare manoperă + +4.4 Rapoarte - Se pot vizualiza diferite liste in functie de cerere (Pt un singur salariat/ mai multi; pt firmele de asig in functie de nr. ore + preturi) +- In cazul in care lucreaza 2 persoane pe aceasi operatie trebuie distribuite orele muncite individual pe operatiunea respectiva + +4.5 Ore de manopera pe asiguratori (Afiseaza nr de ore pt fiecare asigurator in luna curenta sau pe o perioada de timp) + +5. Pagina "Analiză" +- Verificări venituri pe lucrări față de contabilitate +- Raport articole pe comenzi +- Raport producție neterminată +- Centralizator comenzi pe tipuri + + + +607 - Cheltuieli privind marfurile diff --git a/sqlnet.log b/sqlnet.log new file mode 100644 index 0000000..ea756ca --- /dev/null +++ b/sqlnet.log @@ -0,0 +1,114 @@ + + +*********************************************************************** +Fatal NI connect error 12541, connecting to: + (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=XE)(CID=(PROGRAM=C:\Program Files\Microsoft Visual FoxPro 9\vfp9.exe)(HOST=PC-W7-01)(USER=Marius?Mutu)))) + + VERSION INFORMATION: + TNS for 32-bit Windows: Version 10.1.0.2.0 - Production + Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 10.1.0.2.0 - Production + Time: 04-DEC-2014 17:05:58 + Tracing not turned on. + Tns error struct: + ns main err code: 12541 + TNS-12541: TNS:no listener + ns secondary err code: 12560 + nt main err code: 511 + TNS-00511: No listener + nt secondary err code: 61 + nt OS err code: 0 + + +*********************************************************************** +Fatal NI connect error 12541, connecting to: + (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=XE)(CID=(PROGRAM=C:\Program Files\Microsoft Visual FoxPro 9\vfp9.exe)(HOST=PC-W7-01)(USER=Marius?Mutu)))) + + VERSION INFORMATION: + TNS for 32-bit Windows: Version 10.1.0.2.0 - Production + Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 10.1.0.2.0 - Production + Time: 04-DEC-2014 17:06:05 + Tracing not turned on. + Tns error struct: + ns main err code: 12541 + TNS-12541: TNS:no listener + ns secondary err code: 12560 + nt main err code: 511 + TNS-00511: No listener + nt secondary err code: 61 + nt OS err code: 0 + + +*********************************************************************** +Fatal NI connect error 12541, connecting to: + (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=XE)(CID=(PROGRAM=C:\Program Files\Microsoft Visual FoxPro 9\vfp9.exe)(HOST=PC-W7-01)(USER=Marius?Mutu)))) + + VERSION INFORMATION: + TNS for 32-bit Windows: Version 10.1.0.2.0 - Production + Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 10.1.0.2.0 - Production + Time: 04-DEC-2014 17:06:16 + Tracing not turned on. + Tns error struct: + ns main err code: 12541 + TNS-12541: TNS:no listener + ns secondary err code: 12560 + nt main err code: 511 + TNS-00511: No listener + nt secondary err code: 61 + nt OS err code: 0 + + +*********************************************************************** +Fatal NI connect error 12541, connecting to: + (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=XE)(CID=(PROGRAM=C:\Program Files\Microsoft Visual FoxPro 9\vfp9.exe)(HOST=PC-W7-01)(USER=Marius?Mutu)))) + + VERSION INFORMATION: + TNS for 32-bit Windows: Version 10.1.0.2.0 - Production + Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 10.1.0.2.0 - Production + Time: 04-DEC-2014 17:06:19 + Tracing not turned on. + Tns error struct: + ns main err code: 12541 + TNS-12541: TNS:no listener + ns secondary err code: 12560 + nt main err code: 511 + TNS-00511: No listener + nt secondary err code: 61 + nt OS err code: 0 + + +*********************************************************************** +Fatal NI connect error 12541, connecting to: + (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=XE)(CID=(PROGRAM=C:\Program Files\Microsoft Visual FoxPro 9\vfp9.exe)(HOST=PC-W7-01)(USER=Marius?Mutu)))) + + VERSION INFORMATION: + TNS for 32-bit Windows: Version 10.1.0.2.0 - Production + Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 10.1.0.2.0 - Production + Time: 09-JAN-2015 09:42:58 + Tracing not turned on. + Tns error struct: + ns main err code: 12541 + TNS-12541: TNS:no listener + ns secondary err code: 12560 + nt main err code: 511 + TNS-00511: No listener + nt secondary err code: 61 + nt OS err code: 0 + + +*********************************************************************** +Fatal NI connect error 12541, connecting to: + (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=XE)(CID=(PROGRAM=C:\Program Files\Microsoft Visual FoxPro 9\vfp9.exe)(HOST=PC-W7-01)(USER=Marius?Mutu)))) + + VERSION INFORMATION: + TNS for 32-bit Windows: Version 10.1.0.2.0 - Production + Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 10.1.0.2.0 - Production + Time: 09-JAN-2015 09:43:14 + Tracing not turned on. + Tns error struct: + ns main err code: 12541 + TNS-12541: TNS:no listener + ns secondary err code: 12560 + nt main err code: 511 + TNS-00511: No listener + nt secondary err code: 61 + nt OS err code: 0 diff --git a/versiune_db.txt b/versiune_db.txt new file mode 100644 index 0000000..bd5ab53 --- /dev/null +++ b/versiune_db.txt @@ -0,0 +1 @@ +2026_03_31_02 \ No newline at end of file