*--------------------------------------------------------------------------------------------------------------------------------------------------------
* (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!!
*--------------------------------------------------------------------------------------------------------------------------------------------------------
*< FOXBIN2PRG: Version="1.21" SourceFile="bon_fisc.vcx" CPID="1252" /> (Solo para binarios VFP 9 / Only for VFP 9 binaries)
*
*
DEFINE CLASS bon_fisc AS checkbox 
 	*< CLASSDATA: Baseclass="checkbox" Timestamp="" Scale="Pixels" Uniqueid="" />

	*<PropValue>
		Alignment = 0
		Caption = "Check1"
		Height = 17
		Name = "bon_fisc"
		Width = 60
	*</PropValue>

ENDDEFINE

DEFINE CLASS frm_tichete AS frm_termin_renunt OF "_frm_child.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Clb_bon" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_nr" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_numerar" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_valoare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_total" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_linie1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_linie2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_discount" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_procent" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_procent._lbbase2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_diminuat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cbo_tva_vanzare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Label4" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: verificare
		*p: bon
		*p: diminuat
		*p: discount
		*p: nr
		*p: numerar
		*p: procent
		*p: total
		*p: tva
		*p: valoare
	*</DefinedPropArrayMethod>

	*<PropValue>
		bon = 0
		diminuat = 0
		discount = 0
		DoCreate = .T.
		Height = 231
		Name = "frm_tichete"
		nr = 0
		numerar = 0
		procent = 0
		total = 0
		tva = 0.00
		valoare = 0
		Width = 571
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 576
		_shape1.ZOrderSet = 1
		_shape2.Height = 29
		_shape2.Left = 511
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 63
		_shape2.ZOrderSet = 2
		Lb_titlu_alb_b121.Caption = "Bon"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 10
		Lb_titlu_alb_b121.ZOrderSet = 3
		BUT_TERMIN1.Left = 542
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 5
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 4
		Gridsort1.Left = 12
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 36
		But_renunt1.Left = 513
		But_renunt1.Name = "But_renunt1"
		But_renunt1.TabIndex = 6
		But_renunt1.Top = 1
		But_renunt1.ZOrderSet = 6
	*</PropValue>

	ADD OBJECT '_linie1' AS _linie WITH ;
		Height = 0, ;
		Left = 345, ;
		Name = "_linie1", ;
		Top = 170, ;
		Width = 10, ;
		ZOrderSet = 13
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="line" />

	ADD OBJECT '_linie2' AS _linie WITH ;
		Height = 0, ;
		Left = 345, ;
		Name = "_linie2", ;
		Top = 176, ;
		Width = 10, ;
		ZOrderSet = 14
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="line" />

	ADD OBJECT 'cbo_tva_vanzare' AS combobox WITH ;
		BorderColor = 128,128,128, ;
		BorderStyle = 1, ;
		ColumnCount = 3, ;
		ColumnLines = .F., ;
		ColumnWidths = "200,10,0", ;
		Comment = "A", ;
		ControlSource = "", ;
		FontName = "Arial Narrow", ;
		Height = 20, ;
		InputMask = "", ;
		Left = 419, ;
		Name = "cbo_tva_vanzare", ;
		RowSource = "jtva_vanzare.denumire,cota_tva,id_jtva_coloana", ;
		RowSourceType = 6, ;
		SpecialEffect = 1, ;
		Style = 2, ;
		TabIndex = 14, ;
		TabStop = .F., ;
		Top = 88, ;
		Visible = .T., ;
		Width = 149
		*< END OBJECT: BaseClass="combobox" />

	ADD OBJECT 'Clb_bon' AS clb_tx_simplu WITH ;
		Left = 228, ;
		Name = "Clb_bon", ;
		TabIndex = 11, ;
		Top = 36, ;
		ZOrderSet = 7, ;
		Text_simplu1.ControlSource = "thisform.bon", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = "999 999 999.99", ;
		Text_simplu1.Left = 136, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 148, ;
		Lb_simplu1.Caption = "Valoare Bon", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_diminuat' AS clb_tx_simplu WITH ;
		Left = 228, ;
		Name = "Clb_diminuat", ;
		TabIndex = 8, ;
		Top = 120, ;
		ZOrderSet = 19, ;
		Text_simplu1.ControlSource = "thisform.diminuat", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = "999 999 999.99", ;
		Text_simplu1.Left = 135, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 149, ;
		Lb_simplu1.Caption = "Total", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_discount' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 168, ;
		Name = "Clb_discount", ;
		TabIndex = 2, ;
		Top = 80, ;
		Width = 246, ;
		ZOrderSet = 15, ;
		Text_simplu1.ControlSource = "thisform.discount", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = "999 999 999.99", ;
		Text_simplu1.Left = 91, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .F., ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 149, ;
		Lb_simplu1.Caption = "Valoare", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_nr' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 12, ;
		Name = "Clb_nr", ;
		TabIndex = 3, ;
		Top = 160, ;
		Width = 152, ;
		ZOrderSet = 8, ;
		Text_simplu1.ControlSource = "thisform.nr", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 113, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 35, ;
		Lb_simplu1.Caption = "Tichete de masa", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_numerar' AS clb_tx_simplu WITH ;
		Left = 228, ;
		Name = "Clb_numerar", ;
		TabIndex = 9, ;
		Top = 196, ;
		ZOrderSet = 9, ;
		Text_simplu1.ControlSource = "thisform.numerar", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = "999 999 999.99", ;
		Text_simplu1.Left = 135, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 149, ;
		Lb_simplu1.Caption = "Numerar", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_procent' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 12, ;
		Name = "Clb_procent", ;
		TabIndex = 1, ;
		Top = 80, ;
		Width = 144, ;
		ZOrderSet = 16, ;
		Text_simplu1.ControlSource = "thisform.procent", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = "99.99", ;
		Text_simplu1.Left = 76, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .F., ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 44, ;
		Lb_simplu1.Caption = "Discount", ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_procent._lbbase2' AS _lbbase WITH ;
		Caption = "%", ;
		Left = 126, ;
		Name = "_lbbase2", ;
		Top = 6
		*< END OBJECT: ClassLib="_lb_base.vcx" BaseClass="label" />

	ADD OBJECT 'Clb_total' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 361, ;
		Name = "Clb_total", ;
		TabIndex = 7, ;
		Top = 160, ;
		Width = 158, ;
		ZOrderSet = 12, ;
		Text_simplu1.ControlSource = "thisform.total", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 5, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 146, ;
		Lb_simplu1.Caption = "(total)", ;
		Lb_simplu1.Left = 114, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6, ;
		Lb_simplu1.Visible = .F.
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_valoare' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 181, ;
		Name = "Clb_valoare", ;
		TabIndex = 4, ;
		Top = 160, ;
		Width = 158, ;
		ZOrderSet = 10, ;
		Text_simplu1.ControlSource = "thisform.valoare", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = "999 999 999.99", ;
		Text_simplu1.Left = 8, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 85, ;
		Lb_simplu1.Caption = "(valoare)", ;
		Lb_simplu1.Left = 105, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Label4' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Explicatie TVA", ;
		FontName = "Comic Sans MS", ;
		Height = 19, ;
		Left = 450, ;
		Name = "Label4", ;
		TabIndex = 13, ;
		Top = 69, ;
		Visible = .T., ;
		Width = 87, ;
		ZOrderSet = 18
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Lb_simplu1' AS lb_simplu WITH ;
		Caption = "X", ;
		Left = 170, ;
		Name = "Lb_simplu1", ;
		TabIndex = 12, ;
		Top = 166, ;
		ZOrderSet = 11
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />
	
	PROCEDURE Activate
		*
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Thisform.verificare('0')
		Local lcStringTichet,lcStringDisc
		Store '' To lcStringTichet,lcStringDisc
		pcStringImprim = ''
		pcStringImprim = [2;] + [NUMERAR;0;] + Alltrim(Str(Thisform.numerar,9,3)) + [;] + CRLF
		
		*!*	THISFORM.tva=VAL(THISFORM.cotaTVA.VALUE)
		If Thisform.nr>0 And Thisform.valoare>0
			If Thisform.discount>0
				lcProc = Alltrim(Str(Thisform.procent,5,2))
			Else
				lcProc = 0.00
			Endif
			lcStringmp500= [T,1,______,_,__;0;]+ Alltrim(Str(Thisform.numerar*100,8,3))+[;;;;]+CRLF+;
				[T,1,______,_,__;3;]+ Alltrim(Str(Thisform.Total*100,8,3))+[;;;;]+CRLF+;
				IIF(Thisform.discount > 0,[T,1,______,_,__;4;] + CRLF + [C,1,______,_,__;1;]+lcProc+[;;;;] + CRLF,'')+;
				[F,1,______,_,__;]+CRLF
		
		
		
			lcStringTichet = [2;] + [TICHET;0;] + Alltrim(Str(Thisform.Total,9,3)) +  [;] + CRLF
			Select actactan
			Locate For Alltrim(scd)='5311'
			If Found()
				Scatter Name lmp500
				Replace suma With Thisform.numerar
				Append Blank
				Gather Name lmp500
				Replace suma With Min(Thisform.Total,Thisform.bon),scd With '5323'
				Select actactan
				Go Top
			Endif
		Else
			lcStringmp500=[T,1,______,_,__;]+CRLF+[F,1,______,_,__;]+CRLF
		Endif
		
		If Thisform.discount>0
			lcStringDisc = [2;] + [DISCOUNT;0;] + Alltrim(Str(Thisform.procent,2)) + [;] + CRLF
			lctvad = (-1)*Round(Thisform.tva*Thisform.discount/(Thisform.tva+100),gnPc)
			lcbazad = Thisform.discount+lctvad
			Select actactan
			Locate For Alltrim(scd)='4111'
			If Found()
				Scatter Name lmp500
				Append Blank
				Gather Name lmp500
				Replace scd With '667',ascd With '',scc With '4111',ascc With '5',suma With lcbazad,id_partc With id_partd,partc With partd,partd With '',id_partd With 0
				Select jtva_coloane
				Locate For id_jtva_coloana = lmp500.id_jtva_coloana
				If Found()
					lnIdTva = id_tva
					Select actactan
					Append Blank
					Gather Name lmp500
					Replace scc With '4427',ascc With '',suma With lctvad,id_jtva_coloana With lnIdTva
				Endif
				Select actactan
				Go Top
			Endif
		Endif
		
		pcStringImprim = pcStringImprim + lcStringTichet + lcStringDisc
		
		Return .T.
		
		
	ENDPROC

	PROCEDURE Init
		Parameters tnsuma
		Thisform.bon=tnsuma
		Thisform.numerar=tnsuma
		Thisform.clb_procent.SetFocus()
		*!*	Select cote_tva
		*!*	Go Top
		*!*	Thisform.tva=procent
		*!*	Thisform.cotaTVA.Value=Alltrim(Str(Thisform.tva))
		*!*	Thisform.cotaTVA.Refresh()
		Select actactan
		Locate For Alltrim(scd)='5311'
		If Found()
			lnIdJtva = id_jtva_coloana
			Select jtva_vanzare
			Locate For id_jtva_coloana = lnIdJtva
			If !Found()
				Go Top
			Endif
		Else
			Select jtva_vanzare
			Go Top
		Endif
		Thisform.tva = cota_tva
		Thisform.cbO_TVA_VANZARE.Value = Alltrim(denumire)
		DoDefault()
		
	ENDPROC

	PROCEDURE verificare
		LPARAMETERS tcPar
		DO CASE 
			CASE tcPar = 'thisform.procent'
				thisform.discount = ROUND(thisform.bon*thisform.procent/100,gnPc)
				thisform.clb_discount.Refresh
			CASE tcPar = 'thisform.discount'
				IF thisform.discount>thisform.bon
					thisform.discount=0
					thisform.procent=0
					thisform.clb_procent.Refresh 		
					thisform.clb_discount.Refresh			
				ELSE 
					thisform.procent = ROUND(thisform.discount*100/thisform.bon,2)
					thisform.clb_procent.Refresh 		
		
				ENDIF 
		OTHERWISE 
		ENDCASE 		
		
				
		thisform.diminuat=thisform.bon-thisform.discount
		thisform.total=thisform.nr*thisform.valoare
		IF thisform.total>thisform.diminuat 
			thisform.numerar=0
		ELSE 
			thisform.numerar=thisform.diminuat-thisform.total 	
		ENDIF 	
		thisform.clb_total.Refresh 
		thisform.clb_numerar.Refresh 
		thisform.clb_diminuat.Refresh 
	ENDPROC

	PROCEDURE cbo_tva_vanzare.InteractiveChange
		Thisform.tva = jtva_vanzare.cota_tva
	ENDPROC

	PROCEDURE Clb_discount.Text_simplu1.Valid
		thisform.verificare(this.ControlSource)
	ENDPROC

	PROCEDURE Clb_nr.Text_simplu1.Valid
		thisform.verificare(this.ControlSource)
	ENDPROC

	PROCEDURE Clb_procent.Text_simplu1.Valid
		thisform.verificare(this.ControlSource)
	ENDPROC

	PROCEDURE Clb_valoare.Text_simplu1.Valid
		thisform.verificare(this.ControlSource)
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_tichete1408 AS frm_termin_renunt OF "_frm_child.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Clb_bon" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_nr" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_numerar" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_valoare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_total" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_linie1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_linie2" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: verificare
		*p: bon
		*p: nr
		*p: numerar
		*p: total
		*p: valoare
	*</DefinedPropArrayMethod>

	*<PropValue>
		bon = 0
		BorderStyle = 1
		DoCreate = .T.
		Height = 144
		Name = "frm_tichete"
		nr = 0
		numerar = 0
		total = 0
		valoare = 0
		Width = 525
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 524
		_shape2.Height = 29
		_shape2.Left = 460
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 63
		Lb_titlu_alb_b121.Caption = "Bon"
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 7
		BUT_TERMIN1.Left = 491
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 3
		BUT_TERMIN1.Top = 1
		Gridsort1.Left = 24
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 108
		But_renunt1.Left = 462
		But_renunt1.Name = "But_renunt1"
		But_renunt1.TabIndex = 4
		But_renunt1.Top = 1
	*</PropValue>

	ADD OBJECT '_linie1' AS _linie WITH ;
		Height = 0, ;
		Left = 344, ;
		Name = "_linie1", ;
		Top = 82, ;
		Width = 10
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="line" />

	ADD OBJECT '_linie2' AS _linie WITH ;
		Height = 0, ;
		Left = 344, ;
		Name = "_linie2", ;
		Top = 88, ;
		Width = 10
		*< END OBJECT: ClassLib="_baza.vcx" BaseClass="line" />

	ADD OBJECT 'Clb_bon' AS clb_tx_simplu WITH ;
		Left = 228, ;
		Name = "Clb_bon", ;
		TabIndex = 8, ;
		Top = 36, ;
		Text_simplu1.ControlSource = "thisform.bon", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = "999 999 999.99", ;
		Text_simplu1.Left = 136, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 148, ;
		Lb_simplu1.Caption = "Valoare Bon", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_nr' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 11, ;
		Name = "Clb_nr", ;
		TabIndex = 1, ;
		Top = 72, ;
		Width = 152, ;
		Text_simplu1.ControlSource = "thisform.nr", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 113, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 35, ;
		Lb_simplu1.Caption = "Tichete de masa", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_numerar' AS clb_tx_simplu WITH ;
		Left = 228, ;
		Name = "Clb_numerar", ;
		TabIndex = 6, ;
		Top = 108, ;
		Text_simplu1.ControlSource = "thisform.numerar", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = "999 999 999.99", ;
		Text_simplu1.Left = 135, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 149, ;
		Lb_simplu1.Caption = "Numerar", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_total' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 360, ;
		Name = "Clb_total", ;
		TabIndex = 5, ;
		Top = 72, ;
		Width = 158, ;
		Text_simplu1.ControlSource = "thisform.total", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.Left = 5, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 146, ;
		Lb_simplu1.Caption = "(total)", ;
		Lb_simplu1.Left = 114, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6, ;
		Lb_simplu1.Visible = .F.
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_valoare' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 181, ;
		Name = "Clb_valoare", ;
		TabIndex = 2, ;
		Top = 72, ;
		Width = 158, ;
		Text_simplu1.ControlSource = "thisform.valoare", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = "999 999 999.99", ;
		Text_simplu1.Left = 8, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 85, ;
		Lb_simplu1.Caption = "(valoare)", ;
		Lb_simplu1.Left = 105, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Lb_simplu1' AS lb_simplu WITH ;
		Caption = "X", ;
		Left = 169, ;
		Name = "Lb_simplu1", ;
		TabIndex = 9, ;
		Top = 78
		*< END OBJECT: ClassLib="lb.vcx" BaseClass="label" />
	
	PROCEDURE Activate
		*
	ENDPROC

	PROCEDURE inainte_de_do_termin
		thisform.verificare()
		IF thisform.nr>0 AND thisform.valoare>0
			lcStringmp500= [T,1,______,_,__;0;]+ ALLTRIM(STR(thisform.numerar*100,8,3))+[;;;;]+CRLF+;
						   [T,1,______,_,__;3;]+ ALLTRIM(STR(thisform.total*100,8,3))+[;;;;]+CRLF+;
						   [F,1,______,_,__;]+CRLF
						   
			SELECT actactan
			LOCATE FOR ALLTRIM(scd)='5311'
			IF FOUND()
				SCATTER NAME lmp500
				replace suma WITH thisform.numerar
				APPEND BLANK 
				GATHER NAME lmp500
				replace suma WITH MIN(thisform.total,thisform.bon),scd WITH '5323'
			SELECT actactan
			GO TOP 	
			ENDIF 
						   
		ELSE 
			lcStringmp500=[T,1,______,_,__;]+CRLF+[F,1,______,_,__;]+CRLF				   
		ENDIF 	
		
				
		RETURN .t.
	ENDPROC

	PROCEDURE Init
		PARAMETERS tnsuma
		thisform.bon=tnsuma
		thisform.numerar=tnsuma
		thisform.clb_nr.setfocus()
	ENDPROC

	PROCEDURE verificare
		thisform.total=thisform.nr*thisform.valoare
		IF thisform.total>thisform.bon
			thisform.numerar=0
		ELSE 
			thisform.numerar=thisform.bon-thisform.total 	
		ENDIF 	
		thisform.clb_total.Refresh 
		thisform.clb_numerar.Refresh 
	ENDPROC

	PROCEDURE Clb_nr.Text_simplu1.Valid
		thisform.verificare()
	ENDPROC

	PROCEDURE Clb_valoare.Text_simplu1.Valid
		thisform.verificare()
	ENDPROC

ENDDEFINE
