*--------------------------------------------------------------------------------------------------------------------------------------------------------
* (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!!
*--------------------------------------------------------------------------------------------------------------------------------------------------------
*< FOXBIN2PRG: Version="1.21" SourceFile="furnizori3.mnx" CPID="1252" /> (Solo para binarios VFP 9 / Only for VFP 9 binaries)
*
*<MenuType>4</MenuType>
*<MenuLocation>REPLACE</MenuLocation>

*<MenuCode>
DEFINE POPUP Furnizori SHORTCUT RELATIVE FROM MROW(),MCOL()
DEFINE BAR 1 OF Furnizori PROMPT "Regularizare fact. nesosite" ;
	MESSAGE '408:401;4426:4428'
ON SELECTION BAR 1 OF Furnizori DO BAR_1_OF_Furnizori_FB2P

DEFINE BAR 2 OF Furnizori PROMPT "Regularizare fact. nesosite de imobilizari" ;
	MESSAGE '408:404;4426:4428'
ON SELECTION BAR 2 OF Furnizori DO BAR_2_OF_Furnizori_FB2P

DEFINE BAR 3 OF Furnizori PROMPT "Regularizare furnizori debitori" ;
	MESSAGE '401 : 409'
ON SELECTION BAR 3 OF Furnizori DO BAR_3_OF_Furnizori_FB2P

DEFINE BAR 4 OF Furnizori PROMPT "Regularizare avans furnizori imobilizari"
ON BAR 4 OF Furnizori ACTIVATE POPUP Regulariza

	*----------------------------------
	DEFINE POPUP Regulariza SHORTCUT RELATIVE
	DEFINE BAR 1 OF Regulariza PROMPT "Corporale" ;
		MESSAGE '404 : 232'
	ON SELECTION BAR 1 OF Regulariza lans(10562)

	DEFINE BAR 2 OF Regulariza PROMPT "Necorporale" ;
		MESSAGE '404 : 234'
	ON SELECTION BAR 2 OF Regulariza lans(10563)

DEFINE BAR 5 OF Furnizori PROMPT "\-"
ON BAR 5 OF Furnizori ACTIVATE POPUP NewItem

	*----------------------------------
	DEFINE POPUP NewItem SHORTCUT RELATIVE
DEFINE BAR 6 OF Furnizori PROMPT "Regularizare furnizori externi debitori" ;
	MESSAGE '401 : 409'
ON SELECTION BAR 6 OF Furnizori DO BAR_6_OF_Furnizori_FB2P

DEFINE BAR 7 OF Furnizori PROMPT "Regularizare avans furnizori externi imobilizari"
ON SELECTION BAR 7 OF Furnizori DO BAR_7_OF_Furnizori_FB2P

DEFINE BAR 8 OF Furnizori PROMPT "\-"
ON BAR 8 OF Furnizori ACTIVATE POPUP _13w0x2gl2

	*----------------------------------
	DEFINE POPUP _13w0x2gl2 SHORTCUT RELATIVE
DEFINE BAR 9 OF Furnizori PROMPT "Compensari furnizor-client"
ON BAR 9 OF Furnizori ACTIVATE POPUP _15t10svwr

	*----------------------------------
	DEFINE POPUP _15t10svwr SHORTCUT RELATIVE
	DEFINE BAR 1 OF _15t10svwr PROMPT "Compensare furnizor - client" ;
		MESSAGE '401-4111'
	ON SELECTION BAR 1 OF _15t10svwr lans(10489)

	DEFINE BAR 2 OF _15t10svwr PROMPT "Compensare furnizor404 - client" ;
		MESSAGE '404-4111'
	ON SELECTION BAR 2 OF _15t10svwr lans(10543)

	DEFINE BAR 3 OF _15t10svwr PROMPT "\-"
	ON BAR 3 OF _15t10svwr ACTIVATE POPUP _15t10uhfs

		*----------------------------------
		DEFINE POPUP _15t10uhfs SHORTCUT RELATIVE
	DEFINE BAR 4 OF _15t10svwr PROMPT "Compensare valuta furnizor - client" ;
		MESSAGE '401-4111'
	ON SELECTION BAR 4 OF _15t10svwr lans(10490)

DEFINE BAR 10 OF Furnizori PROMPT "Compensare facturi furnizor - lei" ;
	MESSAGE '401 : 5121'
ON SELECTION BAR 10 OF Furnizori lans(10614)

DEFINE BAR 11 OF Furnizori PROMPT "Compensare facturi furnizor - valuta" ;
	MESSAGE '401,404,462 : 5124'
ON SELECTION BAR 11 OF Furnizori DO BAR_11_OF_Furnizori_FB2P

DEFINE BAR 12 OF Furnizori PROMPT "\-"
ON BAR 12 OF Furnizori ACTIVATE POPUP _7ey0oap0x

	*----------------------------------
	DEFINE POPUP _7ey0oap0x SHORTCUT RELATIVE
DEFINE BAR 13 OF Furnizori PROMPT "Compensare avansuri furnizor - lei" ;
	MESSAGE '409x : 5121'
ON SELECTION BAR 13 OF Furnizori DO BAR_13_OF_Furnizori_FB2P

DEFINE BAR 14 OF Furnizori PROMPT "Compensare avansuri furnizor - valuta" ;
	MESSAGE '409 : 5124'
ON SELECTION BAR 14 OF Furnizori DO BAR_14_OF_Furnizori_FB2P
ACTIVATE POPUP Furnizori

*</MenuCode>

*<Procedures>
PROCEDURE BAR_1_OF_Furnizori_FB2P
	lans(10406)
	
	IF gnButon = 2
		IF USED('actactan')
			USE IN actactan
		ENDIF 
		RETURN
	ENDIF 
	SET STEP ON 
	SELECT actactan
	GO BOTTOM 
	SCATTER FIELDS EXCEPT id_factd, id_factc,pereched,perechec, id_partd, id_partc, partd, partc,id_jtva_coloana,proc_tva,taxcode,taxname NAME otemp
	
	SELECT DISTINCT a.id_jtva_coloana,(b.cota_tva+100)/100 as proc_Tva,b.id_tva,a.taxcode,a.taxname FROM actactan a JOIN jtva_coloane b ON a.id_jtva_coloana = b.id_jtva_coloana WHERE b.cota_tva <> 0 AND ALLTRIM(a.scd) = '408' INTO CURSOR procent
	
	IF _tally#0
		SELECT procent
		SCAN
			SCATTER NAME oproc
			SELECT actactan
			SUM suma TO lnsuma FOR id_jtva_coloana=oproc.id_jtva_coloana AND ALLTRIM(scd)='408'
			SELECT actactan
			APPEND BLANK 
			GATHER NAME otemp
			replace proc_tva WITH oproc.proc_tva,id_jtva_coloana WITH oproc.id_tva, taxcode WITH oproc.taxcode, taxname WITH oproc.taxname
	*!*			REPLACE scd WITH '4426',scc WITH '4428',proc_tva WITH oproc.proc_tva,id_jtva_coloana WITH oproc.id_tva
			REPLACE scd WITH iif(inlist(id_jtva_coloana, 171, 173, 175, 179, 189, 211, 215), '4428', '4426'),scc WITH '4428'
			REPLACE suma WITH ROUND(LnSuma*(oproc.proc_tva-1)/oproc.proc_tva,gnPc) 
	
			SELECT procent
		ENDSCAN 
	ENDIF 
	
	SELECT actactan 
	GO TOP 
	DO FORM verificare
	
	IF gnButon=1
		oscrie_in_fisiere()
	ENDIF 
	
	IF USED('actactan')
		USE IN actactan
	ENDIF 
	IF USED('procent')
		USE IN procent
	ENDIF 
	
	
	
ENDPROC && BAR_1_OF_Furnizori_FB2P

PROCEDURE BAR_2_OF_Furnizori_FB2P
	lans(10407)
	
	
	IF gnButon = 2
		IF USED('actactan')
			USE IN actactan
		ENDIF 
		RETURN
	ENDIF 
	
	SELECT actactan
	GO BOTTOM 
	SCATTER FIELDS EXCEPT id_factd, id_factc,pereched,perechec, id_partd, id_partc, partd, partc,id_jtva_coloana, proc_tva,taxcode,taxname NAME otemp
	
	SELECT DISTINCT a.id_jtva_coloana,(b.cota_tva+100)/100 as proc_tva,b.id_tva,a.taxcode,a.taxname FROM actactan a JOIN jtva_coloane b ON a.id_jtva_coloana = b.id_jtva_coloana WHERE b.cota_tva <> 0 AND ALLTRIM(a.scd) = '408' INTO CURSOR procent
	
	IF _tally#0
		SELECT procent
		SCAN
			SCATTER NAME oproc
			SELECT actactan
			SUM suma TO lnsuma FOR id_jtva_coloana=oproc.id_jtva_coloana AND ALLTRIM(scd)='408'
			SELECT actactan
			APPEND BLANK 
			GATHER NAME otemp
			REPLACE scd WITH '4426',scc WITH '4428',id_jtva_coloana WITH oproc.id_tva,proc_tva WITH oproc.proc_tva, taxcode WITH oproc.taxcode, taxname WITH oproc.taxname
			REPLACE suma WITH ROUND(LnSuma*(oproc.proc_tva-1)/oproc.proc_tva,gnPc) 
	
			SELECT procent
		ENDSCAN 
	ENDIF 
	
	SELECT actactan 
	GO TOP 
	DO FORM verificare
	
	IF gnButon=1
		oscrie_in_fisiere()
	ENDIF 
	
	IF USED('actactan')
		USE IN actactan
	ENDIF 
	IF USED('procent')
		USE IN procent
	ENDIF 
ENDPROC && BAR_2_OF_Furnizori_FB2P

PROCEDURE BAR_3_OF_Furnizori_FB2P
	PRIVATE pcACN, CN
	loCont = ret_cont("Selectati contul",'409')  && ,4091,4092')
	IF TYPE('loCont') # 'O'
		RETURN
	ENDIF 
	IF buton = 2
		RELEASE loCont
		RETURN 
	ENDIF 
	
	CN = locont.cont
	PcACN = loCont.Acont
	LANS(10487)
ENDPROC && BAR_3_OF_Furnizori_FB2P

PROCEDURE BAR_6_OF_Furnizori_FB2P
	PRIVATE pcACN, CN
	loCont = ret_cont("Selectati contul creditor",'409') &&,4091,4092')
	IF TYPE('loCont') # 'O'
		RETURN
	ENDIF 
	IF buton = 2
		RELEASE loCont
		RETURN 
	ENDIF 
	
	CN = locont.cont
	PcACN = loCont.Acont
	lans(10495)
ENDPROC && BAR_6_OF_Furnizori_FB2P

PROCEDURE BAR_7_OF_Furnizori_FB2P
	PRIVATE pcACN, CN
	loCont = ret_cont("Selectati contul creditor",'23,409') && 232,234 - corporale/necorporale
	IF TYPE('loCont') # 'O'
		RETURN
	ENDIF 
	IF buton = 2
		RELEASE loCont
		RETURN 
	ENDIF 
	
	
	
	CN = locont.cont
	PcACN = loCont.Acont
	lans(10597)
ENDPROC && BAR_7_OF_Furnizori_FB2P

PROCEDURE BAR_11_OF_Furnizori_FB2P
	LOCAL loCont
	loCont = ret_cont("Contul debitor", "401,404,462")
	If buton = 2
		Release loCont
		Return
	Endif
	
	
	lans_generic(10658,loCont.Cont, loCont.Acont)
ENDPROC && BAR_11_OF_Furnizori_FB2P

PROCEDURE BAR_13_OF_Furnizori_FB2P
	Local lcCont, lcAcont, loCont
	loCont=ret_cont("Selectati contul",'409')  && 409,4091, 4092
	If Type('loCont') # 'O'
		Return
	Endif
	If buton=2
		Release loCont
		Return
	Endif
	lcCont = Alltrim(loCont.Cont)
	lcAcont = loCont.Acont
	Do Case
		Case lcCont = '409'
			lans(10622)
		Case lcCont = '4091'
			lans(10623)
		Case lcCont = '4092'
			lans(10624)
	Endcase
	
ENDPROC && BAR_13_OF_Furnizori_FB2P

PROCEDURE BAR_14_OF_Furnizori_FB2P
	LOCAL loCont
	loCont = ret_cont("Contul creditor", "409")
	If buton = 2
		Release loCont
		Return
	Endif
	
	
	lans_generic(10657,loCont.Cont, loCont.Acont)
ENDPROC && BAR_14_OF_Furnizori_FB2P

*</Procedures>
