Search  
Thursday, May 24, 2012 ..:: Forum ::.. Register  Login
 Forum Minimize
Pentru a putea posta mesaje trebuie să vă înregistraţi.
Notă: Mesajele cu conţinut jignitor sau ilegal (inclusiv cereri de soft piratat) nu sunt acceptate şi vor fi şterse imediat .

Pentru a primi raspunsuri rapide si corecte, scrieti in mesaj ce intentionati sa faceti, ce mesaj de eroare primiti, in ce context si in urma caror actiuni. De asemenea, mentionati versiunea de FoxPro in care lucrati!
Dacă nu specificați versiunea, se consideră VFP 9.0 SP2.

SearchForum Home
  Visual FoxPro  .NET Interop  Interfata C# pe...
 Interfata C# pentru VFP
 
 8/20/2007 11:50:04 AM
User is offlineaxelsoft
8 posts
www.axelsoft.info


Interfata C# pentru VFP
 (N/A)

Salut comunitate,

Testez adaugarea la aplicatii FoxPro (DOS) a unei interfete profesionale SAP Business One: http://www.axelsoft.info/site/axelSA.htm, http://www.axelsoft.eu

Am creat un .dll in VFP 9.0 la care am facut References in Studio, dar am o problema. Deschid un tabel (DOC.DBF) intr-o procedura si nu-l pot apela in alta procedura.

Ma poate ajuta cineva ?

Multumesc,

Ion STANCA

DEFINE CLASS StudioFox AS Session OLEPUBLIC

PROCEDURE Insert (sNume AS String, sPrenume AS String, nVirsta AS integer, OutTest AS String) AS String

myObject = CREATEOBJECT('StudioFox')

Ret=myObject.OpenDBF()

IF USED('Doc')

  GO TOP

  RETURN 'Doc este deschis: '+Doc.Tip_Doc+' '+Doc.Nr_Doc + sOpenDBF

ELSE

  RETURN 'Doc nu este deschis: '

ENDIF

ENDPROC

 

PROCEDURE OpenDBF ()

PUBLIC sOpenDBF AS String OF StudioFox

sOpenDBF = 'ABCD'

SELECT 0

USE Doc.DBF ALIAS Doc

ENDPROC

ENDDEFINE

In C#

using studiofox;

...

private void StudioFox_Click(object sender, EventArgs e)

{

   string RetTest = ""; // Return

   string OutTest = "?"; // Output

   studiofox.studiofoxClass oStudioFox = new studiofoxClass();

   RetTest = oStudioFox.Insert("Stanca", "Ion", 53, OutTest);

   ShowMessage(RetTest.ToString() + "/" + OutTest.ToString(), "info");

}

 

 8/20/2007 2:11:28 PM
User is offlineDorin Vasilescu
1366 posts
1st




Re: Interfata C# pentru VFP
 (N/A)
Pai tu in procedure Insert creezi o noua instanta, de data asta in VFP, a aceleiasi clase
Avand in vedere ca este clasa session, acea instanta va avea sesiune privata de date

Inlocuieste :

myObject = CREATEOBJECT('StudioFox')

Ret=myObject.OpenDBF()

cu :

IF not USED('Doc')
    this.OpenDBF()
ENDIF



 8/20/2007 5:07:16 PM
User is offlineaxelsoft
8 posts
www.axelsoft.info


Re: Interfata C# pentru VFP
 (N/A)

Salut Dorin,

Multumesc pentru raspunsul prompt.

S-a rezolvat si este mult mai simplu asa.

Dupa cum constati eu stau mai prost cu noua tehnologie, dar daca ma scoate cineva din asemenea blocaje ma descurc. Am 53 ani si am lucrat multi ani la o aplicatie de salarii in FoxPro (sub Unix) pentru zeci de mii de salariati. Abia anul acesta Automobile Dacia a schimbat aceasta aplicatie de salarii.

AXEL SOFT este prima (si pina acum singura) companie care a implementat in Romania SAP Business One (o solutie pentru companii mici, in special filiale ale unor mari corporatii).

Te intereseaza sa facem (migram) impreuna o astfel de aplicatie de salarii in SAP (Business One) ?

Ion STANCA

 

 8/21/2007 10:23:31 AM
User is offlineDorin Vasilescu
1366 posts
1st




Re: Interfata C# pentru VFP
 (N/A)
Salut, cu placere.
Nu cunosc SAP Bussiness One.  Nu are deja un modul de salarii + HR? In ce ar consta acea portare ?

 8/25/2007 10:40:17 AM
User is offlineaxelsoft
8 posts
www.axelsoft.info


Re: Interfata C# pentru VFP
 (N/A)


Salut comunitate,

Am reusit sa "leg" o interfata profesionala SAP Business One la una dintre aplicatiile noastre FoxPro (gestiunea stocurilor bugetare).
Acum aceasta aplicatie poate rula atit cu noua interfata, cit si cu vechea interfata (interfata duala).
Pentru AXEL SOFT problema migrarii codului din FoxPro in C# a devenit liniara. Tot ce vom scrie de acum inainte va fi in C#. In timp codul FoxPro va fi trecut in C#.

Cine vrea detalii sa ma contacteze la ionstanca@axelsoft.net

Transmit paramtri de intrare (Data1, Data2 ...) din C# spre FoxPro astfel: string sSAPNotaCont = oLibraryFox.SAPNotaCont(this.Data1.EditValue, this.Data2.EditValue, this.Cod_Gest.EditValue, this.cbLstDoc.Checked, this.obText.Checked, this.obWord.Checked, this.obExcel.Checked)

iar din FoxPro spre C# doar un string sSAPNotaCont

1. Este posibil sa am in FoxPro si parametri de iesire, cum este in C# out ... ?
2. In C# am acces la variabilele globale din FoxPro ?

Cu multumiri,

Ion STANCA

 

Iata codul C#:

// 24.08.2007

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using AxelSAControlsFox.WindowsControls;

using AxelSAControlsFox.SqlObjects;

using System.IO;

using System.Diagnostics;

using Excel;

using System.Data.OleDb;

using AxelSAControlsFox;

using libraryfox;

namespace AxelSAFox

{

public partial class NotaCont : frmCommon

{

public NotaCont()

{

InitializeComponent();

}

public NotaCont(Company Company)

: base(Company)

{

InitializeComponent();

oCompany = Company;

}

private void btnCancel_Click(object sender, EventArgs e)

{

this.Close();

}

private void btnList_Click(object sender, EventArgs e)

{

libraryfox.libraryfoxClass oLibraryFox = new libraryfoxClass();

oLibraryFox.StartSAP();

oLibraryFox.ContInit();

oLibraryFox.Config();

oLibraryFox.OpenDBF();

string sSAPNotaCont = oLibraryFox.SAPNotaCont(this.Data1.EditValue, this.Data2.EditValue, this.Cod_Gest.EditValue,

this.cbLstDoc.Checked, this.obText.Checked, this.obWord.Checked, this.obExcel.Checked); // 02.03 - Ar trebui parametru CodProdL

ShowMessage(sSAPNotaCont.ToString() + ": " + Data1.EditValue + ", " + Data2.EditValue + ", " + Cod_Gest.EditValue, "info");

}

}

}

 

Iata si codul Fox:

*
* LibraryFox - Biblioteca de proceduri .PRG
* AXEL SOFT S.R.L. - Ion STANCA
* 25.08.2007
*

DEFINE CLASS LibraryFox AS Session OLEPUBLIC

PROCEDURE SAPNotaCont (Data1L AS String, Data2L AS String, CodGestL AS string, ;

cbLstDoc AS Boolean, obText AS Boolean, obWord AS Boolean, obExcel AS Boolean) AS String

PUBLIC sPublicFoxPro AS String OF StudioFox &&= 'Test sPublicFoxPro'

sPublicFoxPro = 'Test sPublicFoxPro'

Data1 = CTOD(Data1L)

Data2 = CTOD(Data2L)

CodGest = VAL(CodGestL)

=this.NotaCont(0, cbLstDoc)

RETURN 'OK NotaCont FoxPro'

ENDPROC

 

PROCEDURE StartSAP && Numai pentru C#. In FoxPro acesta procedura este in UM.PRG

*-----------------

SET DATE TO DMY

SET CENTURY ON

CLOSE DATABASES

DECLARE INTEGER WinExec IN win32api STRING, INTEGER && Pentru a lansa executabile .EXE sub WINDOWS

PUBLIC vFoxPro && Versiune: .T. - FoxPro, .F. - SAP (C#)

vFoxPro = .F.

IF NOT vFoxPro

SET DEFAULT TO D:\UM\

ENDIF

PUBLIC Bell

Bell = .T.

PUBLIC ParolaLucr && ParolaLucrarii

ParolaLucr=''

PUBLIC emailAXEL, TelAXEL1, TelAXEL2

PUBLIC CodGest, DenGest && Gestiune

PUBLIC CodProd, GrupaInvProd, SeriaProd, DenProd, DenProdC, SeriaProd, CodProdMin, CodProdNou, ContGest, SursaFin, ArtBug, ClasAF

PUBLIC TipMag, CodMag, DenMag, NumeGest

PUBLIC m.Institutia, LocalitUM, AdresaUM

m.Institutia = 'AXEL SOFT SRL'

LocalitUM = 'BUCURESTI'

AdresaUM = 'Economu Cezarescu 39, Sector 6'

PUBLIC LunaCrt, AnulCrt, DataIntii, DataUlt, ll, aa

LunaCrt=MONTH(DATE())

AnulCrt= YEAR(DATE())

PUBLIC Data1, Data2, DataCalc, SecCalc

DataCalc = CTOD('31.12.2007')

=this.SalvDate(0) && Salvarea date din retea in local o singura date pe zi

=this.SetPRN()

RETURN ''

ENDPROC

 

PROCEDURE NotaCont

*-----------------

PARAMETER CodProdL, LstDoc

IF TYPE('CodProdL') <> 'N'

CodProdL=0

ENDIF

CodMeniuL=IIF(vFoxPro, ALLTRIM(LEFT(PROMPT(),5)), '02.03')

IF DataCalc <= CTOD('31/12/2003')

CheckOI=0

ELSE

CheckOI=0

ENDIF

CheckErori = 1

TipDoc =SPACE(12)

NrDoc =SPACE(8)

DataDoc={ / / }

IF vFoxPro

CodGest =0

ENDIF

SursaFin =0

CodMag =0

CodPart =SPACE(20)

AnalitGest =1

AnalitSursa=0

AnalitArt =0

AnalitMag =0

NoteContDAT=0

DesfAmort =0

CheckNrDoc =0

STORE '' TO DenGest,DenSursa,DenMag

STORE SPACE(24) TO rContDeb,rContCred,rArtBug

IF CodProdL <> 0

Data1=CTOD('01/01/1000')

Data2=CTOD('31/12/9999')

ELSE

ACTIVATE WINDOW List

CLEAR

IF vFoxPro

Data1=DataIntii

Data2=DataCalc

ELSE

* Data1 si Data2 vin din SAPNotaCont

ENDIF

=this.Bell()

IF DataCalc=CTOD('31/12/2003')

=this.WaitWindow(' Pentru NC reeval. '+CHR(13)+ ;

' in 3.34 numai Anexa: 2A, 2B, 2C '+CHR(13)+ ;

' (fara Gest., Mag., Cont, Sursa sau bifa) '+CHR(13)+ ;

' Daca setati cont posibil sa nu listeze doc. si '+CHR(13)+ ;

' Tot.Doc. sa fie diferit ', 'NOWAIT')

ELSE

=this.WaitWindow(' Pentru Sursa si Art dupa cont '+CHR(13)+ ;

' in 3.14 CONT_BUGET = '+ALLTRIM(ContBuget)+CHR(13)+ ;

' (3 cifre si spatiu, apoi iesitit din AXEL) '+CHR(13)+CHR(13)+ ;

' Daca setati cont posibil sa nu listeze doc. si '+CHR(13)+ ;

' Tot.Doc sa fie diferit ^136 ', 'NOWAIT')

ENDIF

IF vFoxPro

@ 0,2 SAY ' ^123 '+PROMPT()+' (Nu este necesar 3.1 Recalcul pret mediu ponderat)'

@ 1,2 SAY ' :Sursa:Art_Bug apar dupa cont daca primele 3 cifre din cont sunt in 3.14, Cont_Buget='+ContBuget+' ' COLOR *B+/W

@ 2,2 SAY 'Cod Gestiune ' GET CodGest PICTURE '999'

IF TotalProd

@ 2,30 SAY ' Verificare la nivel de Cod_Prod / cfg.Tot_Prod=.T. '

ENDIF

@ 3,2 SAY 'Perioada ' GET Data1

@ 3,30 SAY '-' GET Data2

@ 4,2 SAY 'Cont Debitor ' GET rContDeb PICTURE '@!'

@ 5,2 SAY 'Cont Creditor ' GET rContCred PICTURE '@!'

@ 6,2 SAY ' pentru analitice se adauga la sfirsit * '

@ 7,2 SAY 'Sursa finantare ' GET SursaFin PICTURE '999999'

@ 7,25 SAY '-1 sursa 0 (nedefinita)'

@ 8,2 SAY 'Articol bugetar ' GET rArtBug PICTURE '@!'

@ 9,2 SAY 'Document: Tip' GET TipDoc PICTURE '@!'

@ 9,34 SAY 'Nr.' GET NrDoc PICTURE '@!'

@ 9,49 SAY 'Data' GET DataDoc

@ 10,2 SAY 'Cod Magazie (LF)' GET CodMag PICTURE '99999'

@ 10,30 SAY 'Cod_Part' GET CodPart PICTURE '@!'

@ 11,2 GET CheckNrDoc FUNCTION '*C Centralizator NC la nivel de documente (bifat)'

@ 12,2 GET CheckOI FUNCTION '*C Active fixe de natura OI < '+ALLTRIM(this.STRs(ValLimAF, 15))+' (bifat), VAL_LIM_AF in 3.14'

@ 13,2 SAY ' NOTA: Pentru amortizare, lansati 3.1 (sfirsitul lunii) si 2.10 '

=this.ReadPag(14)

@ 16,2 SAY 'CTRL+W Validare, ESC Renuntare '

@ 2,48 SAY 'Cont Analitic'

@ 3,48 GET AnalitGest FUNCTION '*C Cod Gestiune '

@ 4,48 GET AnalitSursa FUNCTION '*C Sursa Finantare (daca contul este in 3.14 Cont_Buget)'

@ 5,48 GET AnalitMag FUNCTION '*C Magazie (DEP/LF)'

@ 6,48 GET DesfAmort FUNCTION '*C NC Amortiz.Desf.(bifat)'

@ 7,48 GET CheckErori FUNCTION '*C Erori documente (bifat)'

@ 8,48 GET NoteContDAT FUNCTION '*C '+LEFT(IIF(EMPTY(cfg.Calea_NC), 'A:', ALLTRIM(cfg.Calea_NC))+'/NoteCont.DAT '+DTOC(cfg.Data_NC), 26)

READ CYCLE

DEACTIVATE WINDOW List

ENDIF && vFoxPro

ENDIF

TipDoc=PADR(UPPER(ALLTRIM(TipDoc)), 12)

NrDoc =PADR(UPPER(ALLTRIM(NrDoc)), 8)

IF LASTKEY()=27

RETURN ''

ENDIF

IF Data2 < Data1 OR EMPTY(Data1) OR EMPTY(Data2)

=this.Bell()

=this.WaitWindow(' Perioada gresita ['+DTOC(Data1)+' - '+DTOC(Data2)+'] '+CHR(13)+ ;

' Lansati meniul 3.1 Recalcul pret mediu ponderat ^dv ', 'NOWAIT')

RETURN ''

ENDIF

IF !EMPTY(NrDoc)

IF !EMPTY(DataDoc) AND !BETWEEN(DataDoc, Data1, Data2)

=this.Bell()

=this.WaitWindow(' Data Document '+DTOC(DataDoc)+' trebuie sa fie in perioada ['+DTOC(Data1)+' - '+DTOC(Data2)+'] '+CHR(13)+ ;

' Se ignora perioada ^qg ', 'TIMEOUT 5')

STORE { / / } TO Data1,Data2

ENDIF

ELSE

IF !EMPTY(DataDoc)

=this.Bell()

=this.WaitWindow(' Nu are sens sa definiti Data '+DTOC(DataDoc)+' fara Nr.Document '+CHR(13)+ ;

' Se ignora Data Document ^qh ', 'TIMEOUT 5')

DataDoc={ / / }

ENDIF

ENDIF

rArtBug=ALLTRIM(rArtBug)

rContDeb=ALLTRIM(rContDeb)

IF INLIST(RIGHT(rContDeb,1), '*', '.', '?') && Orice analitic

rContDeb=LEFT(rContDeb, LEN(rContDeb)-1)

ELSE

rContDeb=PADR(ALLTRIM(rContDeb), 24)

ENDIF

rContCred=ALLTRIM(rContCred)

IF INLIST(RIGHT(rContCred,1), '*', '.', '?') && Orice analitic

rContCred=LEFT(rContCred, LEN(rContCred)-1)

ELSE

rContCred=PADR(ALLTRIM(rContCred), 24)

ENDIF

IF CodProdL <> 0

LstDoc=.F.

ELSE

IF vFoxPro

LstDoc=this.NoYes('Listati si componenta documentelor ?'+CHR(13)+ ;

'(Produsele)')

ENDIF

ENDIF

CodPart=ALLTRIM(CodPart)

=this.Bell()

IF vFoxPro

=this.WaitWindow(PROMPT()+CHR(13)+ ;

' ESC - Renuntare listare ^qi ', 'NOWAIT')

ENDIF

IF CodGest > 0

SELECT Gest

SET ORDER TO TAG Cod_Gest

SET RELATION TO

SEEK CodGest

DenGest=ALLTRIM(Gest.Den_Gest)

ENDIF

IF CodMag > 0

SELECT Mag

SET ORDER TO TAG Cod_Mag

SET RELATION TO

SEEK CodMag

DenMag=ALLTRIM(Mag.Den_Mag)

ENDIF

IF SursaFin > 0

SELECT Sursa

SET ORDER TO TAG Cod

SET RELATION TO

SEEK SursaFin

DenSursa=ALLTRIM(Sursa.Den)

ENDIF

TotalProdL=.F.

IF TotalProd AND ;

EMPTY(CodProdL) AND ;

Data1=DataIntii AND ;

Data2=DataCalc AND ;

EMPTY(rContDeb) AND ;

EMPTY(rContCred) AND ;

EMPTY(rArtBug) AND ;

EMPTY(SursaFin) AND ;

EMPTY(TipDoc) AND ;

EMPTY(NrDoc) AND ;

EMPTY(DataDoc)

TotalProdL=.T.

SELECT TotalProd

SET ORDER TO TAG ProdMeniu

SET RELATION TO

REPLACE ALL TotalProd.Cod_Gest WITH CodGest, ;

TotalProd.Data_Init WITH DataIntii, ;

TotalProd.Data_Fin WITH DataCalc, ;

TotalProd.Sold_Init WITH 0, ;

TotalProd.Debit WITH 0, ;

TotalProd.Credit WITH 0, ;

TotalProd.Rulaj WITH 0, ;

TotalProd.Sold_Fin WITH 0, ;

TotalProd.Data_Oper WITH DATE(), ;

TotalProd.Ora_Oper WITH TIME() ;

FOR TotalProd.Cod_Meniu=CodMeniuL

ENDIF

IF AnalitSursa > 0 OR AnalitGest > 0

SELECT 0

USE Cont_SAG.DBF EXCL ALIAS ContSAG

USE Cont_SAG.DBF EXCL ALIAS ContSAG

ZAP

INDEX ON Cont+STR(Sursa_Fin,6)+STR(Cod_Gest,3) TO TmpContSAG

ENDIF

=this.NotaDoc(CodProdL)

SELECT NotaCont

SET ORDER TO TAG DocCont

SET RELATION TO

ZAP

SELECT NotaDoc

SET ORDER TO

SCAN FOR BETWEEN(NotaDoc.Data, Data1, Data2)

SELECT NotaDoc

REPLACE NotaDoc.Exit WITH 0

IF CodGest > 0 AND NotaDoc.Cod_Gest <> CodGest

REPLACE NotaDoc.Exit WITH 1

LOOP

ENDIF

IF !EMPTY(TipDoc) AND LEFT(NotaDoc.Tip_Doc, LEN(TipDoc)) <> TipDoc

LOOP

ENDIF

IF !EMPTY(NrDoc) AND (LEFT(NotaDoc.Nr_Doc, LEN(NrDoc)) <> NrDoc OR ;

(!EMPTY(DataDoc) AND NotaDoc.Data <> DataDoc))

LOOP

ENDIF

IF NotaDoc.Debit <> 0 OR ;

(NotaDoc.Debit = 0 AND NotaDoc.Credit = 0)

* IF LEFT(NotaDoc.Cont_Cor, 1) = LEFT(ContCh, 1) AND ;

((NotaDoc.Debit = 0 AND NotaDoc.Credit = 0) OR LEFT(NotaDoc.Cont_Gest,1) <> '0') && Cont de cheltuieli: 410, 480 dar nu pentru active fixe (011/211, 012/212, 02)

IF .F.

ContDeb =NotaDoc.Cont_Cor

ContCred=NotaDoc.Cont_Gest

SemnSuma=-1

ELSE

ContDeb =NotaDoc.Cont_Gest

ContCred=NotaDoc.Cont_Cor

SemnSuma=1

ENDIF

IF ATC(':', ContDeb) > 0

ContDeb0 = PADR(LEFT(ContDeb, ATC(':', ContDeb)-1), 24) && Separa contul de Art.Bug.

ELSE

ContDeb0 = ContDeb

ENDIF

IF ATC(':', ContCred) > 0

ContCred0 = PADR(LEFT(ContCred, ATC(':', ContCred)-1), 24)

ELSE

ContCred0 = ContCred

ENDIF

lNotaDoc=.T.

IF !EMPTY(rContDeb) AND !EMPTY(rContCred) AND ;

rContDeb=rContCred AND LEN(rContDeb)=LEN(rContCred)

IF ContDeb0 <> rContDeb AND ContCred0 <> rContCred

SELECT NotaDoc

REPLACE NotaDoc.Exit WITH 2

lNotaDoc=.F.

ENDIF

ELSE

IF (!EMPTY(rContDeb) AND ContDeb0 <> rContDeb) OR ;

(!EMPTY(rContCred) AND ContCred0 <> rContCred)

SELECT NotaDoc

REPLACE NotaDoc.Exit WITH 3

lNotaDoc=.F.

ENDIF

ENDIF

IF !EMPTY(rArtBug) AND ;

AT(rArtBug, ContDeb) <= 0 AND ;

AT(rArtBug, ContCred) <= 0

SELECT NotaDoc

REPLACE NotaDoc.Exit WITH 4

lNotaDoc=.F.

ENDIF

IF lNotaDoc

SELECT NotaCont

IF !SEEK(DTOS(NotaDoc.Data)+NotaDoc.Tip_Doc+NotaDoc.Nr_Doc+ContDeb+ContCred)

APPEND BLANK

REPLACE NotaCont.Cod_Gest WITH NotaDoc.Cod_Gest, ;

NotaCont.Data WITH NotaDoc.Data, ;

NotaCont.Sursa_Fin WITH NotaDoc.Sursa_Fin, ;

NotaCont.Tip_Doc WITH NotaDoc.Tip_Doc, ;

NotaCont.Nr_Doc WITH NotaDoc.Nr_Doc, ;

NotaCont.Cod_Part WITH NotaDoc.Cod_Part, ;

NotaCont.Cont_Deb WITH ContDeb, ;

NotaCont.Cont_Cred WITH ContCred, ;

NotaCont.Suma WITH SemnSuma*NotaDoc.Debit, ;

NotaCont.Cod_Compl WITH NotaDoc.Cod_Compl, ;

NotaCont.Cod_Statie WITH CodStatie, ;

NotaCont.Cod_Oper WITH CodOper, ;

NotaCont.Data_Oper WITH DATE(), ;

NotaCont.Ora_Oper WITH TIME(), ;

NotaCont.Rec_NotaD WITH RECNO('NotaDoc'), ;

NotaCont.Explic WITH NotaDoc.Explic, ;

NotaCont.Prov WITH ALLTRIM(NotaDoc.Prov)+'a'

* FLUSH

SELECT NotaDoc

REPLACE NotaDoc.Exit WITH 11

ELSE

IF EMPTY(NotaCont.Cod_Part) AND !EMPTY(NotaDoc.Cod_Part)

REPLACE NotaCont.Cod_Part WITH NotaDoc.Cod_Part

ENDIF

ENDIF

ENDIF

ENDIF

SELECT NotaDoc

IF NotaDoc.Credit <> 0

ContDeb =NotaDoc.Cont_Cor

ContCred=NotaDoc.Cont_Gest

IF !EMPTY(rContDeb) AND !EMPTY(rContCred) AND ;

rContDeb=rContCred AND LEN(rContDeb)=LEN(rContCred)

IF ContDeb <> rContDeb AND ContCred <> rContCred

SELECT NotaDoc

REPLACE NotaDoc.Exit WITH 5

LOOP

ENDIF

ELSE

IF (!EMPTY(rContDeb) AND ContDeb <> rContDeb) OR ;

(!EMPTY(rContCred) AND ContCred <> rContCred)

SELECT NotaDoc

REPLACE NotaDoc.Exit WITH 6

LOOP

ENDIF

ENDIF

IF !EMPTY(rArtBug) AND ;

AT(rArtBug, ContDeb) <= 0 AND ;

AT(rArtBug, ContCred) <= 0

SELECT NotaDoc

REPLACE NotaDoc.Exit WITH 7

LOOP

ENDIF

SELECT NotaCont

IF (CodGest > 0 AND !SEEK(DTOS(NotaDoc.Data)+NotaDoc.Tip_Doc+NotaDoc.Nr_Doc+ ;

ContDeb+ContCred+STR(CodGest,3))) OR ;

(CodGest <= 0 AND !SEEK(DTOS(NotaDoc.Data)+NotaDoc.Tip_Doc+NotaDoc.Nr_Doc+ ;

ContDeb+ContCred))

APPEND BLANK

REPLACE NotaCont.Cod_Gest WITH NotaDoc.Cod_Gest, ;

NotaCont.Data WITH NotaDoc.Data, ;

NotaCont.Sursa_Fin WITH NotaDoc.Sursa_Fin, ;

NotaCont.Tip_Doc WITH NotaDoc.Tip_Doc, ;

NotaCont.Nr_Doc WITH NotaDoc.Nr_Doc, ;

NotaCont.Cod_Part WITH NotaDoc.Cod_Part, ;

NotaCont.Cont_Deb WITH ContDeb, ;

NotaCont.Cont_Cred WITH ContCred, ;

NotaCont.Suma WITH NotaDoc.Credit, ;

NotaCont.Cod_Compl WITH NotaDoc.Cod_Compl, ;

NotaCont.Cod_Statie WITH CodStatie, ;

NotaCont.Cod_Oper WITH CodOper, ;

NotaCont.Data_Oper WITH DATE(), ;

NotaCont.Ora_Oper WITH TIME(), ;

NotaCont.Rec_NotaD WITH RECNO('NotaDoc'), ;

NotaCont.Explic WITH NotaDoc.Explic, ;

NotaCont.Prov WITH ALLTRIM(NotaDoc.Prov)+'b'

* FLUSH

SELECT NotaDoc

REPLACE NotaDoc.Exit WITH 12

ENDIF

ENDIF

SELECT NotaDoc

ENDSCAN

SELECT ArtCont

SET ORDER TO TAG TipDocCont

SET RELATION TO

SELECT NotaCont

SET ORDER TO

SET RELATION TO

SCAN FOR NotaCont.Prov <> 'ART_CONT'

SELECT ArtCont

IF SEEK(NotaCont.Tip_Doc+LEFT(NotaCont.Cont_Deb, 4)+LEFT(NotaCont.Cont_Cred,4)) OR ;

SEEK(NotaCont.Tip_Doc+LEFT(NotaCont.Cont_Cred,4)+LEFT(NotaCont.Cont_Deb, 4))

IF !EMPTY(ArtCont.Cont_Deb) AND ;

!EMPTY(ArtCont.Cont_Cred)

SELECT NotaCont

RecNotaCont=RECNO('NotaCont')

SCATTER MEMVAR

APPEND BLANK

GATHER MEMVAR

REPLACE NotaCont.Cont_Deb WITH ArtCont.Cont_Deb, ;

NotaCont.Cont_Cred WITH ArtCont.Cont_Cred, ;

NotaCont.Cod_Statie WITH CodStatie, ;

NotaCont.Cod_Oper WITH CodOper, ;

NotaCont.Data_Oper WITH DATE(), ;

NotaCont.Ora_Oper WITH TIME(), ;

NotaCont.Rec_NotaD WITH 0, ;

NotaCont.Prov WITH 'ART_CONT'

* FLUSH

IF BETWEEN(RecNotaCont, 1, RECCOUNT())

GO RecNotaCont

ENDIF

ENDIF

ENDIF

SELECT NotaCont

ENDSCAN

nl = 0

IF CodProdL=0

=this.CodLista(24,'NotaCont.LST')

SET PRINT TO NotaCont.LST

SET PRINT ON

SET CONSOLE OFF

nl = nl + 5

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

CPIWin=20

IF CPLin <= 160 AND LstDoc

?? InitPRN+LandScape+CPI20

ELSE

?? InitPRN+CPI20

ENDIF

=this.NLTopLand()

?? Offset+m.Institutia

? Offset+LocalitUM,AdresaUM

?

IF CodGest > 0

? Offset+'Gestiunea'+STR(CodGest,3)+'-'+DenGest

ELSE

? Offset+'Toate gestiunile'

ENDIF

IF CodMag > 0

?? ', Magazia '+STR(CodMag,5)+' '+DenMag

ENDIF

DO CASE

CASE SursaFin > 0

? Offset+'Sursa Finantare'+STR(SursaFin,6)+' '+DenSursa

CASE SursaFin < 0

? Offset+'Sursa Finantare 0 (nedefinita)'

OTHERWISE

? Offset+'Toate sursele de finantare'

ENDCASE

IF !EMPTY(rArtBug)

? Offset+'Articol bugetar '+rArtBug

ELSE

? Offset+'Toate articolele bugetare '

ENDIF

?

? ' nlpP, nlpL =', nlpP, nlpL

?

ENDIF

NrDocL ='#'

TipDocL ='#'

DataDocL={ / / }

ContDeb ='#'

ContCred='#'

SumaDoc =0

NrNrDocL=0

STORE .T. TO DoWhile

IF vFoxPro

SET ESCAPE ON

ON ESCAPE STORE .F. TO DoWhile

ENDIF

tSuma=0

*nl = 0 && Este initializat mai sus

np = 0

nr = 0

=this.CapTabNC(CodProdL)

SELECT Prod

SET ORDER TO TAG Cod_Prod

SET RELATION TO

SELECT Doc

SET ORDER TO TAG Rec_Nota

SET RELATION TO Cod_Prod INTO Prod

SELECT NotaCont

SET ORDER TO TAG DocSCont

SET RELATION TO Rec_NotaD INTO Doc

SCAN

SELECT NotaCont

IF !DoWhile

IF NOT vFoxPro OR NoYes('Renuntati la listarea notei contabile ?')

EXIT

ENDIF

DoWhile=.T.

ENDIF

SELECT NotaCont

IF !EMPTY(DataDocL) AND ;

(NotaCont.Data <> DataDocL OR ;

NotaCont.Tip_Doc <> TipDocL OR ;

NotaCont.Nr_Doc <> NrDocL)

IF NrNrDocL > 1

?? this.STRv(SumaDoc,15)

ENDIF

SumaDoc=0

NrNrDocL=0

ENDIF

IF nl >= nlpP - 8 AND CodProdL=0

=this.EjectPag()

nl = 0

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

=this.CapTabNC()

ENDIF

nl = nl + 1

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

IF EMPTY(rContDeb) AND ;

EMPTY(rContCred) AND ;

NotaCont.Nr_Doc = NrDocL AND ;

LEN(ALLTRIM(NotaCont.Nr_Doc))=LEN(ALLTRIM(NrDocL)) AND ;

NotaCont.Cont_Deb =ContDeb AND ;

NotaCont.Cont_Cred=ContCred

? Offset+'?'

ELSE

? Offset+' '

ENDIF

IF (EMPTY(cfgContTransf) OR (NotaCont.Cont_Cred <> cfgContTransf AND NotaCont.Cont_Cred <> cfgContTransfAF)) AND ;

NotaCont.Prov <> 'COMPL' AND ;

NotaCont.Prov <> 'ART_CONT'

nr = nr + 1

?? STR(nr,4)

ELSE

?? SPACE(4)

ENDIF

IF NotaCont.Prov <> 'COMPL' AND ;

NotaCont.Prov <> 'ART_CONT'

?? STR(NotaCont.Cod_Gest,4),DTOC(NotaCont.Data),NotaCont.Tip_Doc,NotaCont.Nr_Doc

ELSE

?? SPACE(4),SPACE(LEN(DTOC(NotaCont.Data))+1+LEN(NotaCont.Tip_Doc)+1+LEN(NotaCont.Nr_Doc))

ENDIF

?? ' '+NotaCont.Cont_Deb,NotaCont.Cont_Cred,this.STRv(NotaCont.Suma,14), ;

ALLTRIM(NotaCont.Cod_Compl),ALLTRIM(NotaCont.Cod_Part)

IF !EMPTY(NotaCont.Explic)

?? ' '+ALLTRIM(NotaCont.Explic)

ENDIF

SELECT Mag

IF SEEK(Doc.Mag_Pred)

?? ' '+ALLTRIM(Mag.Den_Mag)+'-'+ALLTRIM(STR(Doc.Mag_Pred,5))

ENDIF

IF Doc.Mag_Prim <> Doc.Mag_Pred AND SEEK(Doc.Mag_Prim)

?? ' --> '+ALLTRIM(STR(Doc.Mag_Prim,5))+'-'+ALLTRIM(Mag.Den_Mag)

ENDIF

SELECT NotaCont

IF EMPTY(rContDeb) AND ;

EMPTY(rContCred) AND ;

NotaCont.Nr_Doc = NrDocL AND ;

NotaCont.Cont_Deb = ContDeb AND ;

NotaCont.Cont_Cred = ContCred AND ;

NotaCont.Prov <> 'ART_CONT' AND ;

(NotaCont.Tip_Doc <> 'TVA' AND TipDocL <> 'TVA')

IF CheckErori >= 1

?? ' In 1.8 Data sau Tip_Doc diferit pentru acelasi Nr.Doc. Verificati in 1.10 (Nr.Doc='+ALLTRIM(NrDocL)+')'

ENDIF

ENDIF

IF LstDoc AND (EMPTY(cfgContTransf) OR (NotaCont.Cont_Cred <> cfgContTransf AND NotaCont.Cont_Cred <> cfgContTransfAF))

SELECT Doc

MagPredL = Doc.Mag_Pred

MagPrimL = Doc.Mag_Prim

DO WHILE !EOF('Doc') AND NotaCont.Rec_NotaD > 0 AND Doc.Rec_Nota=NotaCont.Rec_NotaD

SELECT Doc

IF CodMag > 0 AND Doc.Mag_Pred <> CodMag AND Doc.Mag_Prim <> CodMag

SKIP

LOOP

ENDIF

nl = nl + 1

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

IF !((AT(ALLTRIM(Doc.Cont_Gest), NotaCont.Cont_Deb) > 0 AND ;

AT(ALLTRIM(Doc.Cont_Cor), NotaCont.Cont_Cred) > 0) OR ;

(AT(ALLTRIM(Doc.Cont_Gest), NotaCont.Cont_Cred) > 0 AND ;

AT(ALLTRIM(Doc.Cont_Cor), NotaCont.Cont_Deb) > 0)) AND ;

(NotaCont.Cont_Deb <> cfgContTransf AND ;

NotaCont.Cont_Deb <> cfgContTransfAF AND ;

NotaCont.Cont_Cred <> cfgContTransf AND ;

NotaCont.Cont_Cred <> cfgContTransfAF)

? Offset+'#C'

ELSE

? Offset+' '

ENDIF

IF Doc.Mag_Pred <> MagPredL OR ;

Doc.Mag_Pred <> MagPredL

?? 'm'

ELSE

?? ' '

ENDIF

?? STR(Doc.Cod_Prod,17),PADR(ALLTRIM(Prod.Den_Prod)+' '+Prod.UM, LEN(Prod.Den_Prod)), ;

STR(Prod.Tip_Prod,1),STR(Doc.Sursa_Fin,7), ;

this.ListDocMag(), ;

this.STR4(Doc.Cant_Intr,14),this.STR4(Doc.Cant_Ies,13), ;

this.STRp(Doc.Pret_Unit,12),this.STRp(Doc.Pret_MPF,14)+ ;

this.STRv(Doc.Debit,13)+this.STRv(Doc.Credit,13), ;

STR(Prod.Cod_Gest,3)

IF NOT EMPTY(Doc.Cod_Compl)

?? ' / '+ALLTRIM(Doc.Cod_Compl)

ENDIF

IF NOT EMPTY(Doc.Nr_Com)

?? ' / '+ALLTRIM(Doc.Nr_Com)

ENDIF

IF NOT EMPTY(Doc.Cod_Part)

?? ' / '+ALLTRIM(Doc.Cod_Part)

ENDIF

IF CodGest > 0 AND Prod.Cod_Gest <> CodGest

nl = nl + 1

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? ' EROARE: Gestiune nomenclator diferita '+STR(Prod.Cod_Gest,3)

ENDIF

IF nl >= nlpP - 8 AND CodProdL=0

=this.EjectPag()

nl = 0

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

=this.CapTabNC()

ENDIF

SKIP

ENDDO

SELECT NotaCont

ENDIF

DataDocL=NotaCont.Data

TipDocL =NotaCont.Tip_Doc

NrDocL =NotaCont.Nr_Doc

ContDeb =NotaCont.Cont_Deb

ContCred=NotaCont.Cont_Cred

IF NotaCont.Prov <> 'COMPL'

tSuma = tSuma + NotaCont.Suma

SumaDoc= SumaDoc + NotaCont.Suma

ENDIF

SumaNotaCont = NotaCont.Suma

NrNrDocL = NrNrDocL + 1

ENDSCAN

IF NrNrDocL > 1

?? ' Tot.Doc='+ALLTRIM(this.STRv(SumaDoc,15))

ENDIF

nl = nl + 3

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? Offset+'------------------------------------------------------------------------------------------------------------'

? Offset+this.STRv(tSuma,107)

?

IF (DAY(Data1)=1 AND MONTH(Data1)=MONTH(Data2)) AND ;

(MONTH(Data2+1) # MONTH(Data2))

=this.NotaAmort()

ENDIF

=this.EjectPag()

IF vFoxPro

ON ESCAPE

SET ESCAPE OFF

ENDIF

SELECT NotaTot

ZAP

SET ORDER TO TAG Cont

IF !DoWhile

DEACTIVATE WINDOW List

=this.Bell()

=this.WaitWindow(' S-a renuntat la Nota contabila ^qj ', 'NOWAIT')

SET CONSOLE ON

IF USED('ContSAG')

SELECT ContSAG

USE

ENDIF

RETURN ''

ENDIF

SELECT NotaCont

SET ORDER TO

SET RELATION TO Cont_Deb+Cont_Cred INTO NotaTot

SCAN

SELECT NotaTot

IF EOF('NotaTot')

APPEND BLANK

REPLACE NotaTot.Cont_Deb WITH NotaCont.Cont_Deb, ;

NotaTot.Cont_Cred WITH NotaCont.Cont_Cred, ;

NotaTot.Cod_Statie WITH CodStatie, ;

NotaTot.Cod_Oper WITH CodOper, ;

NotaTot.Data_Oper WITH DATE(), ;

NotaTot.Ora_Oper WITH TIME()

* FLUSH

ENDIF

REPLACE NotaTot.Suma WITH NotaTot.Suma+NotaCont.Suma

ENDSCAN

SELECT NotaTot

COPY STRUCT TO TmpNotaTot.DBF

SELECT 0

USE TmpNotaTot.DBF EXCL ALIAS TmpNotaTot

INDEX ON LEFT(Cont_Deb,6)+LEFT(Cont_Cred,6) TO TmpNotaTot

SELECT NotaTot

tSuma=0

nl = 5

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

?? InitPRN+CPI20

=this.NLTopLand()

? Offset+SPACE(10)+' 3. CENTRALIZATOR la NOTA DE CONTABILITATE '

IF CodProdL=0

? Offset+SPACE(10)+' pentru perioada',DTOC(Data1)+' - '+DTOC(Data2)

ENDIF

?

? Offset+SPACE(10)+' Cont Deb. Cont Cred. Suma '

? Offset+SPACE(10)+'-------------------------------------------------------------------------'

SCAN

SELECT NotaTot

IF nl >= nlpP - 8

=this.EjectPag()

nl = 4

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

=this.NLTopLand()

? Offset+SPACE(10)+' 3. CENTRALIZATOR la NOTA DE CONTABILITATE * '

IF CodProdL=0

nl = nl + 1

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? Offset+SPACE(10)+' pentru perioada',DTOC(Data1)+' - '+DTOC(Data2)

ENDIF

?

? Offset+SPACE(10)+' Cont Deb. Cont Cred. Suma '

? Offset+SPACE(10)+'-------------------------------------------------------------------------'

ENDIF

tSuma=tSuma+NotaTot.Suma

nl = nl + 1

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? Offset+SPACE(10)+' '+NotaTot.Cont_Deb,NotaTot.Cont_Cred,this.STRs(NotaTot.Suma,22,2)

SELECT TmpNotaTot

ContDeb =ALLTRIM(LEFT(NotaTot.Cont_Deb, 4))

ContCred=ALLTRIM(LEFT(NotaTot.Cont_Cred,4))

IF RIGHT(ALLTRIM(NotaTot.Cont_Deb),3)='.OI'

ContDeb=ContDeb+'.OI'

ELSE

ContDeb=ContDeb+' '

ENDIF

IF RIGHT(ALLTRIM(NotaTot.Cont_Cred),3)='.OI'

ContCred=ContCred+'.OI'

ELSE

ContCred=ContCred+' '

ENDIF

ContDeb =PADR(STRTRAN(ContDeb, '..', '.'), 6)

ContCred=PADR(STRTRAN(ContCred, '..', '.'), 6)

ContDeb =PADR(STRTRAN(ContDeb, ':'), 6)

ContCred=PADR(STRTRAN(ContCred, ':'), 6)

IF RIGHT(ALLTRIM(ContDeb),1)='.'

ContDeb = PADR(LEFT(ALLTRIM(ContDeb), LEN(ALLTRIM(ContDeb))-1), 6)

ENDIF

IF RIGHT(ALLTRIM(ContCred),1)='.'

ContCred = PADR(LEFT(ALLTRIM(ContCred), LEN(ALLTRIM(ContCred))-1), 6)

ENDIF

IF!SEEK(ContDeb+ContCred)

APPEND BLANK

REPLACE TmpNotaTot.Cont_Deb WITH ContDeb, ;

TmpNotaTot.Cont_Cred WITH ContCred

* FLUSH

ENDIF

REPLACE TmpNotaTot.Suma WITH TmpNotaTot.Suma+NotaTot.Suma

ENDSCAN

nl = nl + 3

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? Offset+SPACE(10)+'-------------------------------------------------------------------------'

? Offset+SPACE(10)+this.STRs(tSuma,73,2)

?

IF CodProdL=0

=this.IntocmitV()

nl = nl + 2

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

?

?

ENDIF

IF nl >= nlpP - 10

=this.EjectPag()

nl = 0

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

=this.NLTopLand()

ENDIF

nl = nl + 6

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

?

tSuma=0

? Offset+SPACE(10)+' 4. CENTRALIZATOR SINTETIC la NOTA DE CONTABILITATE'

IF CodProdL=0

? Offset+SPACE(10)+' pentru perioada',DTOC(Data1)+' - '+DTOC(Data2)

ENDIF

?

? Offset+SPACE(10)+' Cont Deb. Cont Cred. Suma '

? Offset+SPACE(10)+'--------------------------------------------------------------------------'

SELECT TmpNotaTot

SCAN

SELECT TmpNotaTot

IF nl >= nlpP - 8

=this.EjectPag()

nl = 4

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

=this.NLTopLand()

? Offset+SPACE(10)+' 4. CENTRALIZATOR SINTETIC la NOTA DE CONTABILITATE'

IF CodProdL=0

nl = nl + 1

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? Offset+SPACE(10)+' pentru perioada',DTOC(Data1)+' - '+DTOC(Data2)

ENDIF

?

? Offset+SPACE(10)+' Cont Deb. Cont Cred. Suma '

? Offset+SPACE(10)+'--------------------------------------------------------------------------'

ENDIF

nl = nl + 1

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? Offset+SPACE(10)+' '+TmpNotaTot.Cont_Deb,TmpNotaTot.Cont_Cred,this.STRs(TmpNotaTot.Suma,22,2)

tSuma=tSuma+TmpNotaTot.Suma

ENDSCAN

SELECT TmpNotaTot

USE

nl = nl + 8

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? Offset+SPACE(10)+'--------------------------------------------------------------------------'

? Offset+SPACE(10)+this.STRs(tSuma,73,2)

?

STORE 0 TO tDebit,tCredit,sDebit,sCredit

?

? Offset+SPACE(10)+' 5. RULAJUL CONTURILOR DE GESTIUNE '

IF CodProdL=0

nl = nl + 1

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? Offset+SPACE(10)+' pentru perioada',DTOC(Data1)+' - '+DTOC(Data2)

ENDIF

?

? Offset+SPACE(10)+' Cont Gest Debit Credit Debit-Credit '

? Offset+SPACE(10)+'------------------------------------------------------------------------'

STORE 0 TO vDebit,vCredit && Viramente interne

STORE 0 TO mDebit,mCredit && Transferuri interne intre LF

ContGestS='####'

SELECT ContGest

SET ORDER TO TAG Cont_Gest

SET RELATION TO

SCAN

IF ContGestS <> '####' AND ContGestS <> LEFT(ContGest.Cont_Gest,4)

nl = nl + 3

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? Offset+SPACE(10)+'--------------- ---------------- ------------------'

? Offset+SPACE(11)+PADR(ContGestS, LEN(ContGest.Cont_Gest)), ;

this.STRs(sDebit,18,2),this.STRs(sCredit,18,2)

IF !EMPTY(cfgContTransf) AND ;

(cfgContTransf =ContGestS OR ;

cfgContTransfAF=ContGestS)

* ?? this.STRs(sDebit-sCredit,19,2)

ELSE

* ?? this.STRs(sDebit-sCredit,19,2)

ENDIF

?

STORE 0 TO sDebit,sCredit

ENDIF

IF nl >= nlpP - 8

=this.EjectPag()

nl = 5

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

=this.NLTopLand()

?

? Offset+SPACE(10)+' 5. RULAJUL CONTURILOR DE GESTIUNE '

IF CodProdL=0

nl = nl + 1

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? Offset+SPACE(10)+' pentru perioada',DTOC(Data1)+' - '+DTOC(Data2)

ENDIF

?

? Offset+SPACE(10)+' Cont Gest Debit Credit Debit-Credit '

? Offset+SPACE(10)+'---------------------------------------------------------- '

ENDIF

nl = nl + 1

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? Offset

IF !EMPTY(cfgContTransf) AND ;

(ContGest.Cont_Gest=cfgContTransf OR ;

ContGest.Cont_Gest=cfgContTransfAF) AND ;

ABS(ContGest.Debit-ContGest.Credit) > ValRot

?? '?'

ELSE

?? ' '

ENDIF

?? SPACE(10)+ContGest.Cont_Gest,this.STRs(ContGest.Debit,18,2),this.STRs(ContGest.Credit,18,2)

IF !EMPTY(cfgContTransf) AND ;

(ContGest.Cont_Gest=cfgContTransf OR ;

ContGest.Cont_Gest=cfgContTransfAF)

* ?? this.STRs(ContGest.Debit-ContGest.Credit,19,2)

vDebit =vDebit +ContGest.Debit

vCredit=vCredit+ContGest.Credit

ELSE

* ?? this.STRs(ContGest.Debit-ContGest.Credit,19,2)

ENDIF

ContGestS=LEFT(ContGest.Cont_Gest, 4)

sDebit =sDebit +ContGest.Debit

sCredit=sCredit+ContGest.Credit

tDebit =tDebit +ContGest.Debit

tCredit=tCredit+ContGest.Credit

mDebit =mDebit +ContGest.Deb_Trans

mCredit=mCredit+ContGest.Cred_Trans

ENDSCAN

nl = nl + 5

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? Offset+SPACE(10)+'--------------- ---------------- ------------------'

? Offset+SPACE(11)+PADR(ContGestS, LEN(ContGest.Cont_Gest)), ;

this.STRs(sDebit,18,2),this.STRs(sCredit,18,2)

IF !EMPTY(cfgContTransf) AND ;

(ContGestS=cfgContTransf OR ;

ContGestS=cfgContTransfAF)

?? this.STRs(sDebit-sCredit,19,2)

ELSE

* ?? this.STRs(sDebit-sCredit,19,2)

ENDIF

? Offset+SPACE(10)+'------------------------------------------------------'

? Offset+SPACE(11)+this.STRs(tDebit,32,2),this.STRs(tCredit,18,2)

*?? this.STRs(tDebit-tCredit,19,2)

?

* 2.3 Nota contabila

IF EMPTY(CodProdL) AND ;

Data1=DataIntii AND ;

Data2=DataCalc AND ;

EMPTY(rContDeb) AND ;

EMPTY(rContCred) AND ;

EMPTY(rArtBug) AND ;

EMPTY(SursaFin) AND ;

EMPTY(TipDoc) AND ;

EMPTY(NrDoc) AND ;

EMPTY(DataDoc)

SELECT Total

LOCATE FOR Cod_Meniu=CodMeniuL

IF FOUND()

REPLACE Total.Cod_Gest WITH CodGest, ;

Total.Data_Init WITH DataIntii, ;

Total.Data_Fin WITH DataCalc, ;

Total.Sold_Init WITH 0, ;

Total.Debit WITH tDebit -mDebit -2*vDebit, ;

Total.Credit WITH tCredit-mCredit-2*vCredit, ;

Total.Rulaj WITH Total.Debit-Total.Credit, ;

Total.Sold_Fin WITH 0, ;

Total.Data_Oper WITH DATE(), ;

Total.Ora_Oper WITH TIME()

ENDIF

ENDIF

if .F.

SELECT Cont

SET ORDER TO TAG Cont

SET RELATION TO

ZAP

SELECT NotaCont

SET RELATION TO

SCAN

SELECT Cont

IF !SEEK(NotaCont.Cont_Deb)

APPEND BLANK

REPLACE Cont.Cont WITH NotaCont.Cont_Deb

* FLUSH

ENDIF

REPLACE Cont.Debit WITH Cont.Debit+NotaCont.Suma

IF !SEEK(NotaCont.Cont_Cred)

APPEND BLANK

REPLACE Cont.Cont WITH NotaCont.Cont_Cred

* FLUSH

ENDIF

REPLACE Cont.Credit WITH Cont.Credit+NotaCont.Suma

SELECT NotaCont

ENDSCAN

STORE 0 TO tDebit,tCredit,tRulaj

nl = nl + 5

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? Offset+SPACE(10)+' Cont Debit Credit Debit-Credit '

? Offset+SPACE(10)+'--------------------------------------------------------------------'

SELECT Cont

SCAN

nl = nl + 1

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? Offset+SPACE(10)+Cont.Cont,this.STRs(Cont.Debit,18,2), ;

this.STRs(Cont.Credit,18,2),this.STRs(Cont.Debit-Cont.Credit,18,2)

tDebit =tDebit +Cont.Debit

tCredit=tCredit+Cont.Credit

tRulaj=tRulaj+(Cont.Debit-Cont.Credit)

ENDSCAN

? Offset+SPACE(10)+'--------------------------------------------------------------------'

? Offset+SPACE(10)+this.STRs(tDebit,29,2),this.STRs(tCredit,18,2),this.STRs(tRulaj,18,2)

?

ENDIF

 

IF CheckNrDoc > 0

SELECT Data, Tip_Doc, Nr_Doc, ;

IIF(ATC(':', Cont_Deb) > 0, LEFT(Cont_Deb, ATC(':', Cont_Deb) -1), Cont_Deb) AS Cont_Deb, ;

IIF(ATC(':', Cont_Cred) > 0, LEFT(Cont_Cred, ATC(':', Cont_Cred)-1), Cont_Cred) AS Cont_Cred, ;

Suma ;

FROM NotaCont ;

INTO TABLE TmpContDoc1.DBF

SELECT CNT(*) AS Nr_Cont, ;

Data, Tip_Doc, Nr_Doc, ;

Cont_Deb, Cont_Cred, ;

SUM(Suma) AS Suma ;

FROM TmpContDoc1.DBF ;

GROUP BY Data, Tip_Doc, Nr_Doc, Cont_Deb, Cont_Cred ;

INTO TABLE TmpContDoc.DBF

nl = nl + 5

?

? Offset+SPACE(10)+' 6. CENTRALIZATOR NR.DOC cu mai mult de doua documente '

?

? Offset+SPACE(10)+' Data Tip_Doc Nr_Doc Cont_Deb Cont_Cred Suma Nr_Inreg '

? Offset+SPACE(10)+'-----------------------------------------------------------------------------------'

Data0 = { / / }

TipDoc = '####'

NrDoc = '####'

SELECT TmpContDoc

SCAN && FOR Nr_Cont > 1

IF Data <> Data0 OR ;

Tip_Doc <> TipDoc OR ;

Nr_Doc <> NrDoc

nl = nl + 2

?

? Offset+SPACE(10), Data, Tip_Doc, Nr_Doc, PADR(Cont_Deb, 15), PADR(Cont_Cred, 15), this.STRs(Suma,16,2), STR(Nr_Cont,8)

Data0 = Data

TipDoc = Tip_Doc

NrDoc = Nr_Doc

ELSE

? Offset+SPACE(10), SPACE(32), PADR(Cont_Deb, 15), PADR(Cont_Cred, 15), this.STRs(Suma,16,2), STR(Nr_Cont,8)

ENDIF

ENDSCAN

nl = nl + 2

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? Offset+SPACE(10)+'-----------------------------------------------------------------------------------'

?

ENDIF

nl = nl + 1

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

?

SELECT NotaDoc

LOCATE FOR ATC('? +'+ContAmAFNec+'/'+ContAmAFCorp, NotaDoc.Explic) > 0

IF FOUND()

nl = nl + 4

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

?

? ' ATENTIE! Sunt active fixe care au in 1.6 Amort_Ram si '

? ' Cont_Cor nu contine '+ContAmAFCorp+'/'+ContAmAFNec+' in 1.8, in lista apare ? +'+ContAmAFNec+'/'+ContAmAFCorp+' '

? ' Verificati in 1.2 daca sunt setate corect: Cont_Ch_Am, Cont_Ram_A '

?

=this.Bell()

=this.WaitWindow(' ATENTIE! Sunt active fixe care au in 1.6 Amort_Ram si '+CHR(13)+ ;

' Cont_Cor nu contine '+ContAmAFCorp+'/'+ContAmAFNec+' in 1.8, in lista apare ? +'+ContAmAFNec+'/'+ContAmAFCorp+' '+CHR(13)+ ;

' CTRL+F ? (cauta in lista ?) '+CHR(13)+CHR(13)+ ;

' Setati corect in 1.2 Cont_Ram_A si Sursa_Fin in 1.8 '+CHR(13)+CHR(13)+ ;

' Apasati orice tasta ^f8 ', '')

ENDIF

IF CodProdL=0

if .F.

nl = nl + 7

=this.ScrieNL(PROGRAM()+'/'+ALLTRIM(STR(LINENO(),10)))

? Offset+'NOTA: 1. Erori de tip Y dau diferente intre Centralizator 2.5 si Nota contabila 2.3 '

? Offset+' 2. In Centralizatorul 2.5 nu apar documentele care au UM=NC (Nomenclatorul 1.5), '

? Offset+' acestea apar in Nota contabila 2.3 (fara sa se precizeze: cont, sursa etc.)'

? Offset+' 3. Contul corespondent MODIF da aceeasi diferenta pe Debit si Credit '

? Offset+' intre Centralizatorul 2.5 si Nota contabila 2.3 '

?

endif

=this.IntocmitV()

=this.EndLista(Offset)

SET PRINT OFF

SET PRINT TO

SET CONSOLE ON

SET STATUS BAR OFF

SELECT NotaCont

SET RELATION TO

IF Data1=DataIntii AND ;

Data2=DataCalc AND ;

EMPTY(CodGest) AND ;

EMPTY(rContDeb) AND ;

EMPTY(rContCred) AND ;

EMPTY(SursaFin) AND ;

EMPTY(rArtBug) AND ;

EMPTY(TipDoc) AND ;

EMPTY(NrDoc) AND ;

EMPTY(DataDoc)

SELECT Erori

SET ORDER TO TAG Cod

SET RELATION TO

SEEK 'Y'

REPLACE Erori.Nr_Erori WITH 0, ;

Erori.Fisier_DBF WITH '', ;

Erori.Exemplu WITH '', ;

Erori.Cod_Prod WITH 0

SELECT Prod

SET ORDER TO TAG Cod_Prod

SET RELATION TO

SELECT Doc

SET ORDER TO

SET RELATION TO Cod_Prod INTO Prod

SCAN

SELECT Doc

REPLACE Doc.Erori WITH STRTRAN(Doc.Erori, 'Y')

IF BETWEEN(Doc.Data, Data1, Data2) AND ;

(ABS(Doc.Debit_NC - Doc.Debit_B) > 0.01 OR ;

ABS(Doc.Credit_NC - Doc.Credit_B) > 0.01)

SELECT Erori

SEEK 'Y'

IF Erori.Activ AND ;

AT('Y', Prod.Erori_Adm) <= 0

SELECT Doc

IF AT('Y', Doc.Erori) <= 0

SELECT Erori

REPLACE Erori.Nr_Erori WITH Erori.Nr_Erori+1

=this.EroriDBF('DOC')

SELECT Doc

REPLACE Doc.Erori WITH ALLTRIM(Doc.Erori)+'Y'

ENDIF

=this.ExErDoc()

ENDIF

ENDIF

SELECT Doc

ENDSCAN

ENDIF

SELECT Erori

SET ORDER TO TAG Cod

SEEK 'Y'

=this.Bell()

IF NOT vFoxPro

WinExec('WRITE.EXE NotaCont.LST', 1)

ELSE

=this.WaitWindow(ALLTRIM(PROMPT())+': NotaCont.LST ^qk '+ ;

IIF(Erori.Nr_Erori > 0, CHR(13)+CHR(13)+ ;

' ATENTIE! Au aparut '+ALLTRIM(STR(Erori.Nr_Erori,10))+' AVERTIZARI de tip Y ', '')+CHR(13)+ ;

' In 3.5 NotaCont.XLS si NotaContDoc.XLS ', 'NOWAIT')

MODIF FILE NotaCont.LST NOEDIT WINDOW ListTot

=this.WaitWindow(' F2 - PRINT SETUP'+CHR(13)+ ;

' F3 - Font'+CHR(13)+ ;

' F4 - Import WordPad ^ql ', 'NOWAIT')

ON KEY LABEL F2 SYS(1037)

ON KEY LABEL F4 WinExec('WRITE.EXE NotaCont.LST', 1)

IF NOT vFoxPro OR NoYes('Listati la imprimanta ?'+CHR(13)+ ;

'NotaCont.LST')

=this.OutPRN('NotaCont.LST',PortPRN)

ENDIF

ON KEY LABEL F2

ON KEY LABEL F4

ENDIF

ENDIF

*DEACTIVATE WINDOW List

IF USED('ContSAG')

SELECT ContSAG

USE

ENDIF

IF NoteContDat > 0

SET PRINT TO NoteCont.DAT

SET PRINT ON

SET CONSOLE OFF

SELECT NotaCont

SCAN

?? '70'

?? '001'+RIGHT('00'+ALLTRIM(STR(RECNO(),8)),3)

IF LEN(ALLTRIM(Tip_Doc)+ALLTRIM(Nr_Doc)) <= 6

?? PADR(ALLTRIM(Tip_Doc)+ALLTRIM(Nr_Doc),6)

ELSE

?? PADR(ALLTRIM(Nr_Doc),6)

ENDIF

?? STRTRAN(this.DTOC8(Data), '/')

?? PADR(Cont_Deb,24)+PADR(Cont_Cred,24)

?? IIF(Suma >= 0, '+', '-')

?? LEFT(STRTRAN(STR(Suma,16,2), '.'), 15)

?? '998'

?? STRTRAN(this.DTOC8(Data2), '/')

?

ENDSCAN

? '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'

? ' 1 2 3 4 5 6 7 8 9 '

SET PRINT OFF

SET PRINT TO

SET CONSOLE ON

=this.WaitWindow(' S-a creat fisierul NoteCont.DAT ', 'NOWAIT')

IF !USED('cfg')

SELECT 0

USE Config ALIAS cfg

ENDIF

=this.Bell()

SELECT cfg

IF EMPTY(cfg.Calea_NC)

=this.WaitWindow(' Salvare fisier NoteCont.DAT pe discheta '+CHR(13)+ ;

' Introduceti discheta si apasati '+CHR(13)+ ;

' <ENTER> sau <ESC> - pentru renuntare ', '')

IF LASTKEY() <> 27

ERASE A:\NoteCont.DAT

COPY FILE NoteCont.DAT TO A:\

SELECT cfg

REPLACE cfg.Data_NC WITH DATE()

ENDIF

ELSE

FisierNC=ALLTRIM(cfg.Calea_NC)+'\NoteCont.DAT'

COPY FILE NoteCont.DAT TO &FisierNC

SELECT cfg

REPLACE cfg.Data_NC WITH DATE()

=this.WaitWindow(' Fisierul NoteCont.DAT a fost copiat in '+ALLTRIM(cfg.Calea_NC), 'NOWAIT')

ENDIF

ENDIF

SELECT NotaCont

SET ORDER TO TAG DocSCont

SET RELATION TO

COPY TO NotaCont.XLS XLS

IF LstDoc

SELECT Prod

SET ORDER TO TAG Cod_Prod

SET RELATION TO

SELECT Doc

SET ORDER TO TAG ProdDFCC

SET RELATION TO Cod_Prod INTO Prod

REPLACE ALL Data_Char WITH DTOC(Data)

COPY TO NotaContDoc.XLS XLS ;

FIELDS Prod.Cod_Gest, Cod_Prod, Prod.Den_Prod, Prod.Tip_Prod, Prod.Cod_CPV, Prod.Clas_AF, ;

Mag_Pred, Mag_Prim, Sursa_Fin, Cont_Gest, Cont_Cor, Art_Bug, ;

Tip_Doc, Nr_Doc, Data_Char, Cant_Intr, Cant_Ies, Pret_Unit, Pret_MPF, Debit, Credit, ;

Cod_Compl, Nr_Com, Cod_Part ;

FOR Rec_Nota > 0

ENDIF

IF vFoxPro

DEACTIVATE WINDOW List

ENDIF

RETURN ''

ENDPROC

...

ENDDEFINE

 

 8/28/2007 11:31:41 PM
User is offlinealex_pascanu
80 posts


Re: Interfata C# pentru VFP
 (N/A)

Buna ziua.

Cred ca solutia cea mai buna de face sa comunice aplicatia fox cu cea dot net este folosind comuri,asta in cazul in care codul fox este win32 adik e aplicatie visual fox.

Este posibil ca assembly-urile dot net sa expuna interfete aplicatiilor managed biblioteci tlb pt descriere de tipuri.

M-ar interesa chestia asta avand in vedere ca nu am mai lucrat in fox de ceva timp.

 

  Visual FoxPro  .NET Interop  Interfata C# pe...

Search  Forum Home         

 Google Ads Minimize

    

Copyright 2002-2010 Profox   Terms Of Use  Privacy Statement