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

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_combobox1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_reset
		*p: cdefault
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderColor = 128,128,128
		Height = 27
		Name = "ctip_deviz"
		Width = 90
	*</PropValue>

	ADD OBJECT '_combobox1' AS _combobox WITH ;
		FontName = "Arial Narrow", ;
		Left = 1, ;
		Name = "_combobox1", ;
		Top = 2, ;
		Width = 89
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="combobox" />
	
	PROCEDURE do_reset
		this._combobox1.Value=this.cdefault
	ENDPROC

	PROCEDURE _combobox1.Destroy
		If Used('lista_tipuri')
			Use In lista_tipuri
		Endif
	ENDPROC

	PROCEDURE _combobox1.Init
		=cctipuri_deviz()
		Select denumire,id_tip From crstipuri_deviz Into Array latipuri Order By id_tip
		If Used('crstipuri_deviz')
			Use In crstipuri_deviz
		Endif
		If Used('lista_tipuri')
			Use In lista_tipuri
		Endif
		
		Create Cursor lista_tipuri (denumire C(50),id_tip N(5))
		Select lista_tipuri
		Append Blank
		Replace denumire With '<Toate tipurile>',id_tip With 0
		
		If Type('latipuri')#'U'
			Append From Array latipuri
			Release latipuri
		Endif
		
		This.RowSourceType= 2
		This.RowSource="lista_tipuri"
		This.Value="<Toate tipurile>"
		this.Parent.cdefault="<Toate tipurile>"
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_aleg_operatie AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Cb_operatie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cb_sectie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cb_mecanic" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_timpn" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_timpn.Lb_simplu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_ore" UniqueID="" Timestamp="" />

	*<PropValue>
		DoCreate = .T.
		Height = 214
		Name = "frm_aleg_operatie"
		Width = 375
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE2.Height = 29
		_SHAPE2.Left = 312
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = 0
		_SHAPE2.Width = 64
		LB_TITLU_ALB_B121.Caption = "ALEGEȚI OPERAȚIA"
		LB_TITLU_ALB_B121.FontBold = .T.
		LB_TITLU_ALB_B121.Name = "LB_TITLU_ALB_B121"
		LB_TITLU_ALB_B121.TabIndex = 8
		BUT_TERMIN1.Left = 345
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 6
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Left = 315, ;
		Name = "But_renunt1", ;
		TabIndex = 7, ;
		Top = 1
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cb_mecanic' AS cb_tx_simplu WITH ;
		Left = 41, ;
		Name = "Cb_mecanic", ;
		TabIndex = 4, ;
		Top = 132, ;
		_CBBASE1.Name = "_CBBASE1", ;
		_CBBASE1.RowSource = "v_mecanici.nume,id_mecanic", ;
		_CBBASE1.RowSourceType = 6, ;
		_LBBASE1.Caption = "Mecanic", ;
		_LBBASE1.Name = "_LBBASE1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cb_operatie' AS cb_tx_simplu WITH ;
		Left = 41, ;
		Name = "Cb_operatie", ;
		TabIndex = 2, ;
		Top = 76, ;
		_CBBASE1.DisabledForeColor = 0,0,0, ;
		_CBBASE1.DisabledItemBackColor = 128,128,128, ;
		_CBBASE1.Name = "_CBBASE1", ;
		_CBBASE1.RowSource = "v_denop.denop,id_norme,timpn", ;
		_CBBASE1.RowSourceType = 6, ;
		_LBBASE1.Caption = "Operație", ;
		_LBBASE1.Name = "_LBBASE1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cb_sectie' AS cb_tx_simplu WITH ;
		Left = 41, ;
		Name = "Cb_sectie", ;
		TabIndex = 1, ;
		Top = 48, ;
		_CBBASE1.DisabledForeColor = 0,0,0, ;
		_CBBASE1.DisabledItemBackColor = 128,128,128, ;
		_CBBASE1.Name = "_CBBASE1", ;
		_CBBASE1.RowSource = "v_nom_sectii.sectie,id_sectie", ;
		_CBBASE1.RowSourceType = 6, ;
		_LBBASE1.Caption = "Secție", ;
		_LBBASE1.Name = "_LBBASE1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_ore' AS clb_tx_simplu WITH ;
		Left = 41, ;
		Name = "Clb_ore", ;
		TabIndex = 5, ;
		Top = 160, ;
		TEXT_SIMPLU1.ControlSource = "pnore", ;
		TEXT_SIMPLU1.Height = 23, ;
		TEXT_SIMPLU1.InputMask = "999.99", ;
		TEXT_SIMPLU1.Left = 199, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Top = 3, ;
		TEXT_SIMPLU1.Width = 86, ;
		LB_SIMPLU1.Caption = "Ore", ;
		LB_SIMPLU1.Name = "LB_SIMPLU1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_timpn' AS clb_tx_simplu WITH ;
		Left = 41, ;
		Name = "Clb_timpn", ;
		TabIndex = 3, ;
		Top = 104, ;
		TEXT_SIMPLU1.ControlSource = "pntimpn", ;
		TEXT_SIMPLU1.Height = 23, ;
		TEXT_SIMPLU1.InputMask = "999.99", ;
		TEXT_SIMPLU1.Left = 199, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Top = 3, ;
		TEXT_SIMPLU1.Width = 86, ;
		LB_SIMPLU1.Caption = "Timp normat", ;
		LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		LB_SIMPLU1.Top = 6
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_timpn.Lb_simplu2' AS lb_simplu WITH ;
		Caption = "1.00", ;
		Left = 115, ;
		Name = "Lb_simplu2", ;
		Top = 6
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />
	
	PROCEDURE inainte_de_do_termin
		pntimpn=Thisform.clb_timpn.texT_SIMPLU1.Value
		pnore=Thisform.clb_ore.texT_SIMPLU1.Value
		pnid_sectie=v_nom_sectii.id_sectie
		pcsectie=v_nom_sectii.sectie
		pnid_norme=v_denop.id_norme
		pcdenop=v_denop.denop
		pnid_mecanic=v_mecanici.id_mecanic
		pcmecanic=v_mecanici.nume
		If Empty(Thisform.cb_sectie._CBBASE1.Value)
			amessagebox("Nu ati ales sectia!",0+48,"Atentie")
			Thisform.cb_sectie.SetFocus()
			Return .F.
		Endif
		If Empty(Thisform.cb_operatie._CBBASE1.Value)
			amessagebox("Nu ati ales operatia!",0+48,"Atentie")
			Thisform.cb_operatie.SetFocus()
			Return .F.
		Endif
		If Empty(pntimpn)
			amessagebox("Nu ati completat timpul normat pentru aceasta operatie!",0+48,"Atentie")
			Thisform.clb_timpn.SetFocus()
			Return .F.
		Endif
		If Empty(Thisform.cb_mecanic._CBBASE1.Value)
			amessagebox("Nu ati ales mecanicul!",0+48,"Atentie")
			Thisform.cb_mecanic.SetFocus()
			Return .F.
		Endif
		If Empty(pnore)
			amessagebox("Nu ati completat numarul de ore pentru acest mecanic!",0+48,"Atentie")
			Thisform.clb_ore.SetFocus()
			Return .F.
		Endif
		If pnore>pntimpn
			amessagebox("Numarul de ore nu poate fi mai mare decat timpul normat!",0+48,"Atentie")
			Return .F.
		Endif
		Return .T.
		
	ENDPROC

	PROCEDURE Init
		DoDefault()
		If !Empty(pnid_sectie)
		*!*		Thisform.cb_sectie._cbbase1.ReadOnly=.T.
			Thisform.cb_sectie._cbbase1.Enabled=.F.
			Select v_nom_sectii
			Locate For id_sectie=pnid_sectie
			Thisform.cb_sectie._cbbase1.Value=Alltrim(sectie)
		Endif
		If !Empty(pnid_norme)
		*!*		Thisform.cb_operatie._cbbase1.ReadOnly=.T.
			Thisform.cb_operatie._cbbase1.Enabled=.F.
			Select v_denop
			Locate For id_norme=pnid_norme
			Thisform.cb_operatie._cbbase1.Value=Alltrim(denop)
			Thisform.clb_timpn.lb_simplu2.Caption=Alltrim(Str(v_denop.timpn,7,2))
		Endif
		
	ENDPROC

	PROCEDURE Cb_operatie._CBBASE1.InteractiveChange
		thisform.clb_timpn.lb_simplu2.Caption=ALLTRIM(STR(v_denop.timpn,7,2))
	ENDPROC

	PROCEDURE Clb_timpn.TEXT_SIMPLU1.Valid
		pnore=pntimpn
		thisform.Refresh
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_aleg_sectie AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Cb_sectie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />

	*<PropValue>
		DoCreate = .T.
		Height = 94
		Name = "frm_aleg_sectie"
		Width = 375
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE2.Height = 29
		_SHAPE2.Left = 312
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = 0
		_SHAPE2.Width = 64
		LB_TITLU_ALB_B121.Caption = "ALEGEȚI SECȚIA"
		LB_TITLU_ALB_B121.FontBold = .T.
		LB_TITLU_ALB_B121.Name = "LB_TITLU_ALB_B121"
		BUT_TERMIN1.Left = 345
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Left = 315, ;
		Name = "But_renunt1", ;
		Top = 1
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cb_sectie' AS cb_tx_simplu WITH ;
		Left = 36, ;
		Name = "Cb_sectie", ;
		Top = 48, ;
		_CBBASE1.Name = "_CBBASE1", ;
		_CBBASE1.RowSource = "v_nom_sectii.sectie,id_sectie", ;
		_CBBASE1.RowSourceType = 6, ;
		_LBBASE1.Caption = "Secție", ;
		_LBBASE1.Name = "_LBBASE1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />
	
	PROCEDURE inainte_de_do_termin
		pnid_sectie=v_nom_sectii.id_sectie
		*!*	pnid_norma=v_denop.id_norme
		RETURN .T.
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_documente_lucrare AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="lb_titlu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdexport" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdexport.cCod.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdexport.cCod.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdexport.cDataAct.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdexport.cDataAct.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdexport.cNrAct.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdexport.cNrAct.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdexport.cAles.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdexport.cAles.Check1" UniqueID="" Timestamp="" />

	*<PropValue>
		DoCreate = .T.
		Height = 300
		Name = "frm_documente_lucrare"
		Width = 432
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 432
		_shape2.Height = 29
		_shape2.Left = 400
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 43
		Lb_titlu_alb_b121.Caption = "Documente"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Left = 402
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'grdexport' AS _grdrow WITH ;
		AllowHeaderSizing = .F., ;
		ColumnCount = 4, ;
		DeleteMark = .F., ;
		Height = 204, ;
		Left = 14, ;
		Name = "grdexport", ;
		Panel = 1, ;
		ReadOnly = .F., ;
		RecordSource = "crsexport", ;
		RowHeight = 19, ;
		Top = 84, ;
		Width = 396, ;
		Column1.ColumnOrder = 4, ;
		Column1.ControlSource = "cod", ;
		Column1.FontName = "Arial", ;
		Column1.FontSize = 10, ;
		Column1.Name = "cCod", ;
		Column1.ReadOnly = .T., ;
		Column1.Sparse = .F., ;
		Column1.Width = 119, ;
		Column2.ControlSource = "dataact", ;
		Column2.FontName = "Arial", ;
		Column2.FontSize = 10, ;
		Column2.Name = "cDataAct", ;
		Column2.ReadOnly = .T., ;
		Column2.Sparse = .F., ;
		Column2.Width = 86, ;
		Column3.ControlSource = "nract", ;
		Column3.FontName = "Arial", ;
		Column3.FontSize = 10, ;
		Column3.Name = "cNrAct", ;
		Column3.ReadOnly = .T., ;
		Column3.Sparse = .F., ;
		Column3.Width = 116, ;
		Column4.ColumnOrder = 1, ;
		Column4.ControlSource = "ales", ;
		Column4.CurrentControl = "Check1", ;
		Column4.FontName = "Arial", ;
		Column4.FontSize = 10, ;
		Column4.Name = "cAles", ;
		Column4.ReadOnly = .F., ;
		Column4.Sparse = .F., ;
		Column4.Width = 35
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdexport.cAles.Check1' AS checkbox WITH ;
		Alignment = 0, ;
		Caption = "", ;
		Centered = .T., ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Height = 17, ;
		Left = 13, ;
		Name = "Check1", ;
		ReadOnly = .F., ;
		Top = 23, ;
		Width = 60
		*< END OBJECT: BaseClass="checkbox" />

	ADD OBJECT 'grdexport.cAles.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Ales", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdexport.cCod.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cod", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdexport.cCod.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdexport.cDataAct.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdexport.cDataAct.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdexport.cNrAct.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Numar act", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdexport.cNrAct.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'lb_titlu1' AS lb_simplu WITH ;
		Caption = "<>", ;
		Height = 18, ;
		Left = 26, ;
		Name = "lb_titlu1", ;
		Top = 60, ;
		Width = 18
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />
	
	PROCEDURE Init
		LPARAMETERS tcnrord
		DODEFAULT()
		thisform.lb_titlu1.Caption = [Pentru comanda ] + ALLTRIM(tcNrOrd) + [ s-au găsit următoarele documente: ]
	ENDPROC

	PROCEDURE grdexport.Init
		* Nu sterge
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_emitere_facturi AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="grdcomenzi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrord.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrord.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatai.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatai.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNume.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNume.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cAsigurator.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cAsigurator.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValidat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValidat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cManopera.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cManopera.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cMateriale.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cMateriale.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cUtil_valid.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cUtil_valid.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDataoravalid.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDataoravalid.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cFacturat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cFacturat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatafact.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatafact.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrFact.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrFact.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cAles.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cAles._checkbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_cauta1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_reset1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nume" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_datai" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrinmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_factavans" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrord" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_factfinal" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_vizualizare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="opt_facturat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="opt_validat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_modifica1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_select_adv1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_aratafact
		*m: do_executa2
		*m: do_factureaza_avans
		*m: do_factureaza_avans_part
		*m: do_factureaza_final
		*m: do_factureaza_final_part
		*m: do_relisteaza_factura
		*m: do_storneaza_avans
		*m: do_verifica_com
		*m: do_verifica_part
		*m: verifica_stornare
	*</DefinedPropArrayMethod>

	*<PropValue>
		cbuton2 = but_listare1;but_listare2
		cbuton3 = but_modifica1;cmd_modifica1
		cgridsortlist = grdcomenzi
		DoCreate = .T.
		Height = 541
		lactiv2 = .T.
		lactiv3 = .T.
		Name = "frm_emitere_facturi"
		Width = 793
		WindowState = 2
		_shape1.Anchor = 10
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Tag = "RESIZABLE,NOVERTICAL_RESIZE"
		_shape1.Top = 0
		_shape1.Width = 792
		_shape1.ZOrderSet = 0
		_shape2.Anchor = 9
		_shape2.Height = 29
		_shape2.Left = 732
		_shape2.Name = "_shape2"
		_shape2.Tag = "MOVABLE,NOVERTICAL_MOVE"
		_shape2.Top = -1
		_shape2.Width = 64
		_shape2.ZOrderSet = 12
		Lb_titlu_alb_b121.Caption = "EMITERE FACTURI"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 16
		Lb_titlu_alb_b121.ZOrderSet = 1
		BUT_TERMIN1.Anchor = 9
		BUT_TERMIN1.Left = 763
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 13
		BUT_TERMIN1.Tag = "MOVABLE,NOVERTICAL_MOVE"
		BUT_TERMIN1.Top = 0
		BUT_TERMIN1.ZOrderSet = 13
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'But_listare1' AS but_listare WITH ;
		Anchor = 9, ;
		Left = 734, ;
		Name = "But_listare1", ;
		TabIndex = 12, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 0, ;
		Visible = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Ck_datai' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.datai, ;
		Caption = "Data comenzii", ;
		Left = 673, ;
		Name = "Ck_datai", ;
		TabIndex = 4, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		tip = D, ;
		Top = 73, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrinmat' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nrinmat, ;
		Caption = "Nr. înmatriculare", ;
		Left = 673, ;
		Name = "Ck_nrinmat", ;
		TabIndex = 5, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 92, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrord' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nrord, ;
		Caption = "Nr. comanda", ;
		Left = 673, ;
		Name = "Ck_nrord", ;
		TabIndex = 2, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 36, ;
		ZOrderSet = 11
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nume' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nume, ;
		Caption = "Nume client", ;
		Left = 673, ;
		Name = "Ck_nume", ;
		TabIndex = 3, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 54, ;
		ZOrderSet = 5
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Cmd_cauta1' AS cmd_cauta WITH ;
		Anchor = 8, ;
		AutoSize = .F., ;
		Left = 673, ;
		Name = "Cmd_cauta1", ;
		TabIndex = 8, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 262, ;
		Width = 109, ;
		ZOrderSet = 3
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_factavans' AS cmd_executa WITH ;
		Anchor = 12, ;
		AutoSize = .F., ;
		caction = do_executa, ;
		Caption = "Factura \<avans", ;
		ForeColor = 0,64,128, ;
		Height = 27, ;
		Left = 673, ;
		Name = "Cmd_factavans", ;
		PicturePosition = 1, ;
		TabIndex = 10, ;
		Tag = "MOVABLE", ;
		ToolTipText = "Emitere factura de avans", ;
		Top = 438, ;
		Width = 109, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_factfinal' AS cmd_executa WITH ;
		Anchor = 12, ;
		AutoSize = .F., ;
		caction = do_executa2, ;
		Caption = "Factura \<finala", ;
		ForeColor = 0,64,128, ;
		Height = 27, ;
		Left = 673, ;
		Name = "Cmd_factfinal", ;
		PicturePosition = 1, ;
		TabIndex = 11, ;
		Tag = "MOVABLE", ;
		ToolTipText = "Emitere factura finala", ;
		Top = 466, ;
		Width = 109, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_modifica1' AS cmd_modifica WITH ;
		Alignment = 2, ;
		Anchor = 12, ;
		Caption = "\<Modificare client / masina pe comanda", ;
		FontBold = .F., ;
		ForeColor = 0,0,160, ;
		Height = 55, ;
		Left = 673, ;
		Name = "Cmd_modifica1", ;
		PicturePosition = 0, ;
		TabIndex = 15, ;
		ToolTipText = "Modificare client / aceeasi masina sau alta masina pe comanda", ;
		Top = 378, ;
		Width = 109, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_reset1' AS cmd_reset WITH ;
		Anchor = 8, ;
		AutoSize = .F., ;
		Left = 673, ;
		Name = "Cmd_reset1", ;
		TabIndex = 17, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 291, ;
		Width = 109, ;
		ZOrderSet = 4
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_select_adv1' AS cmd_select_adv WITH ;
		Anchor = 6, ;
		AutoSize = .F., ;
		ccoloana = ales, ;
		cgrid = thisform.grdcomenzi, ;
		FontBold = .F., ;
		Height = 39, ;
		Left = 17, ;
		Name = "Cmd_select_adv1", ;
		Picture = ..\comun\grafice\check.bmp, ;
		PicturePosition = 1, ;
		TabIndex = 9, ;
		Top = 497, ;
		Width = 103, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_vizualizare' AS cmd_executa WITH ;
		Anchor = 6, ;
		AutoSize = .F., ;
		caction = do_aratafact, ;
		Caption = "\<Vizualizare facturi emise", ;
		FontBold = .F., ;
		Height = 39, ;
		Left = 129, ;
		Name = "Cmd_vizualizare", ;
		Picture = ..\comun\grafice\leaf_blue.bmp, ;
		PicturePosition = 1, ;
		TabIndex = 14, ;
		Tag = "MOVABLE", ;
		Top = 497, ;
		Width = 103, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grdcomenzi' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 13, ;
		DeleteMark = .F., ;
		Height = 456, ;
		Left = 17, ;
		Name = "grdcomenzi", ;
		Panel = 1, ;
		ReadOnly = .T., ;
		RecordSource = "crscomenzi", ;
		RowHeight = 19, ;
		TabIndex = 1, ;
		Tag = "RESIZABLE", ;
		Top = 36, ;
		Width = 643, ;
		ZOrderSet = 2, ;
		Column1.ColumnOrder = 2, ;
		Column1.ControlSource = "nrord", ;
		Column1.FontName = "Arial", ;
		Column1.FontSize = 10, ;
		Column1.Name = "cNrord", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 98, ;
		Column2.ColumnOrder = 4, ;
		Column2.ControlSource = "IIF(TYPE('datai')=='D',datai,TTOD(datai))", ;
		Column2.FontName = "Arial", ;
		Column2.FontSize = 10, ;
		Column2.Name = "cDatai", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 88, ;
		Column3.ColumnOrder = 3, ;
		Column3.ControlSource = "nume", ;
		Column3.FontName = "Arial", ;
		Column3.FontSize = 10, ;
		Column3.Name = "cNume", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 203, ;
		Column4.ColumnOrder = 11, ;
		Column4.ControlSource = "asigurator", ;
		Column4.FontName = "Arial", ;
		Column4.FontSize = 10, ;
		Column4.Name = "cAsigurator", ;
		Column4.ReadOnly = .T., ;
		Column4.Width = 85, ;
		Column5.ColumnOrder = 5, ;
		Column5.ControlSource = "IIF(validat=1,'Da','Nu')", ;
		Column5.FontName = "Arial", ;
		Column5.FontSize = 10, ;
		Column5.Name = "cValidat", ;
		Column5.ReadOnly = .T., ;
		Column5.Width = 51, ;
		Column6.ColumnOrder = 9, ;
		Column6.ControlSource = "ROUND(manopera,gnPc)", ;
		Column6.FontName = "Arial", ;
		Column6.FontSize = 10, ;
		Column6.Format = "R", ;
		Column6.InputMask = (get_mask(12,gnPc)), ;
		Column6.Name = "cManopera", ;
		Column6.ReadOnly = .T., ;
		Column6.Width = 97, ;
		Column7.ColumnOrder = 10, ;
		Column7.ControlSource = "ROUND(materiale,gnPc)", ;
		Column7.FontName = "Arial", ;
		Column7.FontSize = 10, ;
		Column7.Format = "R", ;
		Column7.InputMask = (get_mask(12,gnPc)), ;
		Column7.Name = "cMateriale", ;
		Column7.ReadOnly = .T., ;
		Column7.Width = 93, ;
		Column8.ColumnOrder = 12, ;
		Column8.ControlSource = "util_valid", ;
		Column8.FontName = "Arial", ;
		Column8.FontSize = 10, ;
		Column8.Name = "cUtil_valid", ;
		Column8.ReadOnly = .T., ;
		Column8.Width = 115, ;
		Column9.ColumnOrder = 13, ;
		Column9.ControlSource = "dataoravalid", ;
		Column9.FontName = "Arial", ;
		Column9.FontSize = 10, ;
		Column9.Name = "cDataoravalid", ;
		Column9.ReadOnly = .T., ;
		Column9.Width = 113, ;
		Column10.ColumnOrder = 6, ;
		Column10.ControlSource = "IIF(facturat=1,'Da','Nu')", ;
		Column10.FontName = "Arial", ;
		Column10.FontSize = 10, ;
		Column10.Name = "cFacturat", ;
		Column10.ReadOnly = .T., ;
		Column10.Width = 59, ;
		Column11.ColumnOrder = 7, ;
		Column11.ControlSource = "IIF(TYPE('datafact')=='D',datafact,TTOD(datafact))", ;
		Column11.FontName = "Arial", ;
		Column11.FontSize = 10, ;
		Column11.Name = "cDatafact", ;
		Column11.ReadOnly = .T., ;
		Column11.Width = 93, ;
		Column12.ColumnOrder = 8, ;
		Column12.ControlSource = "nrfact", ;
		Column12.FontName = "Arial", ;
		Column12.FontSize = 10, ;
		Column12.InputMask = (get_mask(14,0)), ;
		Column12.Name = "cNrFact", ;
		Column12.ReadOnly = .T., ;
		Column12.Width = 104, ;
		Column13.ColumnOrder = 1, ;
		Column13.ControlSource = "ales", ;
		Column13.FontName = "Arial", ;
		Column13.FontSize = 10, ;
		Column13.Name = "cAles", ;
		Column13.ReadOnly = .T., ;
		Column13.Sparse = .F., ;
		Column13.Width = 44
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdcomenzi.cAles._checkbox1' AS _checkbox WITH ;
		Alignment = 2, ;
		AutoSize = .F., ;
		Caption = "", ;
		Centered = .T., ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Left = 16, ;
		Name = "_checkbox1", ;
		ReadOnly = .F., ;
		Top = 23
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'grdcomenzi.cAles.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Aleasa", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cAsigurator.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Asigurator", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cAsigurator.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cDatafact.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data facturii", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cDatafact.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cDatai.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data comanda", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cDatai.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cDataoravalid.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data si ora validarii", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cDataoravalid.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cFacturat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Facturata", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cFacturat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cManopera.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Manopera", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cManopera.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cMateriale.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Materiale", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cMateriale.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNrFact.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr.factura", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNrFact.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNrord.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr.comanda", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNrord.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNume.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nume client", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNume.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cUtil_valid.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Validata de catre", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cUtil_valid.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cValidat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Validata", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cValidat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'opt_facturat' AS _optiongrup WITH ;
		Anchor = 8, ;
		AutoSize = .F., ;
		ButtonCount = 3, ;
		Height = 65, ;
		Left = 671, ;
		Name = "opt_facturat", ;
		TabIndex = 7, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 185, ;
		Width = 89, ;
		OPTION1.AutoSize = .T., ;
		OPTION1.Caption = "Toate", ;
		OPTION1.FontSize = 10, ;
		OPTION1.Left = 5, ;
		OPTION1.Name = "OPTION1", ;
		OPTION1.Top = 5, ;
		OPTION1.Value = 1, ;
		OPTION2.AutoSize = .T., ;
		OPTION2.Caption = "Facturate", ;
		OPTION2.FontSize = 10, ;
		OPTION2.Left = 5, ;
		OPTION2.Name = "OPTION2", ;
		OPTION2.Top = 24, ;
		Option3.AutoSize = .T., ;
		Option3.BackStyle = 0, ;
		Option3.Caption = "Nefacturate", ;
		Option3.FontSize = 10, ;
		Option3.Height = 18, ;
		Option3.Left = 5, ;
		Option3.Name = "Option3", ;
		Option3.Top = 43, ;
		Option3.Value = 0, ;
		Option3.Width = 85
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT 'opt_validat' AS _optiongrup WITH ;
		Anchor = 8, ;
		AutoSize = .F., ;
		ButtonCount = 3, ;
		Height = 65, ;
		Left = 671, ;
		Name = "opt_validat", ;
		TabIndex = 6, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 120, ;
		Width = 89, ;
		OPTION1.AutoSize = .T., ;
		OPTION1.Caption = "Toate", ;
		OPTION1.FontSize = 10, ;
		OPTION1.Left = 5, ;
		OPTION1.Name = "OPTION1", ;
		OPTION1.Top = 5, ;
		OPTION1.Value = 1, ;
		OPTION2.AutoSize = .T., ;
		OPTION2.Caption = "Validate", ;
		OPTION2.FontSize = 10, ;
		OPTION2.Left = 5, ;
		OPTION2.Name = "OPTION2", ;
		OPTION2.Top = 24, ;
		Option3.AutoSize = .T., ;
		Option3.BackStyle = 0, ;
		Option3.Caption = "Nevalidate", ;
		Option3.FontSize = 10, ;
		Option3.Height = 18, ;
		Option3.Left = 5, ;
		Option3.Name = "Option3", ;
		Option3.Top = 43, ;
		Option3.Value = 0, ;
		Option3.Width = 78
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />
	
	PROCEDURE actualizeaza_grid1
		Lparameters tcFiltru
		Local lcFiltru
		If Empty(tcFiltru)
			lcFiltru = pocomenzi.ca_baza1.cfiltru
		Else
			lcFiltru = tcFiltru
		Endif
		
		Thisform.LockScreen = .T.
		Thisform.MousePointer = 11
		
		save_grid_comment(Thisform.grdcomenzi)
		pocomenzi.ca_baza1.cfiltru = lcFiltru
		pocomenzi.ca_baza1.afisare()
		restore_grid_comment(Thisform.grdcomenzi)
		Thisform.grdcomenzi.SetAll("DynamicForeColor","IIF(facturat=1,RGB(128,128,128),RGB(0,0,0))","Column")
		If Reccount('crscomenzi')>0
			Thisform.cmd_vizualizare.Enabled=.T.
			Thisform.grdcomenzi.SetFocus()
		Else
			*!*		Thisform.cmd_factavans.Enabled = .F.
			*!*		Thisform.cmd_factfinal.Enabled = .F.
			Thisform.cmd_modifica1.Enabled=.F.
			Thisform.cmd_vizualizare.Enabled=.F.
		Endif
		
		Thisform.cmd_select_adv1.do_reset()
		Thisform.MousePointer = 0
		Thisform.LockScreen = .F.
		
	ENDPROC

	PROCEDURE do_adauga
		*!*	Private pnvalidat,pnid_ordl,pnid_lucrare,pnrecno,pnfacturat
		*!*	Select crscomenzi
		*!*	pcnrord=nrord
		*!*	pnvalidat=Validat
		*!*	pnid_ordl=id_ordl
		*!*	pnfacturat=facturat
		*!*	pnid_lucrare=id_lucrare
		*!*	pnrecno=Recno()
		*!*	If pnvalidat=0 AND pnfacturat=0
		*!*		If amessagebox("Sunteti sigur ca doriti sa validati comanda "+Alltrim(pcnrord)+" ?",4+32+256,"Confirmare")==6
		*!*			Thisform.LockScreen=.T.
		*!*			Thisform.MousePointer= 11
		*!*			lcSql=[begin pack_devize.dev_valideaza_comanda('] + Alltrim(gcS) + [',] + Alltrim(Str(pnid_ordl)) + ;
		*!*				[,] + Alltrim(Str(gnIdutil)) + [); end;]
		*!*			lnSucces=goExecutor.oExecute(lcSql)
		*!*			Thisform.MousePointer= 0
		*!*			Thisform.LockScreen=.F.
		
		*!*			If lnSucces < 0
		*!*				amessagebox(goExecutor.cEroare,0+16,'Eroare')
		*!*				Return
		*!*			Endif
		*!*			Thisform.actualizeaza_grid1()
		*!*			Go pnrecno
		*!*		Endif
		*!*	Else
		*!*		amessagebox("Aceasta comanda este deja validata!",0+48,"Atentie")
		*!*	Endif
	ENDPROC

	PROCEDURE do_aratafact
		Local lnid_ordl
		Select crscomenzi
		lnid_ordl=id_ordl
		lcnrord=nrord
		If Used('crsfacturi')
			Use In crsfacturi
		Endif
		lcSql=[select a.datai,b.serie_act,b.nract,a.nume,b.dataact,b.explicatia,b.suma,b.scd,b.scc ] + ;
			[from ] + gcS + [.auto_vordl a ] + ;
			[left join ] + gcS + [.vact b on a.id_lucrare=b.id_lucrare ] + ;
			[where a.id_ordl=]+Alltrim(Str(lnid_ordl))+[ and (b.scd like '4111%' or b.scd like '667%') ] + ;
			[order by b.dataact,b.nract]
		
		Thisform.MousePointer=11
		Thisform.LockScreen=.T.
		lnSucces=goExecutor.oExecute(lcSql,'crsfacturi')
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		Endif
		Thisform.LockScreen=.F.
		Thisform.MousePointer= 0
		
		If Reccount('crsfacturi')>0
		*!*		Thisform.AlwaysOnTop=.F.
			ofrmfacturi=Createobject('frm_factact')
			ofrmfacturi.lb_titlu_alb_b121.Caption=ofrmfacturi.lb_titlu_alb_b121.Caption+" "+Alltrim(lcnrord)
			ofrmfacturi.Show(1)
		*!*		Thisform.AlwaysOnTop=.T.
		Else
			amessagebox("Nu exista facturi pentru aceasta comanda!",0+48,"Atentie")
		Endif
		Use In crsfacturi
	ENDPROC

	PROCEDURE do_cauta
		Local lcFiltru
		* DOAR COMENZI 1= POSTGARANTIE, 2 = GARANTIE
		lcFiltru = gcCondLuna  + [ and a.id_tip IN (1,2) ]
		lcFiltru = lcFiltru + [ and a.inchis_fortat = 0 ]
		If Thisform.ck_datai.Value=1
			lcFiltru = lcFiltru + Thisform.ck_datai.filtru
		Endif
		
		If Thisform.ck_nrinmat.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nrinmat.filtru
		Endif
		
		If Thisform.ck_nrord.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nrord.filtru
		Endif
		
		If Thisform.ck_nume.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nume.filtru
		Endif
		
		Do Case
		Case Thisform.opt_facturat.Value=2
			lcFiltru = lcFiltru + [ and a.facturat=1]
		Case Thisform.opt_facturat.Value=3
			lcFiltru = lcFiltru + [ and a.facturat=0]
		Endcase
		
		Do Case
		Case Thisform.opt_validat.Value=2
			lcFiltru = lcFiltru + [ and a.validat=1]
		Case Thisform.opt_validat.Value=3
			lcFiltru = lcFiltru + [ and a.validat=0]
		Endcase
		
		Thisform.actualizeaza_grid1(lcFiltru)
		
		If Reccount('crscomenzi')=0
			amessagebox('Cautarea nu a intors rezultate!',0+48,'Info cautare')
			Thisform.ck_nrord.SetFocus()
		Endif
	ENDPROC

	PROCEDURE do_executa
		Local lcFiltru, lnNrDosare, lnNrInchise, lnNrInreg, lnNrParteneri, lnRecno
		lcFiltru = 'ales = 1'
		
		If Used('crscomenzi') And Reccount('crscomenzi') > 0
			Private poGeneratorNumere
			poGeneratorNumere = Createobject('oGeneratorNumere')
			If Used('crsverifcom')
				Use In crsverifcom
			ENDIF
		
			lnRecno = RECNO()
			IF m.lnRecno > 0
				LOCATE FOR ales = 1
				IF !FOUND()
					lcFiltru = 'recno() = ' + ALLTRIM(STR(m.lnRecno))
				ENDIF
				GOTO m.lnRecno
			ENDIF
		
			Select Count(Distinct id_partener) As nr, Count(*) As nrinreg, Sum(Iif(Empty(Nvl(nr_dosar, [])), 0, 1)) As nrdosare, ;
				SUM(facturat) As nrinchise From crscomenzi ;
				With (Buffering = .T.) Where &lcFiltru Into Cursor crsverifcom
			Select crsverifcom
			lnNrParteneri = nr
			lnNrInreg = nrinreg
			lnNrInchise = nrinchise
			*!*	modificare	v 2.0.29
			lnNrDosare = nrdosare
			*!*	modificare	v 2.0.29	^
			If Used('crsverifcom')
				Use In crsverifcom
			Endif
		
			Do Case
				Case m.lnNrInreg = 0
					amessagebox([Nu ati ales comenzi pentru facturare!], 0 + 48, [Atentie])
				Case m.lnNrParteneri > 1
					amessagebox([Daca doriti sa facturati mai multe devize,atunci ele trebuie sa fie ale unui singur client!], 0 + 48, [Atentie])
					*!*	modificare	v 2.0.29
		*!*			Case m.lnNrDosare > 0 AND m.lnNrInreg > 1	&&	modificare	v 2.0.31
		*!*				amessagebox([Nu puteti alege devizele care provin din dosare de asigurare!], 0 + 48, [Atentie])
					*!*	modificare	v 2.0.29	^
				Case m.lnNrInchise > 0
					amessagebox([Ati selectat si comenzi care au fost facturate!], 0 + 48, [Atentie])
				Case m.lnNrInreg > 1
					lnRaspuns = 6
					if m.lnNrDosare > 0	&& 2.4.23
						lnRaspuns = amessagebox([Atentie!] + ALLTRIM(STR(m.lnNrDosare)) + [/] + ALLTRIM(STR(m.lnNrInreg)) + [ devize provin din dosare de asigurare!]+ CRLF + ;
							  "Doriti sa continuati?", 4 + 32, "Confirmare facturare")
					ENDIF 	
					If m.lnRaspuns = 6
						Thisform.do_factureaza_avans_part(m.lcFiltru)
					ENDIF 
				Otherwise
					Thisform.do_factureaza_avans(m.lcFiltru)
			Endcase
			Release m.poGeneratorNumere
		Endif
	ENDPROC

	PROCEDURE do_executa2
		Local lcFiltru, lnCotaTva, lnNrDosare, lnNrInchise, lnNrInreg, lnNrParteneri, lnNrValidate
		Local lnRaspuns, lnRecno
		
		lcFiltru = 'ales = 1'
		If Used('crscomenzi') And Reccount('crscomenzi') > 0
			Private poGeneratorNumere
			poGeneratorNumere = Createobject('oGeneratorNumere')
		
			SELECT crsComenzi
			lnRecno = RECNO()
			IF m.lnRecno > 0
				LOCATE FOR ales = 1
				IF !FOUND()
					lcFiltru = 'recno() = ' + ALLTRIM(STR(m.lnRecno))
				ENDIF
				GOTO m.lnRecno
			ENDIF
		
			Use In (SELECT('crsverifcom'))
		
			Select Count(Distinct id_partener) As nr, Count(*) As nrinreg, Sum(Validat) As nrvalidate, ;
				Sum(Iif(Empty(Nvl(nr_dosar, [])), 0, 1)) As nrdosare, ;
				SUM(facturat) As nrinchise, ;
				SUM(Iif(INLIST(proc_tvav, 1, gnCotaTVAStandard), 0, 1)) As cotatva  From crscomenzi ;
				With (Buffering = .T.) Where &lcFiltru Into Cursor crsverifcom
		
			Select crsverifcom
			lnNrParteneri = nr
			lnNrInreg = nrinreg
			lnNrValidate = nrvalidate
			lnNrInchise = nrinchise
			*!*	modificare	v 2.0.29
			lnNrDosare = nrdosare
			*!*	modificare	v 2.0.29	^
			*!*	modificare	v 2.0.35
			lnCotaTva = cotatva
			*!*	modificare	v 2.0.35	^
			Use In (SELECT('crsverifcom'))
		
		
			Do Case
				Case m.lnNrInreg = 0
					amessagebox([Nu ati ales comenzi pentru facturare!], 0 + 48, [Atentie])
				Case m.lnNrParteneri > 1
					amessagebox([Daca doriti sa facturati mai multe devize,atunci ele trebuie sa fie ale unui singur client!], 0 + 48, [Atentie])
					*!*	modificare	v 2.0.29
		*!*			Case m.lnNrDosare > 0 And m.lnNrInreg > 1	&&	modificare	v 2.0.31
		*!*				amessagebox([Nu puteti alege devizele care provin din dosare de asigurare!], 0 + 48, [Atentie])
					*!*	modificare	v 2.0.29	^
				Case m.lnNrValidate = 0
					amessagebox([Nu puteti emite factura finala pentru comenzi nevalidate!], 0 + 48, [Atentie])
				Case m.lnNrInreg > m.lnNrValidate
					amessagebox([Ati ales si comenzi nevalidate!], 0 + 48, [Atentie])
				Case m.lnNrInchise > 0
					amessagebox([Ati selectat si comenzi care au fost facturate!], 0 + 48, [Atentie])
					*!*	modificare	v 2.0.35
					*!*			Case lnNrInreg > 1
					*!*				Thisform.do_factureaza_final_part()
					*!*			Otherwise
					*!*				Thisform.do_factureaza_final()
				Case m.lnNrInreg > 1
					lnRaspuns = 6
					If m.lnCotaTva <> 0
						lnRaspuns = amessagebox("Cota TVA de la validarea comenzilor selectate difera de cea standard din luna curenta!" + CRLF + ;
							  "Daca apasati DA, atunci pretul cu TVA al materialelor bonate se va calcula aplicand cota TVA actuala la pretul fara TVA de pe bon." + CRLF + ;
							  "Doriti sa continuati?", 4 + 32, "Confirmare facturare")
					ENDIF
					
					if m.lnNrDosare > 0	&& 2.4.23
						lnRaspuns = amessagebox([Atentie! ] + ALLTRIM(STR(m.lnNrDosare)) + [/] + ALLTRIM(STR(m.lnNrInreg)) + [ devize provin din dosare de asigurare!]+ CRLF + ;
							  "Doriti sa continuati?", 4 + 32, "Confirmare facturare")
					ENDIF
								
					If m.lnRaspuns = 6
						Thisform.do_factureaza_final_part(m.lcFiltru)
					Endif
				Otherwise
					lnRaspuns = 6
					If m.lnCotaTva <> 0
						lnRaspuns = amessagebox("Cota TVA de la validarea comenzi selectate difera de cea standard din luna curenta!" + CRLF + ;
							  "Daca apasati DA, atunci pretul cu TVA al materialelor bonate se va calcula aplicand cota TVA actuala la pretul fara TVA de pe bon." + CRLF + ;
							  "Doriti sa continuati?", 4 + 32, "Confirmare facturare")
					Endif
		
					If m.lnRaspuns = 6
						Thisform.do_factureaza_final(m.lcFiltru)
					Endif
					*!*	modificare	v 2.0.35	^
			Endcase
			Release m.poGeneratorNumere
		Endif
		
	ENDPROC

	PROCEDURE do_factureaza_avans
		LPARAMETERS tcFiltru
		
		LOCAL lcFiltru
		Local ofrmincasare As 'frm_incasare_avans'
		Local ofrmverificari As "frm_rezultate_verificari"
		Local lcSql, lnLungime, lnSucces, loTVAColoana
		*:Global oactan, ocomanda, oincasare, otva, pcCasa, pnTaxCode, poactan, taValori[1], x
		
		lcFiltru = IIF(EMPTY(m.tcFiltru), 'ales = 1', m.tcFiltru)
		
		Private pniesire,pnIdTva,pnProcTva,pnIdJtvaColoana,pnTipIncasare,pnAvans
		Local lnIncasat, loLogCursoare, ldDataAct
		loLogCursoare = CREATEOBJECT("oLogCursoare")
		*!*	modificare JC/JV 2007
		
		pnIdJtvaColoana = GetIdJtvaStandard("VANZARE")
		loTVAColoana = GeJtvaColoana(pnIdJtvaColoana)
		pnIdTva = NVL(loTVAColoana.id_tva,0)
		pnProcTva = 1 + ROUND(loTVAColoana.cota_tva/100,2)
		*!*	modificare JC/JV 2007	^
		pnTipIncasare=1
		optiuni_firma()							&&	reinitializare optiuni
		Local lnPozitieCursor
		Select crscomenzi
		GO top
		*LOCATE FOR ales = 1
		LOCATE FOR &lcFiltru
		lnPozitieCursor=Recno()
		Scatter Name ocomanda
		&& optiuni cu analitice
		&& optiuni tip analitic
		
		Thisform.MousePointer=11
		Thisform.LockScreen=.T.
		
		If Used('crsavansuri')
			Use In crsavansuri
		Endif
		*!*	modificare	v 2.0.21
		*!*	lcSql=[select NVL(sum(suma),0.00) as avans,incasat from ]+gcS+[.dev_vordl_avansuri ] + ;
		*!*		[where id_lucrare=] + Alltrim(Str(ocomanda.id_lucrare)) + [ group by incasat]
		lcSql = [{call pack_auto.citeste_date_avans('] + Alltrim(Str(ocomanda.id_lucrare)) + [',',')}]
		*!*	modificare	v 2.0.21	^
		lnSucces=goExecutor.oExecute(lcSql,'crsavansuri')
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		Endif
		Select crsavansuri
		Sum ROUND(avans,gnPc),ROUND(incasat,gnPc) To pnAvans,lnIncasat
		
		lcSql=[select a.nrord,to_char(a.datai,'DD/MM/YYYY') as datai from ] + gcS +  ;
			[.auto_normare_comenzi a ] + ;
			[where a.id_masiniclient=] + Alltrim(Str(ocomanda.id_masiniclient)) + [ and a.id_ordl!=] + Alltrim(Str(ocomanda.id_ordl)) + [ and ] + ;
			[a.facturat=0 and ]+gcCondLuna+[ order by a.datai]
		lnSucces=goExecutor.oExecute(lcSql,'crsverificari')
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		Endif
		
		Thisform.LockScreen=.F.
		Thisform.MousePointer=0
		
		pniesire=1
		ofrmverificari=Createobject("frm_rezultate_verificari",pnAvans,lnIncasat)
		ofrmverificari.lb_client.Caption="Client: "+Alltrim(Nvl(ocomanda.nume,''))
		ofrmverificari.lb_titlu1.Caption=ofrmverificari.lb_titlu1.Caption+" "+Alltrim(ocomanda.nrinmat)
		ofrmverificari.lb_comanda.Caption="Comanda: "+Alltrim(Nvl(ocomanda.nrord,''))
		ofrmverificari.Show(1)
		Release ofrmverificari
		Use In crsverificari
		If pniesire!=1
			If Used('crsavansuri')
				Use In crsavansuri
			Endif
			Return
		Endif
		
		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.
		*!*	lnNumarFactura = aloca_numar_fact()
		*!*	taValori[5,1]="poAct.nract"
		*!*	taValori[5,2]=Alltrim(Str(lnNumarFactura))
		*!*	taValori[5,3]=.F.
		
		*!*	modificare	v 2.0.28
		*!*	If !Isnull(gnid_fdoc_factura)  
		If !Isnull(gnid_fdoc_fact)
		*!*	modificare	v 2.0.28	^
			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]=Alltrim(Str(gnid_fdoc_fact))
		*!*	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
		Endif
		
		Thisform.AlwaysOnTop=.F.
		If gnAvans419=1
			Dimension taValori[lnLungime+2,3]
			taValori[lnLungime+1,1]="poAct.v419"
			taValori[lnLungime+1,2]=Alltrim(ocomanda.nume)
			taValori[lnLungime+1,3]=.T.
			taValori[lnLungime+2,1]="poAct.id_vv419"
			taValori[lnLungime+2,2]=Alltrim(Str(ocomanda.id_partener))
			taValori[lnLungime+2,3]=.T.
			lans(31002,.F.,.T.,@taValori)
		Else
			lans(31001,.F.,.T.,@taValori)	&&   id_set,daca se executa procedura de mai multe ori,
		&& daca verifica analiticele,array de valori
		Endif
		
		Thisform.AlwaysOnTop=.T.
		If buton=2
			Do deschid_actc
		*!*		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
		
		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
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		Endif
		
		 SET STEP ON 
		*!*	modificare	v 2.1.0
		local lnTvaIncasare, lcContTVA
		Select actactan
		Calculate Max(tva_incasare) To lnTvaIncasare
		if lnTvaIncasare = 1
			pnIdJtvaColoana = getIdJtvaColoana(pnIdJtvaColoana,1)
			pnIdTva = getIdTva(pnIdTva,1)
			lcContTVA = [4428]
		else
			lcContTVA = [4427]
		ENDIF
		
		*!*	modificare	v 2.1.0	^
		*!*	modificare	v 2.0.41	:	am adaugat pnPretCuTva
		Private pnTotalfTva,pnTotalTva,pnTotalcTva,pnNrChit,pnIdCasa,pcSerieChit,pnPretCuTva, pnPOS
		Store 0 To pnTotalfTva,pnTotalTva,pnTotalcTva,pnIdCasa,pcCasa,pnNrChit,pnPretCuTva, pnPOS
		STORE [] TO pcSerieChit		&&	modificare	v 2.0.28
		pniesire=1
		ofrmincasare=Createobject('frm_incasare_avans',lnTvaIncasare,2)		&&	modificare	v 2.0.41 / v 2.1.0
		ofrmincasare.Show(1)
		Release ofrmincasare
		Use In v_nom_casa
		If pniesire!=1
		*!*		dezaloca_numar_bf()		&&	oserii_numere.prg
		*!*		Do dezaloca_numar_fact In oserii_numere.prg
			poGeneratorNumere.dezaloca_numere()
			Return
		Endif
		
		SELECT actactan
		GO TOP 
		ldDataAct = dataact
		pnTaxCode = GetTaxCodeIdPart(m.gnAn, m.gnLuna, m.ldDataAct, m.pnIdJtvaColoana, ocomanda.id_partener)
		
		*!*	modificare	v 2.0.3
		Local lcExplicatia5
		lcExplicatia5 = Alltrim(Nvl(ocomanda.inspector,''))+[;]+Alltrim(Nvl(ocomanda.nr_dosar,''))
		*!*	modificare	v 2.0.3	^
		
		*!*	modificare	v 2.1.0
		*!*	modificare v 2.0.6 : am concatenat explicatia5
		SET STEP ON 
		Select actactan
		Replace suma With pnTotalfTva,proc_Tva With pnProcTva,id_jtva_coloana With pnIdJtvaColoana, taxcode WITH m.pnTaxCode For Alltrim(scc)='707' Or Alltrim(scc)='419'
		Replace suma With pnTotalTva,proc_Tva With pnProcTva,id_jtva_coloana With pnIdTva, taxcode WITH m.pnTaxCode For scc=lcContTVA
		Replace explicatia4 With ocomanda.asigurator,explicatia5 with ALLTRIM(NVL(explicatia5,''))+[;]+lcExplicatia5,explicatia With 'AVANS' For Alltrim(scd)='4111'
		*!*	Replace explicatia4 With ocomanda.asigurator,explicatia5 with ALLTRIM(NVL(explicatia5,''))+[;]+lcExplicatia5,suma With pnTotalfTva,proc_Tva With pnProcTva,;
		*!*		id_jtva_coloana With pnIdJtvaColoana,explicatia With 'AVANS' For Alltrim(scc)='707' Or Alltrim(scc)='419'
		*!*	Replace explicatia4 With ocomanda.asigurator,explicatia5 with ALLTRIM(NVL(explicatia5,''))+[;]+lcExplicatia5,suma With pnTotalTva,proc_Tva With pnProcTva,;
		*!*		id_jtva_coloana With pnIdTva,explicatia With 'AVANS' For scc='4427'
		*!*	Replace explicatia4 With ocomanda.asigurator,explicatia5 with ALLTRIM(NVL(explicatia5,''))+[;]+lcExplicatia5,explicatia With 'AVANS' For Alltrim(scd)='4111'
		*!*	modificare	v 2.1.0	^
		
		If pnTipIncasare>1
		*!*		If !Empty(pnNrChit)	&&	modificare 22.02
		*!* incasare = 5311
			Select actactan
			Go Top
			Scatter Name oactan
			Append Blank
			*!*	modificare	v 2.0.28 : pcSerieChit
			Gather Name oactan Fields Except proc_Tva,id_jtva_coloana	&& Fields Except suma, ascc, scc, id_partc
			Replace nr_nota With Recno(),partc With partd, id_partc With id_partd, suma With pnTotalcTva, serie_Act WITH null
			Replace scc With Alltrim(scd), ascc With ascd, scd With '5311', ascd With '', perecheC With nract,nract With pnNrChit,serie_act WITH pcSerieChit
			Replace id_partd With pnIdCasa,partd With m.pcCasa,neimpozab With 0,explicatia With 'INCASARE AVANS', 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
				Select actactan
				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 otva.suma,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, taxcode WITH m.pnTaxCode
					Endif
				Endif
			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 && pnTipIncasare>1
		
		UPDATE actactan SET PAYMENTCODE = '42', PAYMENTNAME = 'Plata in contul bancar' WHERE LEFT(scd, 3) = '512'
		UPDATE actactan SET PAYMENTCODE = '10', PAYMENTNAME = 'Numerar' WHERE LEFT(scd, 3) = '531'	
		UPDATE actactan SET TAXCODE = NULL, TAXNAME = '' WHERE INLIST(LEFT(scd, 3), '531', '512')
		
		
		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
		
		Select actactan
		Replace All tva_incasare With lnTvaIncasare	&&	modificare	v 2.1.0
		Go Top
		Private buton
		buton=1
		*!*	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
			Use In actactan
		*!*		dezaloca_numar_bf()		&&	oserii_numere.prg
		*!*		Do dezaloca_numar_fact In oserii_numere.prg
			poGeneratorNumere.dezaloca_numere()
			Return
		Endif
		
		Select actactan
		*!*	modificare	v 2.0.28
		*!*	lnSucces = oscrie_in_fisiere()
		*!*	If lnSucces>0
		*!*	modificare	v 2.0.28	^
			Thisform.AlwaysOnTop = .F.
		*!*	modificare	v 2.0.28
		*!*		Do listare_avans With ocomanda.id_partener,'actactan',ocomanda.nrord,ocomanda.nrinmat,0
		*!*	modificare	v 2.0.35
		*!*		IF !factureaza_deviz(ocomanda.id_lucrare,ocomanda.nrord,ocomanda.nrinmat,[],0)
			*!*	modificare	v 2.0.41	:	am adaugat Alltrim(Str(ocomanda.id_lucrare)),pnPretCuTva
			IF !factureaza_deviz(ocomanda.id_lucrare,ocomanda.nrord,ocomanda.nrinmat,[],0,,,,,,Alltrim(Str(ocomanda.id_ordl)),Alltrim(Str(ocomanda.id_lucrare)),pnPretCuTva)
		*!*	modificare	v 2.0.35	^
				poGeneratorNumere.dezaloca_numere()
			ELSE
				Thisform.actualizeaza_grid1()
			ENDIF
		*!*	modificare	v 2.0.28	^
			Thisform.AlwaysOnTop = .T.
		*!*	Thisform.actualizeaza_grid1()	&&	modificare	v 2.0.28
			Select crscomenzi
			If Reccount('crscomenzi')>=lnPozitieCursor
				Go lnPozitieCursor
			Endif
		*!*	modificare	v 2.0.28
		*!*	Else
		*!*	*!*		dezaloca_numar_bf()		&&	oserii_numere.prg
		*!*	*!*		Do dezaloca_numar_fact In oserii_numere.prg
		*!*		poGeneratorNumere.dezaloca_numere()
		*!*	Endif
		*!*	modificare	v 2.0.28	^
		
		Use In crsavansuri 
	ENDPROC

	PROCEDURE do_factureaza_avans_part
		LPARAMETERS tcFiltru 
		LOCAL lcFiltru
		Local ofrmincasare As 'frm_incasare_avans'
		Local lcSql, lnLungime, lnSucces, loTVAColoana
		*:Global ocomanda, poactan, taValori[1], x
		
		lcFiltru = IIF(EMPTY(m.tcFiltru), 'ales = 1', m.tcFiltru)
		
		*!* 12.06.2014
		*!* marius.mutu
		*!* selectie nume banca lei pentru plata bon fiscal numerar sau prin card 
		*!* pnPOS = incasare bon fiscal numerar = 1; CARD POS = 1
		*!* inlocuiesc nota 5311 = 4111.client cu 5113.client = 4111.client
		*!* v_nom_casa: se alege casa sau banca lei (pentru incasare CARD)
		
		Private pniesire,pnIdTva,pnProcTva,pnIdJtvaColoana,pnTipIncasare, pnTaxCode
		Local lcSirIdLucrare,lcSirIdOrdl,lcSirNrOrd,lnNrComenzi, loLogCursoare, ldDataAct
		loLogCursoare = CREATEOBJECT("oLogCursoare")
		
		lcSirIdLucrare = []
		lcSirIdOrdl = []
		lcSirNrOrd = []
		*!*	modificare JC/JV 2007
		pnIdJtvaColoana = GetIdJtvaStandard("VANZARE")
		loTVAColoana = GeJtvaColoana(pnIdJtvaColoana)
		pnIdTva = NVL(loTVAColoana.id_tva,0)
		pnProcTva = 1 + ROUND(loTVAColoana.cota_tva/100,2)
		
		*!*	modificare JC/JV 2007	^
		pnTaxCode = NULL
		pnTipIncasare=1
		optiuni_firma()							&&	reinitializare optiuni
		Local lnPozitieCursor
		Select crscomenzi
		GO top
		* LOCATE FOR ales = 1
		LOCATE FOR &lcFiltru
		lnPozitieCursor=Recno()
		Scatter Name ocomanda
		&& optiuni cu analitice
		&& optiuni tip analitic
		
		If Used('crsselectate')
			Use In crsselectate
		Endif
		
		Select * From crscomenzi With (Buffering = .T.) Where &lcFiltru Into Cursor crsselectate
		lnNrComenzi = Reccount('crsselectate')
		Select crsselectate
		Scan
			lcSirIdOrdl = lcSirIdOrdl + Alltrim(Str(id_ordl)) + [,]
			lcSirIdLucrare = lcSirIdLucrare + Alltrim(Str(id_lucrare)) + [,]
			lcSirNrOrd = lcSirNrOrd + Alltrim(nrord) + [,]
		Endscan
		lcSirIdOrdl = Substr(lcSirIdOrdl,1,Len(lcSirIdOrdl)-1)
		lcSirIdLucrare = Substr(lcSirIdLucrare,1,Len(lcSirIdLucrare)-1)
		lcSirNrOrd = Substr(lcSirNrOrd,1,Len(lcSirNrOrd)-1)
		
		If Used('crsavansuri_complet')
			Use In crsavansuri_complet
		Endif
		
		*!*	modificare	v 2.0.21
		*!*	lcSql=[select NVL(SUM(a.suma),0.00) as avans,a.id_lucrare,b.nrord ] + ;
		*!*		[from ] + gcS + [.dev_vordl_avansuri a ] + ;
		*!*		[left join ] + gcS + [.vnom_lucrari b on a.id_lucrare = b.id_lucrare ] + ;
		*!*		[where a.id_partd = ] + Alltrim(Str(ocomanda.id_partener)) + [ ] + ;
		*!*		[and a.id_lucrare in (] + ALLTRIM(lcSirIdLucrare) + [) ] + ;
		*!*		[group by a.id_lucrare,b.nrord]
		lcSql = [{call pack_auto.citeste_date_avans('] + ALLTRIM(lcSirIdLucrare) + [',',')}]
		*!*	modificare	v 2.0.21	^
		lnSucces = goExecutor.oExecute(lcSql,'crsavansuri_complet')
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
			Return
		Endif
		
		*!*	modificare	v 2.0.21
		Use In Select('crsavansuri')
		Select Sum(NVL(avans,0.00)) As avans,SUM(NVL(incasat,0.00)) as incasat,id_lucrare,nrord From crsavansuri_complet ;
			GROUP By id_lucrare,nrord Into Cursor crsavansuri
		*!*	modificare	v 2.0.21	^
			
		If Thisform.do_verifica_part(lcSirIdOrdl,ocomanda)!=1
			Use In Select('crsavansuri')
			Use In Select('crsavansuri_complet')
			Return
		Endif
		
		Use In Select('crsavansuri_complet')
		
		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] = lcSirNrOrd
		taValori[2,3] = .T.
		taValori[3,1] = "poAct.id_lucrare"
		taValori[3,2] = [-1]
		taValori[3,3] = .T.
		taValori[4,1] = "poAct.id_vv4111"
		taValori[4,2] = Alltrim(Str(ocomanda.id_partener))
		taValori[4,3] = .T.
		*!*	lnNumarFactura = aloca_numar_fact()
		*!*	taValori[5,1]="poAct.nract"
		*!*	taValori[5,2]=Alltrim(Str(lnNumarFactura))
		*!*	taValori[5,3]=.F.
		
		*!*	modificare	v 2.0.28
		*!*	If !Isnull(gnid_fdoc_factura)  
		If !Isnull(gnid_fdoc_fact)
		*!*	modificare	v 2.0.28	^
			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]=Alltrim(Str(gnid_fdoc_fact))
		*!*	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
		Endif
		
		Thisform.AlwaysOnTop=.F.
		If gnAvans419=1
			Dimension taValori[lnLungime+2,3]
			taValori[lnLungime+1,1]="poAct.v419"
			taValori[lnLungime+1,2]=Alltrim(ocomanda.nume)
			taValori[lnLungime+1,3]=.T.
			taValori[lnLungime+2,1]="poAct.id_vv419"
			taValori[lnLungime+2,2]=Alltrim(Str(ocomanda.id_partener))
			taValori[lnLungime+2,3]=.T.
			lans(31002,.F.,.T.,@taValori)
		Else
			lans(31001,.F.,.T.,@taValori)	&&   id_set,daca se executa procedura de mai multe ori,
		&& daca verifica analiticele,array de valori
		Endif
		
		Thisform.AlwaysOnTop=.T.
		If buton=2
			Do deschid_actc
		*!*		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
		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
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		Endif
		
		*!*	modificare	v 2.1.0
		local lnTvaIncasare, lcContTVA
		Select actactan
		Calculate Max(tva_incasare) To lnTvaIncasare
		if lnTvaIncasare = 1
			pnIdJtvaColoana = getIdJtvaColoana(pnIdJtvaColoana,1)
			pnIdTva = getIdTva(pnIdTva,1)
			lcContTVA = [4428]
		else
			lcContTVA = [4427]
		ENDIF
		
			
		*!*	modificare	v 2.1.0	^
		*!*	modificare	v 2.0.41	:	am adaugat pnPretCuTva
		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
		ofrmincasare=Createobject('frm_incasare_avans',lnTvaIncasare,2)	&&	modificare	v 2.0.41 / v 2.1.0
		ofrmincasare.Show(1)
		Release ofrmincasare
		Use In v_nom_casa
		If pniesire!=1
		*!*		dezaloca_numar_bf()		&&	oserii_numere.prg
		*!*		Do dezaloca_numar_fact In oserii_numere.prg
			poGeneratorNumere.dezaloca_numere()
			Return
		Endif
		
		SELECT actactan
		GO TOP 
		ldDataAct = dataact
		pnTaxCode = GetTaxCodeIdPart(m.gnAn, m.gnLuna, m.ldDataAct, m.pnIdJtvaColoana, ocomanda.id_partener)
		
		*!*	modificare 	v 2.0.6 : am concatenat explicatia5
		*!*	modificare	v 2.1.0 : am adaugat apelurile la getIdTva si getIdJtvaColoana
		Insert Into actactan(nr_nota,id_act,luna,an,cod,datairegt,dataireg,dataact,serie_act,nract,dataactt,datascad,suma,explicatia,scd,ascd,;
			scc,ascc,pereched,perechec,explicatia4,explicatia5,datascadt,nnir,id_util,util,dataora,;
			id_responsabil,nresp,id_venchelt,dst_chlt,id_lucrare,nrord,id_ctr,contract,id_sectie,sectie,;
			proc_tva,id_set,id_fact,id_factd,id_factc,id_partd,partd,id_partc,partc,id_sucursala,sucursala,;
			id_fdoc,fdoc,id_gestin,id_jtva_coloana,taxcode,gestin,id_gestout,gestout,id_valuta,nume_val) ;
			Select a.nr_nota,a.id_act,a.luna,a.an,a.cod,a.datairegt,a.dataireg,a.dataact,a.serie_act,a.nract,a.dataactt,a.datascad,;
			IIF(Alltrim(a.scc) = '707' Or Alltrim(a.scc) = '419',Round(pnTotalfTva/lnNrComenzi,gnpc),Round(pnTotalTva/lnNrComenzi,gnpc)) As suma,;
			IIF(Alltrim(a.scd) = '4111',[AVANS],[]) As explicatia,a.scd,a.ascd,a.scc,a.ascc,a.pereched,a.perechec,;
			b.asigurator As explicatia4,ALLTRIM(NVL(a.explicatia5,''))+[;]+alltrim(Nvl(b.inspector,''))+[;]+Alltrim(Nvl(b.nr_dosar,'')) as explicatia5,a.datascadt,a.nnir,a.id_util,a.util,a.dataora,;
			a.id_responsabil,a.nresp,a.id_venchelt,a.dst_chlt,b.id_lucrare,b.nrord,a.id_ctr,a.contract,;
			a.id_sectie,a.sectie,pnProcTva As proc_tva,a.id_set,a.id_fact,a.id_factd,a.id_factc,a.id_partd,a.partd,;
			a.id_partc,a.partc,a.id_sucursala,a.sucursala,a.id_fdoc,a.fdoc,a.id_gestin,;
			Iif(Alltrim(a.scc)=lcContTVA,pnIdTva,pnIdJtvaColoana) As id_jtva_coloana,;
			m.pnTaxCode As taxcode,;
			a.gestin,a.id_gestout,a.gestout,a.id_valuta,a.nume_val From actactan a ;
			Left Join crsselectate b On 2 = 2
		Delete From actactan Where id_lucrare = -1
		
		Select actactan
		If pnTotalfTva <> Round(pnTotalfTva/lnNrComenzi,gnpc) * lnNrComenzi Then
			Locate For Alltrim(scc) = '707' Or Alltrim(scc) = '419'
			If Found()
				Replace suma With suma + pnTotalfTva - Round(pnTotalfTva/lnNrComenzi,gnpc) * lnNrComenzi
			Endif
		Endif
		
		If pnTotalTva <> Round(pnTotalTva/lnNrComenzi,gnpc) * lnNrComenzi Then
			Locate For Alltrim(scc) = lcContTVA
			If Found()
				Replace suma With suma + pnTotalTva - Round(pnTotalTva/lnNrComenzi,gnpc) * lnNrComenzi
			Endif
		Endif
		
		If pnTipIncasare>1
			*!*	modificare	v 2.0.28 : pcSerieChit
			Insert Into actactan(nr_nota,id_act,luna,an,cod,datairegt,dataireg,dataact,nract,serie_act,dataactt,suma,explicatia,scd,ascd,;
				scc,ascc,pereched,perechec,explicatia4,explicatia5,datascadt,datascad,nnir,id_util,util,dataora,;
				id_responsabil,nresp,id_venchelt,dst_chlt,id_lucrare,nrord,id_ctr,contract,id_sectie,sectie,;
				id_set,id_fact,id_factd,id_factc,id_partd,partd,id_partc,partc,id_sucursala,sucursala,;
				id_fdoc,fdoc,id_gestin,gestin,id_gestout,gestout,id_valuta,nume_val) ;
				Select Recno() As nr_nota,a.id_act,a.luna,a.an,a.cod,a.datairegt,a.dataireg,a.dataact,pnNrChit As nract,pcSerieChit as serie_act,a.dataactt,;
				SUM(suma) As suma,[INCASARE AVANS] As explicatia,[5311] As scd,[] As ascd,a.scd As scc,a.ascd As ascc,;
				a.pereched,a.nract As perechec,a.explicatia4,a.explicatia5,{} As datascadt,{} As datascad,a.nnir,;
				a.id_util,a.util,a.dataora,a.id_responsabil,a.nresp,a.id_venchelt,a.dst_chlt,a.id_lucrare,a.nrord,;
				a.id_ctr,a.contract,a.id_sectie,a.sectie,a.id_set,a.id_fact,a.id_fact As id_factd,a.id_factc,;
				pnIdCasa As id_partd, m.pcCasa As partd,a.id_partd As id_partc,a.partd As partc,a.id_sucursala,a.sucursala,;
				IIF(pnTipIncasare=2,gnid_fdoc_bonfiscal,Iif(pnTipIncasare=3,gnid_fdoc_chitanta,0)) As id_fdoc,;		&&	modificare v 2.0.29 : am inlocuit gnid_fdoc_incasare
				IIF(pnTipIncasare=2,[BON FISCAL],Iif(pnTipIncasare=3,[CHITANTA],[])) As fdoc,a.id_gestin,;
				a.gestin,a.id_gestout,a.gestout,a.id_valuta,a.nume_val From actactan a ;
				GROUP By a.id_act,a.luna,a.an,a.cod,a.datairegt,a.dataireg,a.dataact,a.dataactt,a.scd,;
				a.ascd,a.pereched,a.nract,a.explicatia4,a.explicatia5,a.nnir,a.id_util,a.util,a.dataora,;
				a.id_responsabil,a.nresp,a.id_venchelt,a.dst_chlt,a.id_lucrare,a.nrord,a.id_ctr,a.contract,;
				a.id_sectie,a.sectie,a.id_set,a.id_fact,a.id_factc,a.id_partd,a.partd,a.id_sucursala,a.sucursala,;
				a.id_gestin,a.gestin,a.id_gestout,a.gestout,a.id_valuta,a.nume_val
		
			*!*	modificare	v 2.1.0
			If lnTvaIncasare = 1
				Insert Into actactan(nr_nota,id_act,luna,an,cod,datairegt,dataireg,dataact,serie_act,nract,dataactt,suma,explicatia,scd,;
					scc,pereched,perechec,explicatia4,explicatia5,datascadt,nnir,id_util,util,dataora,;
					id_responsabil,nresp,id_venchelt,dst_chlt,id_lucrare,nrord,id_ctr,contract,id_sectie,sectie,;
					proc_tva,id_set,id_fact,id_factd,id_factc,id_partd,partd,id_partc,partc,id_sucursala,sucursala,;
					id_fdoc,fdoc,id_gestin,id_jtva_coloana,gestin,id_gestout,gestout,id_valuta,nume_val) ;
					Select Recno() As nr_nota,a.id_act,a.luna,a.an,a.cod,a.datairegt,a.dataireg,a.dataact,pcSerieChit As serie_act,pnNrChit As nract,a.dataactt,;
					a.suma,[INCASARE AVANS] As explicatia,'4428' As scd,'4427' As scc,a.pereched,a.nract As perechec,;
					a.explicatia4,a.explicatia5,a.datascadt,a.nnir,a.id_util,a.util,a.dataora,;
					a.id_responsabil,a.nresp,a.id_venchelt,a.dst_chlt,a.id_lucrare,a.nrord,a.id_ctr,a.contract,;
					a.id_sectie,a.sectie,a.proc_tva,a.id_set,-5 As id_fact,a.id_factd,a.id_factc,0 As id_partd,'' As partd,;
					0 As id_partc,'' As partc,a.id_sucursala,a.sucursala,;
					IIF(pnTipIncasare=2,gnid_fdoc_bonfiscal,Iif(pnTipIncasare=3,gnid_fdoc_chitanta,0)) As id_fdoc,;
					IIF(pnTipIncasare=2,[BON FISCAL],Iif(pnTipIncasare=3,[CHITANTA],[])) As fdoc,a.id_gestin,;
					getIdTva(pnIdTva,0) As id_jtva_coloana, m.pnTaxcode as taxcode, ;
					a.gestin,a.id_gestout,a.gestout,a.id_valuta,a.nume_val From actactan a Where a.scc = lcContTVA
			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 && pnTipIncasare>1
		
		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
		
		UPDATE actactan SET PAYMENTCODE = '42', PAYMENTNAME = 'Plata in contul bancar' WHERE LEFT(scd, 3) = '512'
		UPDATE actactan SET PAYMENTCODE = '10', PAYMENTNAME = 'Numerar' WHERE LEFT(scd, 3) = '531'	
		UPDATE actactan SET TAXCODE = NULL, TAXNAME = '' WHERE INLIST(LEFT(scd, 3), '531', '512')
		
		
		Select actactan
		replace all tva_incasare with lnTvaIncasare	&&	modificare	v 2.1.0
		Go Top
		Private buton
		buton=1
		*!*	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
			Use In actactan
		*!*		dezaloca_numar_bf()		&&	oserii_numere.prg
		*!*		Do dezaloca_numar_fact In oserii_numere.prg
			poGeneratorNumere.dezaloca_numere()
			Return
		Endif
		
		Select actactan
		*!*	modificare	v 2.0.28
		*!*	lnSucces = oscrie_in_fisiere()
		*!*	If lnSucces>0
		*!*	modificare	v 2.0.28	^
			Thisform.AlwaysOnTop = .F.
		*!*	modificare	v 2.0.28
		*!*		Do listare_avans With ocomanda.id_partener,'actactan',lcSirNrOrd,ocomanda.nrinmat,1
		*!*	modificare	v 2.0.35
		*!*		IF !factureaza_deviz(ocomanda.id_lucrare,lcSirNrOrd,ocomanda.nrinmat,[],1)
			*!*	modificare	v 2.0.41	:	am adaugat lcSirIdLucrare,pnPretCuTva
			IF !factureaza_deviz(ocomanda.id_lucrare,lcSirNrOrd,ocomanda.nrinmat,[],1,,,,,,lcSirIdOrdl,lcSirIdLucrare,pnPretCuTva)
		*!*	modificare	v 2.0.35	^
				poGeneratorNumere.dezaloca_numere()
			ELSE
				Thisform.actualizeaza_grid1()
			ENDIF
		*!*	modificare	v 2.0.28	^
			
			Thisform.AlwaysOnTop = .T.
		*!*	Thisform.actualizeaza_grid1()	&&	modificare	v 2.0.28
			Select crscomenzi
			If Reccount('crscomenzi')>=lnPozitieCursor
				Go lnPozitieCursor
			Endif
		*!*	modificare	v 2.0.28
		*!*	Else
		*!*	*!*		dezaloca_numar_bf()		&&	oserii_numere.prg
		*!*	*!*		Do dezaloca_numar_fact In oserii_numere.prg
		*!*		poGeneratorNumere.dezaloca_numere()
		*!*	Endif
		*!*	modificare	v 2.0.28	^
		
		*!*	Use In crsavansuri 
	ENDPROC

	PROCEDURE do_factureaza_final
		LPARAMETERS tcFiltru
		
		LOCAL lcFiltru
		Local ofrmincasare As 'frm_incasare_finala'
		Local ofrmverificari As "frm_rezultate_verificari"
		Local lcAscdTva, lcPartC, lcPartD, lcSectie, lcSql, lcscc, lcscd, ldDataAct, lnIdPartC, lnIdPartD
		Local lnId_Sectie, lnLungime, lnProcDiscM, lnProcDiscN, lnSucces, lnSumaAlteServFTva
		Local lnSumaAlteServTva, lnSumaMateriale, lnTotalCTVAMateriale, lnTotalManop, lnTotalMater
		Local loTVAColoana
		*:Global oactan, oavans, ocomanda, oincasare, otva, poactan, taValori[1], x
		
		lcFiltru = IIF(EMPTY(m.tcFiltru), 'ales = 1', m.tcFiltru)
		
		*!* 12.06.2014
		*!* marius.mutu
		*!* selectie nume banca lei pentru plata bon fiscal numerar sau prin card 
		*!* pnPOS = incasare bon fiscal numerar = 1; CARD POS = 1
		*!* inlocuiesc nota 5311 = 4111.client cu 5113.client = 4111.client
		*!* v_nom_casa: se alege casa sau banca lei (pentru incasare CARD)
		
		
		*!* 18.08.2015
		*!* marius.mutu
		*!* completare procent discount manopera, materiale din contract tip CLIENT AUTO
		
		*!* 23.11.2017
		*!* marius.mutu
		*!* Sterg liniile cu 0 doar daca am inregistrari cu suma <> 0, altfel nu gasesc inregistrari 411 = xxx la salvarea facturii si da eroare
		
		Private pniesire,pnAvansFTva,pnAvansTva,pnTipIncasare,pnIdTva,pnProcTva,pnIdJtvaColoana,pnAvans,pnAchitAsigurator, pnTaxCode
		Local lnIncasat,lnTVAMateriale, loLogCursoare
		loLogCursoare = CREATEOBJECT("oLogCursoare")
		&&	1 	- 	fara incasare
		&&	2	-	bon fiscal
		&&	3	-	chitanta pe factura
		pnTipIncasare=1
		optiuni_firma()							&&	reinitializare gnTip_LFactura
		Local lnPozitieCursor
		Select crscomenzi
		Go Top
		*Locate For ales = 1
		LOCATE FOR &lcFiltru
		lnPozitieCursor=Recno()
		Scatter Name ocomanda
		&& optiuni cu analitice
		&& optiuni tip analitic
		Thisform.MousePointer=11
		Thisform.LockScreen=.T.
		
		*!*	modificare	v 2.0.28	:	l-am mutat dupa stornare avans pentru ca in frm_alte_date se inchide cursorul v_nom_casa 
		*!*								si nu mi-l mai gaseste in do_factureaza_final
		*!*	If Used('v_nom_casa')
		*!*		Use In v_nom_casa
		*!*	Endif
		*!*	lcSql=[select id_part,nume from ] + gcS + [.vnom_casa_lei]
		*!*	lnSucces=goExecutor.oExecute(lcSql,'v_nom_casa')
		*!*	If lnSucces < 0
		*!*		amessagebox(goExecutor.cEroare,0+16,'Eroare')
		*!*	Endif
		*!*	modificare	v 2.0.28	^
		
		Use In Select('crsavansuri_complet')
		*!*	modificare	v 2.0.21
		*!*	lcSql=[select * from ]+gcS+[.dev_vordl_avansuri where id_lucrare=]+Alltrim(Str(ocomanda.id_lucrare))
		lcSql = [{call pack_auto.citeste_date_avans('] + Alltrim(Str(ocomanda.id_lucrare)) + [',',')}]
		*!*	modificare	v 2.0.21	^
		lnSucces=goExecutor.oExecute(lcSql,'crsavansuri_complet')
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		Endif
		Use In Select('crsavansuri')
		*!*	modificare	v 2.0.52	:	am adaugat avansftva
		Select Sum(Nvl(avans,0.00)) As avans,Sum(Nvl(incasat,0.00)) As incasat,sum(nvl(avansftva,0.00)) as avansftva,;
			id_lucrare,nrord From crsavansuri_complet ;
			GROUP By id_lucrare,nrord Into Cursor crsavansuri
		Select crsavansuri
		*!*	modificare	v 2.0.21
		*!*	Sum suma to pnAvans
		pnAvans = avans
		pnAvansFTva	= avansftva		&&	modificare	v 2.0.52
		lnIncasat = incasat
		Use In Select('crsavansuri')
		*!*	modificare	v 2.0.21	^
		
		If Used('crsverificari')
			Use In crsverificari
		Endif
		
		lcSql=[select a.nrord,to_char(a.datai,'DD/MM/YYYY') as datai from ] + gcS +  ;
			[.auto_normare_comenzi a ] + ;
			[where a.id_masiniclient=] + Alltrim(Str(ocomanda.id_masiniclient)) + [ and a.id_ordl!=] + Alltrim(Str(ocomanda.id_ordl)) + [ and ] + ;
			[a.facturat=0 and ]+gcCondLuna+[ order by a.datai]
		lnSucces=goExecutor.oExecute(lcSql,'crsverificari')
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		Endif
		
		Thisform.LockScreen=.F.
		Thisform.MousePointer=0
		
		pniesire=1
		ofrmverificari=Createobject("frm_rezultate_verificari",pnAvans,lnIncasat)
		ofrmverificari.lb_client.Caption="Client: "+Alltrim(Nvl(ocomanda.nume,''))
		ofrmverificari.lb_titlu1.Caption=ofrmverificari.lb_titlu1.Caption+" "+Alltrim(ocomanda.nrinmat)
		ofrmverificari.lb_comanda.Caption="Comanda: "+Alltrim(Nvl(ocomanda.nrord,''))
		ofrmverificari.Show(1)
		Release ofrmverificari
		Use In crsverificari
		If pniesire!=1
			Return
		Endif
		
		*!*	modificare v 2.0.21
		If glAutoBonDet
			If pnAvans > 0
				If aMessagebox("Se achita factura cu bon fiscal?",4+32+256,"Confirmare") = 6
					*!*	modificare	v 2.0.35	:	am adaugat ocomanda.id_ordl
					*!*	modificare	v 2.0.41	:	am adaugat ocomanda.id_lucrare
					If This.do_storneaza_avans(lnIncasat,ocomanda.nrord,0,ALLTRIM(STR(ocomanda.id_ordl)),ALLTRIM(STR(ocomanda.id_lucrare)))
						pnAvans = 0
					Else
						Return
					Endif
				Endif
			Endif
			*!*	modificare	v 2.0.35 : IIF(ocomanda.proc_tvav=1,1,gnCotaTVAStandard) in loc de pack_contafin.getCotaTVAStandard(?gnLuna,?gnAn)
			*!*	modificare	v 2.0.52 : am pus round(pack_sesiune.calculeaza_...) pentru ca pot avea nr. zecimale diferit la calcularea pretului fata de nr. zecimale pentru totaluri
			lcSql = [select denumire,um,cant,pret,dataact,id_rul,pretv,]	+	;
				[round(pack_sesiune.calculeaza_pret_tva(totalctva,1,0,] + ALLTRIM(STR(IIF(ocomanda.proc_tvav=1,1,gnCotaTVAStandard),10,4)) + [,1,2),?gnPPretV) as totaltva,] + ;
				[round(pack_sesiune.calculeaza_pret_fara_tva(totalctva,1,0,] + ALLTRIM(STR(IIF(ocomanda.proc_tvav=1,1,gnCotaTVAStandard),10,4)) + [,1,2),?gnPPretV) as totalftva,] + ;
				[totalctva from (] + ;
				[select b.denumire, b.um, a.cante as cant, a.pretv, a.pret, a.dataact, a.id_rul,SUM(ROUND(a.pret*a.cante,?gnPc)) over (order by a.id_lucrare) as totalctva ] + ;
				[ from (] + ;
				[select id_articol,id_lucrare,pretv,] + ;
				[pack_sesiune.calculeaza_pret_cu_tva(pretv,1,pack_def.GetIdMonedaNationala(),] + ;
				ALLTRIM(STR(IIF(ocomanda.proc_tvav=1,1,gnCotaTVAStandard),10,4)) + [,0,2) as pret,] + ;
				[SUM(cante) as cante,MIN(dataact) as dataact,MIN(id_rul) as id_rul ] + ;
				[from ] + gcS + [.rul where sters = 0 and id_lucrare = ] + Alltrim(Str(ocomanda.id_lucrare)) + [ ] + ;
				[group by id_lucrare,id_articol,pretv) a ] + ;
				[left join nom_articole b on a.id_articol = b.id_articol where a.cante <> 0) ] + ;
				[order by dataact,id_rul]
			lnSucces = goExecutor.oExecute(lcSql,'crsBonDetaliat')
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,16,'Eroare')
				Return
			Endif
		Endif
		*!*	modificare v 2.0.21	^
		
		*!*	modificare	v 2.0.28
		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
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		Endif
		*!*	modificare	v 2.0.28	^
		
		Thisform.MousePointer=11
		Thisform.LockScreen=.T.
		
		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.
		*!*	lnNumarFactura = aloca_numar_fact()
		*!*	taValori[5,1]="poAct.nract"
		*!*	taValori[5,2]=Alltrim(Str(lnNumarFactura))
		*!*	taValori[5,3]=.F.
		
		*!*	modificare	v 2.0.28
		*!*	If !Isnull(gnid_fdoc_factura)
		If (!Empty(Nvl(ocomanda.asigurator,[])) And !Empty(Nvl(gnid_fdoc_factasig,0))) Or ;
				(Empty(Nvl(ocomanda.asigurator,[])) And !Empty(Nvl(gnid_fdoc_fact,0)))
			*!*	modificare	v 2.0.28	^
			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(ocomanda.asigurator,[])),Alltrim(Str(gnid_fdoc_factasig)),Alltrim(Str(gnid_fdoc_fact)))
			*!*	modificare	v 2.0.28	^
			taValori[lnLungime+1,3]=.T.
			taValori[lnLungime+2,1]="poAct.fdoc"
			taValori[lnLungime+2,2]='FACTURA'+Iif(!Empty(Nvl(ocomanda.asigurator,[])),' ASIGURATOR','')	&&	modificare	v 2.0.28
			taValori[lnLungime+2,3]=.T.
			lnLungime=lnLungime+2
		Endif
		
		Thisform.MousePointer=0
		Thisform.LockScreen=.F.
		
		Thisform.AlwaysOnTop=.F.
		lans(31011,.F.,.T.,@taValori)	&&   id_set,daca se executa procedura de mai multe ori,
		&& daca verifica analiticele,array de valori
		Thisform.AlwaysOnTop=.T.
		
		If buton=2
			*!*		Do deschid_actc
			*!*		Do dezaloca_numar_fact In oserii_numere.prg
			poGeneratorNumere.dezaloca_numere()
			Use In Select('crsBonDetaliat')
			Return
		Endif
		
		*!*	SELECT actactan
		*!*	GO TOP
		*!*	lnNumarFacturaAct = nract
		*!*	IF lnNumarFacturaAct <> lnNumarFactura
		*!*		DO dezaloca_numar_fact In oserii_numere.prg
		*!*	ENDIF
		
		*!*	If Used('v_nom_casa')
		*!*		Use In v_nom_casa
		*!*	Endif
		*!*	lcSql=[select id_part,nume from ] + gcS + [.vnom_casa_lei]
		*!*	lnSucces=goExecutor.oExecute(lcSql,'v_nom_casa')
		*!*	If lnSucces < 0
		*!*		amessagebox(goExecutor.cEroare,0+16,'Eroare')
		*!*	Endif
		
		*!*	modificare	v 2.1.0 : am adaugat pnTotalFactura
		Private pnDiscountM,pnDiscountN,pnDiscountTvaM,pnDiscountTvaN,pnNrChit,pnIdCasa,pcCasa,pnIncasat,pcSerieChit,pnTotalFactura, pnPOS
		Store 0 To pnDiscountM,pnDiscountN,pnDiscountTvaM,pnDiscountTvaN,pnNrChit,pnIdCasa,pnIncasat, pnTotalFactura, pnPOS
		STORE [] TO pcSerieChit, pcCasa	&&	modificare	v 2.0.28
		
		Thisform.LockScreen=.F.
		Thisform.MousePointer=0
		
		** modificare 31.05
		*!*	modificare	v 2.0.4
		*!*	lcSql=[select acont,NVL(sum(ROUND(PRETV*cante,?gnPc)),0) as pret,id_sectie,sectie from ] + gcS + [.vrul ]+;
		*!*		[where id_lucrare = ] + Alltrim(Str(ocomanda.id_lucrare)) + [ group by acont,sectie,id_sectie]
		*!*	modificare	v 2.0.22
		If glAutoBonDet
			*!*	modificare	v 2.0.35	:	am pus IIF(ocomanda.proc_tvav=1,1,gnCotaTVAStandard) in loc de pack_contafin.getCotaTVAStandard(?gnLuna,?gnAn)
			lcSql=[select a.acont,NVL(sum(ROUND(PACK_SESIUNE.SUMA_RON(A.PRETV, A.AN, A.LUNA, 3)*a.cante,?gnPc)),0) as pret,] + ;
				[NVL(sum(ROUND(pack_sesiune.calculeaza_pret_tva(PACK_SESIUNE.SUMA_RON(A.PRETV, A.AN, A.LUNA, 3),1,pack_def.GetIdMonedaNationala(),] + ;
				ALLTRIM(STR(IIF(ocomanda.proc_tvav=1,1,gnCotaTVAStandard),10,4)) + [,0,2)*a.cante,?gnPc)),0) as tva,] + ;
				[a.id_sectie,b.sectie from ] + gcS + [.rul a ]+;
				[left join ] + gcS + [.nom_sectii b on a.id_sectie = b.id_sectie ] + ;
				[where a.sters = 0 and a.id_lucrare = ] + Alltrim(Str(ocomanda.id_lucrare)) + [ group by a.acont,b.sectie,a.id_sectie]
		Else
			lcSql=[select a.acont,NVL(sum(ROUND(PACK_SESIUNE.SUMA_RON(A.PRETV, A.AN, A.LUNA, 3)*a.cante,?gnPc)),0) as pret,0 as tva,a.id_sectie,b.sectie from ] + gcS + [.rul a ]+;
				[left join ] + gcS + [.nom_sectii b on a.id_sectie = b.id_sectie ] + ;
				[where a.sters = 0 and a.id_lucrare = ] + Alltrim(Str(ocomanda.id_lucrare)) + [ group by a.acont,b.sectie,a.id_sectie]
		Endif
		*!*	modificare	v 2.0.22	^
		*!*	modificare	v 2.0.4	^
		lnSucces=goExecutor.oExecute(lcSql,'crsMater')
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		Endif
		
		Select crsMater
		*!*	modificare	v 2.0.22
		*!*	CALCULATE SUM(pret) TO ocomanda.materiale
		Calculate Sum(Pret),Sum(tva) To ocomanda.materiale,lnTVAMateriale
		*!*	modificare	v 2.0.41
		*!*	AddProperty(ocomanda,"bondiftva",0)
		*!*	AddProperty(ocomanda,"bondifftva",0)
		*!*	If Used('crsBonDetaliat')
		*!*		Select crsBonDetaliat
		*!*		ocomanda.bondiftva = totaltva - lnTVAMateriale
		*!*		ocomanda.bondifftva = totalftva - ocomanda.materiale
		*!*	Endif
		*!*	modificare	v 2.0.41	^
		*!*	modificare	v 2.0.22	^
		
		lcSql=[select id_sectie,NVL(sum(ROUND(timpn * pret,?gnPc)),0) as pret,'' as analitic,id_sectie,sectie from ] + gcS + [.auto_voper where id_ordl = ] + ;
			Alltrim(Str(ocomanda.id_ordl)) + [ group by id_sectie,sectie]
		lnSucces=goExecutor.oExecute(lcSql,'crsManop')
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		Endif
		
		Select crsManop
		Calculate Sum(Pret) To ocomanda.manopera
		***
		
		*!*	modificare JC/JV 2007
		pnIdJtvaColoana = GetIdJtvaStandard("VANZARE")
		loTVAColoana = GeJtvaColoana(pnIdJtvaColoana)
		pnIdTva = NVL(loTVAColoana.id_tva,0)
		pnProcTva = 1 + ROUND(loTVAColoana.cota_tva/100,2)
		*!*	modificare JC/JV 2007	^
		
		*!*	modificare	v 2.0.41
		*!*	*!*	modificare	v 2.0.22
		*!*	lnTVAMateriale = Iif(glAutoBonDet,lnTVAMateriale,Round(ocomanda.materiale*(pnProcTva-1),gnPa))
		*!*	*!*	modificare	v 2.0.22	^
		AddProperty(ocomanda,"materialerecalc",ocomanda.materiale)
		If glAutoBonDet
			Select crsBonDetaliat
			lnTotalCTVAMateriale = totalctva
			ocomanda.materialerecalc = Round(lnTotalCTVAMateriale/pnProcTva,gnPc)
			lnTVAMateriale = lnTotalCTVAMateriale - ocomanda.materialerecalc
		Else
			lnTVAMateriale = Round(ocomanda.materiale*(pnProcTva-1),gnPc)
		Endif
		*!*	modificare	v 2.0.41	^
		
		*!*	modificare	v 2.1.0
		local lnTvaIncasare, lcContTVA
		Select actactan
		Calculate Max(tva_incasare) To lnTvaIncasare
		if lnTvaIncasare = 1
			pnIdJtvaColoana = getIdJtvaColoana(pnIdJtvaColoana,1)
			pnIdTva = getIdTva(pnIdTva,1)
			lcContTVA = [4428]
		else
			lcContTVA = [4427]
		ENDIF
		
		
		*!*	modificare	v 2.1.0	^
		*!*	modificare	v 2.0.28
		Create Cursor crsalteserv(id_articol N(14) Not Null,denumire c(100) Not Null,codmat c(50) Null,um c(10) Null,;
			id_lucrare N(14) Not Null,nrord c(100) Not Null,;
			cantitate N(14,gnPCant) Default 1,pretftva N(14,gnPPretV) Default 0,valoareftva N(14,gnPc) Default 0)
		*!*	modificare	v 2.0.28	^
		pniesire=1
		*!*	modificare	v 2.0.33 : am adaugat pnAchitAsigurator si parametrul 4 > daca e factura cu asigurator, atunci poate fi achitata de asig.
		pnAchitAsigurator = 0
		*!*	modificare	v 2.0.41
		*!*	ofrmincasare=Createobject('frm_incasare_finala',lnTVAMateriale,ocomanda.bondifftva,ocomanda.bondiftva,!Empty(Nvl(ocomanda.asigurator,[])))
		
		LOCAL lnProcDiscountManopera, lnProcDiscountMateriale, lnIdCtr
		lnProcDiscountManopera = 0
		lnProcDiscountMateriale = 0
		lnIdCtr = 0
		citeste_discount_contract(ocomanda.id_partener, @lnIdCtr, @lnProcDiscountManopera, @lnProcDiscountMateriale)
		
		ofrmincasare=Createobject('frm_incasare_finala',lnTvaIncasare,lnTVAMateriale,!Empty(Nvl(ocomanda.asigurator,[])))
		*!*	modificare	v 2.0.41	^
		*!*	modificare	v 2.0.33	^
		With ofrmincasare
			.clb_manopera.text_simplu1.Value=Round(ocomanda.manopera,gnPc)
			.clb_tvam.text_simplu1.Value=Round(ocomanda.manopera*(pnProcTva-1),gnPc)
			*!*	modificare	v 2.0.41
			*!*		.clb_materiale.text_simplu1.Value=Round(ocomanda.materiale,gnPa)+ocomanda.bondifftva
			*!*		*!*	modificare	v 2.0.22
			*!*		*!*		.clb_tvan.text_simplu1.Value=Round(ocomanda.materiale*(pnProcTva-1),gnPa)
			*!*		.clb_tvan.text_simplu1.Value = lnTVAMateriale + ocomanda.bondiftva
			*!*		*!*	modificare	v 2.0.22	^
			.clb_materiale.text_simplu1.Value=Round(ocomanda.materialerecalc,gnPc)
			.clb_tvan.text_simplu1.Value = lnTVAMateriale
			*!*	modificare	v 2.0.41	^	
			.clb_avans.text_simplu1.Value=pnAvans
			.navansfaratva = pnAvansFTva	&&	modificare	v 2.0.52
		
			IF NVL(ocomanda.manopera, 0) <> 0
				.clb_procdiscm.text_simplu1.value = m.lnProcDiscountManopera
			ENDIF 
			IF NVL(ocomanda.materialerecalc, 0) <> 0
				.clb_procdiscn.text_simplu1.value = m.lnProcDiscountMateriale
			ENDIF 		
		Endwith
		ofrmincasare.calculeaza_total()
		ofrmincasare.Show(1)
		Use In v_nom_casa
		Release ofrmincasare
		
		If pniesire!=1
			*!*		dezaloca_numar_bf()		&&	oserii_numere.prg
			*!*		Do dezaloca_numar_fact In oserii_numere.prg
			poGeneratorNumere.dezaloca_numere()
			Use In Select('crsBonDetaliat')
			Use In Select('crsalteserv')	&&	modificare	v 2.0.28
			Return
		Endif
		
		SELECT actactan
		GO TOP 
		ldDataAct = dataact
		pnTaxCode = GetTaxCodeIdPart(m.gnAn, m.gnLuna, m.ldDataAct, m.pnIdJtvaColoana, ocomanda.id_partener)
		
		*!*	modificare	v 2.0.3
		Local lcExplicatia5
		lcExplicatia5 = Alltrim(Nvl(ocomanda.inspector,''))+[;]+Alltrim(Nvl(ocomanda.nr_dosar,''))
		*!*	modificare	v 2.0.3	^
		
		*!*	modificare v 2.0.6 : am concatenat explicatia5
		Select actactan
		Go Top
		Scatter Name oactan
		Replace explicatia With 'MATERIALE',suma With Nvl(ocomanda.materiale,0),explicatia4 With ocomanda.asigurator,explicatia5 With Alltrim(Nvl(explicatia5,''))+[;]+lcExplicatia5,proc_tva With pnProcTva,id_jtva_coloana With pnIdJtvaColoana, taxcode WITH m.pnTaxCode For Alltrim(scc)='707'
		*!*	modificare	v 2.0.22 : am modificat suma din Round(ocomanda.materiale*(pnProcTva-1),gnPc) in lnTVAMateriale
		*!*	modificare	v 2.0.35 : am modificat suma din lnTVAMateriale in IIF(pnProcTva=1,0,lnTvaMateriale)
		Replace explicatia With 'TVA MATERIALE',suma With IIF(pnProcTva=1,0,lnTvaMateriale),explicatia4 With ocomanda.asigurator,;
			explicatia5 With Alltrim(Nvl(explicatia5,''))+[;]+lcExplicatia5,proc_tva With pnProcTva,id_jtva_coloana With pnIdTva, taxcode WITH m.pnTaxCode For nr_nota=2
		
		Replace explicatia With 'MANOPERA',suma With Nvl(ocomanda.manopera,0),explicatia4 With ocomanda.asigurator,;
			explicatia5 With Alltrim(Nvl(explicatia5,''))+[;]+lcExplicatia5,proc_tva With pnProcTva,id_jtva_coloana With pnIdJtvaColoana, taxcode WITH m.pnTaxCode For Alltrim(scc)='704'
			
		Replace explicatia With 'TVA MANOPERA',suma With Round(ocomanda.manopera*(pnProcTva-1),gnPc),explicatia4 With ocomanda.asigurator,;
			explicatia5 With Alltrim(Nvl(explicatia5,''))+[;]+lcExplicatia5,proc_tva With pnProcTva,id_jtva_coloana With pnIdTva, taxcode WITH m.pnTaxCode For nr_nota=4
			
		Replace explicatia With 'PRODUCTIE TERMINATA',suma With ocomanda.materiale,explicatia4 With ocomanda.asigurator,;
			explicatia5 With Alltrim(Nvl(explicatia5,''))+[;]+lcExplicatia5,datascad With {},proc_tva With 0,id_jtva_coloana With Null, taxcode WITH null For Alltrim(scd)='711' And Alltrim(scc)='332'
		
		Note----------modificare pentru analitice variabilele pentru analitice deocamdata nu le citesc din tabela;
			le initializez pur si simplu din cod pana imi dau seama cum ar trebui sa fie initializarea analiticelor
		**----manopera
		Select * From actactan Into Cursor actactan_vechi Readwrite
		
		Select actactan
		Locate For nr_nota = 3
		Scatter Name oactan
		Delete
		
		Select crsManop
		Scan
			Select actactan
			Insert Into actactan (suma,id_sectie,sectie) Values (crsManop.Pret,crsManop.id_sectie,crsManop.sectie)
			Gather Name oactan Fields Except suma,id_sectie,sectie
			Select crsManop
		Endscan
		
		*!*	modificare	v 2.0.28
		If Reccount('crsalteserv') > 0
			Select crsalteserv
			Calculate Sum(valoareftva) To lnSumaAlteServFTva
			Select actactan
			Insert Into actactan(suma,scc,explicatia) Values (lnSumaAlteServFTva,gcDevContAltele,'ALTELE')
			Gather Name oactan Fields Except suma,scc,explicatia
		Endif
		*!*	modificare	v 2.0.28	^
		
		Select actactan
		Locate For nr_nota = 4
		Scatter Name oactan
		Delete
		
		*!*	modificare 08.07
		*!*		Select crsManop
		*!*		Scan
		*!*			Select actactan
		*!*			Insert Into actactan (suma,id_sectie,sectie) Values (ROUND(crsManop.Pret*(pnctva-1),gnPc),crsManop.id_sectie,crsManop.sectie)
		*!*			Gather Name oactan Fields Except suma,id_sectie,sectie
		*!*			Select crsManop
		*!*		Endscan
		
		Select crsManop
		lnTotalManop=0
		Calculate Sum(Pret) To lnTotalManop
		Go Top
		If Reccount('crsManop')>0	&& lnTotalManop!=0 AND
			Select actactan
			Insert Into actactan (suma,id_sectie,sectie) Values (Round(lnTotalManop*(pnProcTva-1),gnPc),crsManop.id_sectie,crsManop.sectie)
			Gather Name oactan Fields Except suma,id_sectie,sectie
			Select crsManop
		Endif
		*!* modificare 08.07 ^
		
		*!*	modificare	v 2.0.28
		If Reccount('crsalteserv') > 0
			Select crsalteserv
			Calculate Sum(Round(valoareftva*(pnProcTva-1),gnPc)) To lnSumaAlteServTva
			Select actactan
			Insert Into actactan(suma,explicatia) Values (lnSumaAlteServTva,'TVA ALTELE')
			Gather Name oactan Fields Except suma,explicatia
		Endif
		*!*	modificare	v 2.0.28	^
		
		**----manopera
		
		*---materiale
		*!*		lcSql=[select acont,NVL(sum(ROUND(pretv*cante,?gnPc)),0) as pret,id_sectie,sectie from ] + gcS + [.vrul ]+;
		*!*			[where id_lucrare = ] + Alltrim(Str(ocomanda.id_lucrare)) + [ group by acont,sectie,id_sectie]
		*!*		lnSucces=goExecutor.oExecute(lcSql,'crsMater')
		*!*		If lnSucces < 0
		*!*			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		*!*		Endif
		
		Select actactan
		Locate For nr_nota = 1
		Scatter Name oactan
		Delete
		
		Select crsMater
		Scan
			Select actactan
			Insert Into actactan (suma,id_sectie,sectie) Values (crsMater.Pret,crsMater.id_sectie,crsMater.sectie)
			Gather Name oactan Fields Except suma,id_sectie,sectie
			Select crsMater
		Endscan
		
		Select actactan
		Locate For nr_nota = 2
		Scatter Name oactan
		Delete
		
		*!*	modificare	v 2.0.41
		*!*	*!* modificare 08.07
		*!*	*!*		Select crsMater
		*!*	*!*		Scan
		*!*	*!*			Select actactan
		*!*	*!*			Insert Into actactan (suma,id_sectie,sectie) Values (ROUND(crsMater.Pret*(pnctva-1),gnPc),crsMater.id_sectie,crsMater.sectie)
		*!*	*!*			Gather Name oactan Fields Except suma,id_sectie,sectie
		*!*	*!*			Select crsMater
		*!*	*!*		Endscan
		*!*	Select crsMater
		*!*	lnTotalMater=0
		*!*	Calculate Sum(Pret) To lnTotalMater
		*!*	Go Top
		*!*	If Reccount('crsMater')>0	&&	lnTotalMater!=0
		*!*		Select actactan
		*!*		*!*	modificare	v 2.0.22
		*!*	*!*	modificare	v 2.0.35 : am modificat suma din lnTVAMateriale in IIF(pnProcTva=1,0,lnTvaMateriale)
		*!*		Insert Into actactan (suma,id_sectie,sectie) Values (IIF(pnProcTva=1,0,lnTvaMateriale),crsMater.id_sectie,crsMater.sectie)
		*!*		*!*		Insert Into actactan (suma,id_sectie,sectie) Values (Round(lnTotalMater*(pnProcTva-1),gnPc),crsMater.id_sectie,crsMater.sectie)
		*!*		*!*	modificare	v 2.0.22	^
		*!*		Gather Name oactan Fields Except suma,id_sectie,sectie
		*!*		Select crsMater
		*!*	Endif
		*!*	*!* modificare 08.07 ^
		*!*	*!*	modificare	v 2.0.22
		*!*	If pnProcTva = 1
		*!*		ocomanda.bondiftva = 0
		*!*		ocomanda.bondifftva = 0
		*!*		If Used('crsBonDetaliat')
		*!*			Select crsBonDetaliat
		*!*			Replace Pret With pretv All
		*!*		Endif
		*!*	Endif
		*!*	If ocomanda.bondifftva <> 0
		*!*		Select actactan
		*!*		Locate For nr_nota = 1
		*!*		Scatter Name oactan
		*!*		Insert Into actactan(suma,explicatia) Values(ocomanda.bondifftva,"MATERIALE ROTUNJIRE BON")
		*!*		Gather Name oactan Fields Except suma,explicatia
		*!*	Endif
		*!*	If ocomanda.bondiftva <> 0
		*!*		Select actactan
		*!*		Locate For nr_nota = 2
		*!*		Scatter Name oactan
		*!*		Insert Into actactan(suma,explicatia) Values(ocomanda.bondiftva,"TVA MATERIALE ROTUNJIRE BON")
		*!*		Gather Name oactan Fields Except suma,explicatia
		*!*	Endif
		*!*	*!*	modificare	v 2.0.22	^
		Select crsMater
		lnTotalMater = 0
		Calculate Sum(Pret) To lnTotalMater
		Go Top
		If Reccount('crsMater')>0
			Select actactan
			Insert Into actactan (suma,id_sectie,sectie) Values (ROUND(lnTotalMater*(pnProcTva-1),gnPc),crsMater.id_sectie,crsMater.sectie)
			Gather Name oactan Fields Except suma,id_sectie,sectie
		ENDIF
		
		If pnProcTva = 1
			If Used('crsBonDetaliat')
				Select crsBonDetaliat
				Replace Pret With pretv All
			Endif
		Else
			If ocomanda.materialerecalc <> lnTotalMater
				Select actactan
				Locate For nr_nota = 1
				Scatter Name oactan
				Insert Into actactan(suma,explicatia) Values(ocomanda.materialerecalc-lnTotalMater,"MATERIALE ROTUNJIRE BON")
				Gather Name oactan Fields Except suma,explicatia
			Endif
			If lnTVAMateriale <> ROUND(lnTotalMater*(pnProcTva-1),gnPc)
				Select actactan
				Locate For nr_nota = 2
				Scatter Name oactan
				Insert Into actactan(suma,explicatia) Values(lnTVAMateriale-ROUND(lnTotalMater*(pnProcTva-1),gnPc),"TVA MATERIALE ROTUNJIRE BON")
				Gather Name oactan Fields Except suma,explicatia
			Endif
		Endif
		*!*	modificare	v 2.0.41	^
		
		Select crsMater
		Calculate Sum(Pret) To lnSumaMateriale
		Select actactan
		Replace suma With lnSumaMateriale For Alltrim(scd)='711' And Alltrim(scc)='332'
		*---materiale
		*!*		modificare 1.09
		*!*		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
		*-------------
		
		Local lcAscc,lcAscd
		Select actactan
		If pnDiscountN<>0
			Select actactan
			Locate For Alltrim(scd) = '4111' And Alltrim(scc) = '707' && (modificare 1.09) AND !EMPTY(ascd)
			If Found()
				lcAscd = actactan.ascd
				lcAscc = actactan.ascc
				lcAscdTva = actactan.ascd
				lnIdPartD = actactan.id_partd
				lcPartD = actactan.partd
				lnIdPartC = actactan.id_partc
				lcPartC = actactan.partc
				lnId_Sectie = actactan.id_sectie
				lcSectie = actactan.sectie
			Else
				lcAscd = ''
				lcAscc = ''
				lcAscdTva = ''
				lnIdPartD = 0
				lcPartD = ''
				lnIdPartC = 0
				lcPartC = ''
				lnId_Sectie = 0
				lcSectie = ''
			Endif
			*!*	modificare	v 2.0.41
			*!*	lnProcDiscN=Round(pnDiscountN*100/ocomanda.materiale,2)
			lnProcDiscN=Round(pnDiscountN*100/ocomanda.materialerecalc,2)
			*!*	modificare	v 2.0.41	^
			If gnDiscount411=1		&& discount 411
				lcscd='4111'
				lcscc='707'
				pnDiscountN=-pnDiscountN
			Else				&& discount 667
				lcscd='667'
				lcscc='4111'
				lcAscdTva = lcAscd
				lcAscc = lcAscd
				lcAscd = ""
				lnIdPartC = lnIdPartD
				lcPartC = lcPartD
				lnIdPartD = 0
				lcPartD = ''
			Endif
			Append Blank
			Gather Name oactan
			Replace explicatia With 'DISCOUNT MATERIALE '+Alltrim(Str(lnProcDiscN,6,2))+'%',nr_nota With Recno(), suma With pnDiscountN
			Replace scd With lcscd,partd With lcPartD,partc With lcPartC,id_partd With lnIdPartD,id_partc With lnIdPartC
			Replace ascd With lcAscd
			Replace scc With lcscc
			Replace ascc With lcAscc	&&	,datascad With {}	modificare	v 2.0.28
			Replace sectie With lcSectie,id_sectie With lnId_Sectie,id_jtva_coloana With pnIdJtvaColoana, taxcode WITH m.pnTaxCode
			Append Blank
			Gather Name oactan
			Replace explicatia With 'DISCOUNT MATERIALE '+Alltrim(Str(lnProcDiscN,6,2))+'%',nr_nota With Recno(),suma With -pnDiscountTvaN
			Replace scd With '4111'
			Replace ascd With lcAscdTva, scc With lcContTVA, ascc With ''	&&	, datascad With {}	modificare	v 2.0.28
			Replace sectie With lcSectie,id_sectie With lnId_Sectie,id_jtva_coloana With pnIdTva, taxcode WITH m.pnTaxCode
		Endif
		
		If pnDiscountM<>0
			Select actactan
			Locate For Alltrim(scd) = '4111' And Alltrim(scc) = '704' && (modificare 1.09) AND !EMPTY(ascd)
			If Found()
				lcAscd = actactan.ascd
				lcAscc = actactan.ascc
				lcAscdTva = actactan.ascd
				lnIdPartD = actactan.id_partd
				lcPartD = actactan.partd
				lnIdPartC = actactan.id_partc
				lcPartC = actactan.partc
				lnId_Sectie = actactan.id_sectie
				lcSectie = actactan.sectie
			Else
				lcAscd = ''
				lcAscc = ''
				lcAscdTva = ''
				lnIdPartD = 0
				lcPartD = ''
				lnIdPartC = 0
				lcPartC = ''
				lnId_Sectie = 0
				lcSectie = ''
			Endif
			lnProcDiscM=Round(pnDiscountM*100/ocomanda.manopera,2)
			If gnDiscount411=1		&& discount 411
				lcscd='4111'
				lcscc='704'
				pnDiscountM=-pnDiscountM
			Else				&& discount 667
				lcscd='667'
				lcscc='4111'
				lcAscdTva = lcAscd
				lcAscc = lcAscd
				lcAscd = ""
				lnIdPartC = lnIdPartD
				lcPartC = lcPartD
				lnIdPartD = 0
				lcPartD = ''
			Endif
			Append Blank
			Gather Name oactan
			Replace explicatia With 'DISCOUNT MANOPERA '+Alltrim(Str(lnProcDiscM,6,2))+'%',nr_nota With Recno(), suma With pnDiscountM
			Replace scd With lcscd,partd With lcPartD,partc With lcPartC,id_partd With lnIdPartD,id_partc With lnIdPartC
			Replace ascd With lcAscd , scc With lcscc
			Replace ascc With lcAscc	&&	,datascad With {}	modificare	v 2.0.28
			Replace sectie With lcSectie,id_sectie With lnId_Sectie,id_jtva_coloana With pnIdJtvaColoana, taxcode WITH m.pnTaxCode
			Append Blank
			Gather Name oactan
			Replace explicatia With 'DISCOUNT MANOPERA '+Alltrim(Str(lnProcDiscM,6,2))+'%',nr_nota With Recno(),suma With -pnDiscountTvaM
			Replace scd With '4111', ascd With lcAscdTva, scc With lcContTVA, ascc With ''	&&	, datascad With {}	modificare	v 2.0.28
			Replace sectie With lcSectie,id_sectie With lnId_Sectie,id_jtva_coloana With pnIdTva, taxcode WITH m.pnTaxCode
		Endif
		
		*!*		modificare 1.09
		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
		
		If pnAvans > 0
			*!*	*!*			IF avans_419	&& avans 419
			*!*			If gnAvans419=1
			*!*				lcscc='419'
			*!*			Else			&& avans 707
			*!*				lcscc='707'
			*!*			Endif
		
			Select crsavansuri_complet
			Scan
				Scatter Name oavans
				Select actactan
				Append Blank
				Gather Name oactan Fields Except scc,scd,ascc,ascd,avans,id_partc,id_partd,id_sectie,partd,partc,incasat
				Replace explicatia With 'STORNARE AVANS',nr_nota With Recno(), suma With -oavans.avans	&&	,datascad With {}	modificare	v 2.0.28
				Gather Name oavans Fields scd,ascd,scc,ascc,id_partc,id_sectie,sectie,id_partd,partc,partd,id_jtva_coloana, proc_tva
				Select crsavansuri_complet
			Endscan
			*!*			Append Blank
			*!*			Gather Name oactan
			*!*			Replace explicatia With 'STORNARE AVANS',nr_nota With Recno(), suma With -pnAvans
			*!*			Replace scd With '411', ascd With '', scc With lcscc, ascc With '',datascad With {}
			*!*			REPLACE id_partc WITH id_partd
			*!*			REPLACE partc WITH partd
		Endif
		
		If pnTipIncasare>1
			*!*		If !Empty(pnNrChit)	&&	modificare 22.02.2006
			*!*	*!* incasare = 5311
		
			Select actactan
			Locate For Alltrim(scd) = '4111' And !Empty(ascd) && And Alltrim(scc) = '707'
			If Found()
				lcAscd = actactan.ascd
				lnId_Sectie = actactan.id_sectie
				lcSectie = actactan.sectie
			Else
				lcAscd = ''
				lnId_Sectie = 0
				lcSectie = ''
			Endif
			Select actactan
			Append Blank
			*!*	modificare	v 2.0.28 : pcSerieChit
			Gather Name oactan Fields Except id_jtva_coloana,proc_tva, taxcode 	&& Fields Except suma, ascc, scc, id_partc
			Replace nr_nota With Recno(), partc With partd, id_partc With id_partd, suma With pnIncasat,serie_Act With Null
			Replace scc With '4111', ascc With lcAscd, scd With '5311', ascd With '', perecheC With nract,nract With pnNrChit,serie_act WITH pcSerieChit
			Replace id_partd With pnIdCasa, partd WITH pcCasa, neimpozab With 0, explicatia With 'INCASARE', id_factd With id_fact, datascad With {}
			Replace sectie With lcSectie,id_sectie With lnId_Sectie
			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 round(round(pnIncasat/pnTotalFactura,2)*lnTotalTvaNeex,gnPc),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
						Replace suma with round(oincasare.suma*(otva.proc_tva-1)/otva.proc_tva,gnPc),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	^
			*** bon fiscal incasat cu CARD POS
		
			*** inlocuiesc nota 5311 = 4111.client cu 5113.client = 4111.client
			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 
			
			UPDATE actactan SET PAYMENTCODE = '42', PAYMENTNAME = 'Plata in contul bancar' WHERE LEFT(scd, 3) = '512'
			UPDATE actactan SET PAYMENTCODE = '10', PAYMENTNAME = 'Numerar' WHERE LEFT(scd, 3) = '531'	
			UPDATE actactan SET TAXCODE = NULL, TAXNAME = '' WHERE INLIST(LEFT(scd, 3), '531', '512')
		
			
		ENDIF && pnTipIncasare>1
		
		*!*	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)
		*!*	Release ofrmdelegat
		
		*!*	modificare	v 2.0.33
		IF pnAchitAsigurator = 1
			SELECT actactan
			replace id_partd WITH ocomanda.id_part_asig,partd WITH ocomanda.asigurator FOR id_partd = ocomanda.id_partener
			replace id_partc WITH ocomanda.id_part_asig,partc WITH ocomanda.asigurator for id_partc = ocomanda.id_partener
		ENDIF
		*!*	modificare	v 2.0.33	^
		
		Private buton
		buton=1
		Select actactan
		Replace All tva_incasare With lnTvaIncasare	&&	modificare	v 2.1.0
		* Sterg liniile cu 0 doar daca am inregistrari cu suma <> 0, altfel nu gasesc inregistrari 411 = xxx la salvarea facturii si da eroare
		LOCATE FOR suma <> 0
		IF FOUND()
			Delete For suma = 0
		ENDIF 	
		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
			*!*		dezaloca_numar_bf()		&&	oserii_numere.prg
			*!*		Do dezaloca_numar_fact In oserii_numere.prg
			poGeneratorNumere.dezaloca_numere()
			Use In actactan
			Use In Select('crsBonDetaliat')
			Use In Select('crsalteserv')	&&	modificare	v 2.0.28
			Return
		Endif
		
		Select actactan
		*!*	modificare	v 2.1.0
		*!*	Replace All id_fact With -1
		Replace id_fact With -1 for id_fact <> -5
		*!*	modificare	v 2.1.0	^
		*!*	lnSucces = oscrie_in_fisiere()						&&	modificare	v 2.0.28
		Use In crsavansuri_complet
		
		*!*	modificare	v 2.0.28
		*!*	If lnSucces>0
		*!*		lcSql = [begin pack_devize.dev_completeaza_rul(?gcS,?ocomanda.id_lucrare); end;]
		*!*		lnSucces = goExecutor.oExecute(lcSql)
		*!*		If lnSucces < 0
		*!*			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		*!*			Use In Select('crsBonDetaliat')
		*!*			Return
		*!*		Endif
		*!*	modificare	v 2.0.28	^
		Thisform.AlwaysOnTop = .F.
		If Empty(pnDiscountN)
			Store 0 To lnProcDiscN,pnDiscountN,pnDiscountTvaN
		Endif
		If Empty(pnDiscountM)
			Store 0 To lnProcDiscM,pnDiscountM,pnDiscountTvaM
		Endif
		*!*	modificare	v 2.0.28
		*!*		Do listare_FACTURA With ocomanda.id_partener,'actactan',ocomanda.nrord,ocomanda.nrinmat,1,lnProcDiscM ,lnProcDiscN,-pnDiscountM,-pnDiscountN,pnDiscountTvaM,pnDiscountTvaN,'MANOPERA',0 In oproceduri_listari
		*!*	modificare	v 2.0.35	: am adaugat ocomanda.id_ordl
		*!*	modificare	v 2.0.41	: am adaugat Alltrim(Str(ocomanda.id_lucrare))
		If !factureaza_deviz(ocomanda.id_lucrare,ocomanda.nrord,ocomanda.nrinmat,[],0,-pnDiscountM,-pnDiscountN,lnProcDiscM,lnProcDiscN,IIF(pnAchitAsigurator = 1,ocomanda.id_ordl,Null),ALLTRIM(STR(ocomanda.id_ordl)),Alltrim(Str(ocomanda.id_lucrare)))	&&	in oproceduri_devize.prg
			poGeneratorNumere.dezaloca_numere()
		ELSE
			Thisform.actualizeaza_grid1()
		Endif
		*!*	modificare	v 2.0.28	^
		
		Thisform.AlwaysOnTop = .T.
		*!*	Thisform.actualizeaza_grid1()	&&	modificare	v 2.0.28
		Select crscomenzi
		If Reccount('crscomenzi')>=lnPozitieCursor
			Go lnPozitieCursor
		Endif
		*!*	modificare	v 2.0.28
		*!*	Else
		*!*	*!*		dezaloca_numar_bf()		&&	oserii_numere.prg
		*!*	*!*		Do dezaloca_numar_fact In oserii_numere.prg
		*!*		poGeneratorNumere.dezaloca_numere()
		*!*	ENDIF
		*!*	modificare	v 2.0.21
		*!*	modificare	v 2.0.28	^
		Use In Select('crsBonDetaliat')
		*!*	modificare	v 2.0.21	^
		Use In Select('crsalteserv')	&&	modificare	v 2.0.28 
	ENDPROC

	PROCEDURE do_factureaza_final_part
		LPARAMETERS tcFiltru
		LOCAL lcFiltru
		Local ofrmincasare As 'frm_incasare_finala'
		Local lcNrOrdDif, lcSql, ldDataAct, lnIdLucrareDif, lnLungime, lnNrComenzi, lnProcDiscM, lnProcDiscN
		Local lnSucces, lnTotalCTVAMateriale, lnTotalManop, lnTotalManopTVA, lnTotalMater, lnTotalMaterTVA
		Local lnVerifMan, lnVerifManTva, lnVerifMat, lnVerifMatTva, loTVAColoana
		*:Global oTva, oactan, ocomanda, poActDate, poactan, taValori[1], x
		
		lcFiltru = IIF(EMPTY(m.tcFiltru), 'ales = 1', m.tcFiltru)
		
		*!* 12.06.2014
		*!* marius.mutu
		*!* selectie nume banca lei pentru plata bon fiscal numerar sau prin card
		*!* pnPOS = incasare bon fiscal numerar = 1; CARD POS = 1
		*!* inlocuiesc nota 5311 = 4111.client cu 5113.client = 4111.client
		*!* v_nom_casa: se alege casa sau banca lei (pentru incasare CARD)
		
		*!* 18.08.2015
		*!* marius.mutu
		*!* completare procent discount manopera, materiale din contract tip CLIENT AUTO
		
		*!*	27.01.2016
		*!* marius.mutu
		*!* stornare avans - se completeaza in actan cota tva din cursorul de avans in loc de cota tva de pe factura
		*!*	este posibil ca pe avans sa fie alta cota de TVA
		
		*!* 23.11.2017
		*!* marius.mutu
		*!* Sterg liniile cu 0 doar daca am inregistrari cu suma <> 0, altfel nu gasesc inregistrari 411 = xxx la salvarea facturii si da eroare
		
		*!* 12.04.2022
		*!* 2.4.24
		*!* se pot factura mai multe devize cu dosar asigurator pe o factura (ar trebui sa aiba acelasi asigurator si dosar, dar nu se verifica)
		*!* daca se bifeaza factura achitata de asigurator, in registrul jurnal clientul este asiguratorul, in loc de proprietar
		
		Private pniesire,pnAvansFTva,pnAvansTva,pnTipIncasare,pnIdTva,pnProcTva,pnIdJtvaColoana,pnAvans, pnTaxCode
		Private pcSirIdLucrare,pcSirIdOrdl,pcSirNrOrd,pnNrComenzi,pcSeparator
		Local lnIncasat,lnTVAMateriale, loLogCursoare
		loLogCursoare = Createobject("oLogCursoare")
		pcSirIdLucrare = []
		pcSirIdOrdl = []
		pcSirNrOrd = []
		pcSeparator = [,]
		&&	1 	- 	fara incasare
		&&	2	-	bon fiscal
		&&	3	-	chitanta pe factura
		pnTipIncasare=1
		optiuni_firma()							&&	reinitializare gnTip_LFactura
		Local lnPozitieCursor,lnIncasat
		Select crscomenzi
		Go Top
		*Locate For ales = 1
		LOCATE FOR &lcFiltru
		lnPozitieCursor=Recno()
		Scatter Name ocomanda
		&& optiuni cu analitice
		&& optiuni tip analitic
		Thisform.MousePointer=11
		Thisform.LockScreen=.T.
		
		*!*	modificare	v 2.0.35	:	l-am mutat dupa stornare avans pentru ca in frm_alte_date se inchide cursorul v_nom_casa
		*!*								si nu mi-l mai gaseste in do_factureaza_final_part
		*!*	If Used('v_nom_casa')
		*!*		Use In v_nom_casa
		*!*	Endif
		*!*	lcSql=[select id_part,nume from ] + gcS + [.vnom_casa_lei]
		*!*	lnSucces=goExecutor.oExecute(lcSql,'v_nom_casa')
		*!*	If lnSucces < 0
		*!*		amessagebox(goExecutor.cEroare,0+16,'Eroare')
		*!*	Endif
		*!*	modificare	v 2.0.35
		
		If Used('crsselectate')
			Use In crsselectate
		Endif
		
		Select * From crscomenzi With (Buffering = .T.) Where &lcFiltru And Validat = 1 Into Cursor crsselectate
		lnNrComenzi = Reccount('crsselectate')
		Select crsselectate
		Scan
			pcSirIdOrdl = pcSirIdOrdl + Alltrim(Str(id_ordl)) + pcSeparator
			pcSirIdLucrare = pcSirIdLucrare + Alltrim(Str(id_lucrare)) + pcSeparator
			pcSirNrOrd = pcSirNrOrd + Alltrim(nrord) + pcSeparator + [ ]
		Endscan
		pcSirNrOrd = Alltrim(pcSirNrOrd)
		pcSirIdOrdl = Substr(pcSirIdOrdl,1,Len(pcSirIdOrdl)-1)
		pcSirIdLucrare = Substr(pcSirIdLucrare,1,Len(pcSirIdLucrare)-1)
		pcSirNrOrd = Substr(pcSirNrOrd,1,Len(pcSirNrOrd)-1)
		
		Use In Select('crsavansuri_complet')
		
		*!*	modificare	v 2.0.21
		*!*	lcSql=[select a.*,b.nrord ] + ;
		*!*		[from ] + gcS + [.dev_vordl_avansuri a ] + ;
		*!*		[left join ] + gcS + [.vnom_lucrari b on a.id_lucrare = b.id_lucrare ] + ;
		*!*		[where a.id_partd = ] + Alltrim(Str(ocomanda.id_partener)) + [ ] + ;
		*!*		[and a.id_lucrare in (] + pcSirIdLucrare + [)]
		lcSql = [{call pack_auto.citeste_date_avans('] + Alltrim(pcSirIdLucrare) + [',',')}]
		*!*	modificare	v 2.0.21	^
		lnSucces = goExecutor.oExecute(lcSql,'crsavansuri_complet')
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
			Return
		Endif
		
		Use In Select('crsavansuri')
		
		*!*	modificare	v 2.0.21 : am adaugat incasat
		*!*	modificare	v 2.0.52 : am adaugat avansftva
		Select Sum(Nvl(avans,0.00)) As avans,Sum(Nvl(incasat,0.00)) As incasat,Sum(Nvl(avansftva,0.00)) As avansftva,;
			id_lucrare,nrord From crsavansuri_complet ;
			GROUP By id_lucrare,nrord Into Cursor crsavansuri
		
		Thisform.LockScreen=.F.
		Thisform.MousePointer=0
		
		If Thisform.do_verifica_part(pcSirIdOrdl,ocomanda)!=1
			Use In Select('crsavansuri')
			Use In Select('crsavansuri_complet')
			Return
		Endif
		Use In Select('crsavansuri')
		Select crsavansuri_complet
		*!*	modificare	v 2.0.52 : am adaugat pnAvansFTva
		Calculate Sum(Nvl(avans,0.00)),Sum(Nvl(incasat,0.00)),Sum(Nvl(avansftva,0.00)) To pnAvans,lnIncasat,pnAvansFTva
		
		*!*	modificare v 2.0.21
		If glAutoBonDet
			If pnAvans > 0
				If amessagebox("Se achita factura cu bon fiscal?",4+32+256,"Confirmare") = 6
					*!*	modificare	v 2.0.35	:	am adaugat pcSirIdOrdl
					*!*	modificare	v 2.0.41	:	am adaugat pcSirIdLucrare
					If This.do_storneaza_avans(lnIncasat,pcSirNrOrd,1,pcSirIdOrdl,pcSirIdLucrare)
						pnAvans = 0
					Else
						Return
					Endif
				Endif
			Endif
			*!*		lcSql = [select b.denumire, b.um, a.cante as cant, a.pret, a.dataact, a.id_rul from (] + ;
			*!*			[select id_articol,] + ;
			*!*			[pack_sesiune.calculeaza_pret_cu_tva(pretv,1,pack_def.GetIdMonedaNationala(),] + ;
			*!*				[pack_contafin.getCotaTVAStandard(?gnLuna,?gnAn),0) as pret,] + ;
			*!*			[SUM(cante) as cante,MIN(dataact) as dataact,MIN(id_rul) as id_rul ] + ;
			*!*			[from ] + gcS + [.rul where sters = 0 and id_lucrare in (] + pcSirIdLucrare + [) ] + ;
			*!*			[group by id_articol,pretv) a ] + ;
			*!*			[left join nom_articole b on a.id_articol = b.id_articol where a.cante <> 0 ] + ;
			*!*			[order by a.dataact,a.id_rul]
			*!*	modificare	v 2.0.35	:	am pus IIF(ocomanda.proc_tvav=1,1,gnCotaTVAStandard) in loc de pack_contafin.getCotaTVAStandard(?gnLuna,?gnAn)
			lcSql = [select denumire,um,cant,pret,dataact,id_rul,pret,] + ;
				[round(pack_sesiune.calculeaza_pret_tva(totalctva,1,0,] + Alltrim(Str(Iif(ocomanda.proc_tvav=1,1,gnCotaTVAStandard),10,4)) + [,1,2),?gnPPretV) as totaltva,] + ;
				[round(pack_sesiune.calculeaza_pret_fara_tva(totalctva,1,0,] + Alltrim(Str(Iif(ocomanda.proc_tvav=1,1,gnCotaTVAStandard),10,4)) + [,1,2),?gnPPretV) as totalftva,] + ;
				[totalctva from (] + ;
				[select b.denumire, b.um, a.cante as cant, a.pretv, a.pret, a.dataact, a.id_rul,SUM(ROUND(a.pret*a.cante,?gnPc)) over () as totalctva ] + ;
				[ from (] + ;
				[select id_articol,pretv,] + ;
				[pack_sesiune.calculeaza_pret_cu_tva(pretv,1,pack_def.GetIdMonedaNationala(),] + ;
				ALLTRIM(Str(Iif(ocomanda.proc_tvav=1,1,gnCotaTVAStandard),10,4)) + [,0,2) as pret,] + ;
				[SUM(cante) as cante,MIN(dataact) as dataact,MIN(id_rul) as id_rul ] + ;
				[from ] + gcS + [.rul where sters = 0 and id_lucrare in (] + pcSirIdLucrare + [) ] + ;
				[group by id_articol,pretv) a ] + ;
				[left join nom_articole b on a.id_articol = b.id_articol where a.cante <> 0) ] + ;
				[order by dataact,id_rul]
			lnSucces = goExecutor.oExecute(lcSql,'crsBonDetaliat')
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,16,'Eroare')
				Return
			Endif
		Endif
		*!*	modificare v 2.0.21	^
		
		*!*	modificare	v 2.0.35
		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
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		Endif
		*!*	modificare	v 2.0.35	^
		
		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]=pcSirNrOrd
		taValori[2,3]=.T.
		taValori[3,1]="poAct.id_lucrare"
		taValori[3,2]=[-1]
		taValori[3,3]=.T.
		taValori[4,1]="poAct.id_vv4111"
		taValori[4,2]=Alltrim(Str(ocomanda.id_partener))
		taValori[4,3]=.T.
		*!*	lnNumarFactura = aloca_numar_fact()
		*!*	taValori[5,1]="poAct.nract"
		*!*	taValori[5,2]=Alltrim(Str(lnNumarFactura))
		*!*	taValori[5,3]=.F.
		
		*!*	modificare	v 2.0.28 : nu pun conditie si in functie de gnid_fdoc_factasig pentru ca voi completa id_fdoc cu
		*!*			gnid_fdoc_factasig mai jos, in functie de fiecare lucrare ( daca e pe asigurator sau nu )
		*!*	If !Isnull(gnid_fdoc_factura)
		If !Empty(Nvl(gnid_fdoc_fact,0))
			*!*	modificare	v 2.0.28	^
			Dimension taValori[lnLungime+2,3]
			taValori[lnLungime+1,1]="poAct.id_fdoc"
			*!*	modificare	v 2.0.28 : nu pun conditie si in functie de gnid_fdoc_factasig pentru ca voi completa id_fdoc cu
			*!*			gnid_fdoc_factasig mai jos, in functie de fiecare lucrare ( daca e pe asigurator sau nu )
			*!*		taValori[lnLungime+1,2]=Alltrim(Str(gnid_fdoc_factura))
			taValori[lnLungime+1,2]=Alltrim(Str(gnid_fdoc_fact))
			*!*	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
		Endif
		
		Thisform.MousePointer=0
		Thisform.LockScreen=.F.
		
		Thisform.AlwaysOnTop=.F.
		lans(31011,.F.,.T.,@taValori)	&&   id_set,daca se executa procedura de mai multe ori,
		&& daca verifica analiticele,array de valori
		Thisform.AlwaysOnTop=.T.
		
		If buton=2
			Do deschid_actc
			*!*		Do dezaloca_numar_fact In oserii_numere.prg
			poGeneratorNumere.dezaloca_numere()
			Use In Select('crsBonDetaliat')
			Return
		Endif
		
		*!*	SELECT actactan
		*!*	GO TOP
		*!*	lnNumarFacturaAct = nract
		*!*	IF lnNumarFacturaAct <> lnNumarFactura
		*!*		DO dezaloca_numar_fact In oserii_numere.prg
		*!*	ENDIF
		
		*!*	If Used('v_nom_casa')
		*!*		Use In v_nom_casa
		*!*	Endif
		*!*	lcSql=[select id_part,nume from ] + gcS + [.vnom_casa_lei]
		*!*	lnSucces=goExecutor.oExecute(lcSql,'v_nom_casa')
		*!*	If lnSucces < 0
		*!*		amessagebox(goExecutor.cEroare,0+16,'Eroare')
		*!*	Endif
		
		*!*	modificare	v 2.1.0 : am adaugat pnTotalFactura
		Private pnDiscountM,pnDiscountN,pnDiscountTvaM,pnDiscountTvaN,pnNrChit,pnIdCasa,pnIncasat,pcCasa,pcSerieChit,pnTotalFactura, pnPOS
		Store 0 To pnDiscountM,pnDiscountN,pnDiscountTvaM,pnDiscountTvaN,pnNrChit,pnIdCasa,pnIncasat,pnTotalFactura, pnPOS
		Store [] To pcCasa,pcSerieChit	&&	modificare	v 2.0.28 : pcSerieChit
		
		Thisform.LockScreen=.F.
		Thisform.MousePointer=0
		
		*!*	modificare	v 2.0.4
		*!*	lcSql=[select 1 as tip,acont,NVL(sum(ROUND(pretv*cante,?gnPc)),0) as pret,0 as id_ordl,id_lucrare,id_sectie,sectie from ] + gcS + [.vrul ]+;
		*!*		[where id_lucrare in (] + Alltrim(pcSirIdLucrare) + [) group by id_lucrare,acont,sectie,id_sectie ] + ;
		*!*		[union all ] + ;
		*!*		[select 2 as tip,null as acont,NVL(sum(ROUND(a.timpn * a.pret,?gnPc)),0) as pret,a.id_ordl,0 as id_lucrare,a.id_sectie,a.sectie from ] + gcS + [.dev_voper a ] + ;
		*!*		[where a.id_ordl in (] + Alltrim(pcSirIdOrdl) + [) group by a.id_ordl,a.id_sectie,a.sectie]
		*!*	modificare	v 2.0.22
		If glAutoBonDet
			*!*	modificare	v 2.0.35	:	am pus IIF(ocomanda.proc_tvav=1,1,gnCotaTVAStandard) in loc de pack_contafin.getCotaTVAStandard(?gnLuna,?gnAn)
			lcSql=[select 1 as tip,a.acont,NVL(sum(ROUND(PACK_SESIUNE.SUMA_RON(A.PRETV, A.AN, A.LUNA, 3)*a.cante,?gnPc)),0) as pret,] + ;
				[NVL(sum(ROUND(pack_sesiune.calculeaza_pret_tva(PACK_SESIUNE.SUMA_RON(A.PRETV, A.AN, A.LUNA, 3),1,pack_def.GetIdMonedaNationala(),] + ;
				ALLTRIM(Str(Iif(ocomanda.proc_tvav=1,1,gnCotaTVAStandard),10,4)) + [,0,2)*a.cante,?gnPc)),0) as tva,] + ;
				[0 as id_ordl,a.id_lucrare,a.id_sectie,b.sectie from ] + gcS + [.rul a ]+;
				[left join ] + gcS + [.nom_sectii b on a.id_sectie = b.id_sectie ] + ;
				[where a.sters = 0 and a.id_lucrare in (] + Alltrim(pcSirIdLucrare) + [) group by a.id_lucrare,a.acont,b.sectie,a.id_sectie ] + ;
				[union all ] + ;
				[select 2 as tip,null as acont,NVL(sum(ROUND(a.timpn * a.pret,?gnPc)),0) as pret,0 as tva,a.id_ordl,0 as id_lucrare,a.id_sectie,a.sectie from ] + gcS + [.auto_voper a ] + ;
				[where a.id_ordl in (] + Alltrim(pcSirIdOrdl) + [) group by a.id_ordl,a.id_sectie,a.sectie]
		Else
			lcSql=[select 1 as tip,a.acont,NVL(sum(ROUND(PACK_SESIUNE.SUMA_RON(A.PRETV, A.AN, A.LUNA, 3)*a.cante,?gnPc)),0) as pret,0 as tva,0 as id_ordl,a.id_lucrare,a.id_sectie,b.sectie from ] + gcS + [.rul a ]+;
				[left join ] + gcS + [.nom_sectii b on a.id_sectie = b.id_sectie ] + ;
				[where a.sters = 0 and a.id_lucrare in (] + Alltrim(pcSirIdLucrare) + [) group by a.id_lucrare,a.acont,b.sectie,a.id_sectie ] + ;
				[union all ] + ;
				[select 2 as tip,null as acont,NVL(sum(ROUND(a.timpn * a.pret,?gnPc)),0) as pret,0 as tva,a.id_ordl,0 as id_lucrare,a.id_sectie,a.sectie from ] + gcS + [.auto_voper a ] + ;
				[where a.id_ordl in (] + Alltrim(pcSirIdOrdl) + [) group by a.id_ordl,a.id_sectie,a.sectie]
		Endif
		*!*	modificare	v 2.0.22	^
		*!*	modificare	v 2.0.4	^
		lnSucces=goExecutor.oExecute(lcSql,'crsTotaluri')
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		Endif
		Select crsTotaluri
		*!*	modificare	v 2.0.22
		*!*	Calculate Sum(Pret) To ocomanda.materiale FOR tip = 1
		*!*	Calculate Sum(Pret) To ocomanda.manopera FOR tip = 2
		Calculate Sum(Pret),Sum(tva) To ocomanda.materiale,lnTVAMateriale For tip = 1
		Calculate Sum(Pret) To ocomanda.manopera For tip = 2
		*!*	modificare	v 2.0.41
		*!*	AddProperty(ocomanda,"bondiftva",0)
		*!*	AddProperty(ocomanda,"bondifftva",0)
		*!*	If Used('crsBonDetaliat')
		*!*		Select crsBonDetaliat
		*!*	*!*	modificare	v 2.0.41
		*!*	*!*		ocomanda.bondiftva = totaltva - lnTVAMateriale
		*!*	*!*		ocomanda.bondifftva = totalftva - ocomanda.materiale
		*!*		CALCULATE SUM(totaltva),SUM(totalftva) TO ocomanda.bondiftva,ocomanda.bondifftva
		*!*		ocomanda.bondiftva = ocomanda.bondiftva - lnTVAMateriale
		*!*		ocomanda.bondifftva = ocomanda.bondifftva - ocomanda.materiale
		*!*	*!*	modificare	v 2.0.41	^
		*!*	Endif
		*!*	modificare	v 2.0.41	^
		*!*	modificare	v 2.0.22	^
		
		*!*	modificare JC/JV 2007
		pnIdJtvaColoana = GetIdJtvaStandard("VANZARE")
		loTVAColoana = GeJtvaColoana(pnIdJtvaColoana)
		pnIdTva = NVL(loTVAColoana.id_tva,0)
		pnProcTva = 1 + ROUND(loTVAColoana.cota_tva/100,2)
		*!*	modificare JC/JV 2007	^
		
		*!*	modificare	v 2.0.41
		*!*	*!*	modificare	v 2.0.22
		*!*	lnTVAMateriale = Iif(glAutoBonDet,lnTVAMateriale,Round(ocomanda.materiale*(pnProcTva-1),gnPa))
		*!*	*!*	modificare	v 2.0.22	^
		AddProperty(ocomanda,"materialerecalc",ocomanda.materiale)
		If glAutoBonDet
			Select crsBonDetaliat
			lnTotalCTVAMateriale = totalctva
			ocomanda.materialerecalc = Round(lnTotalCTVAMateriale/pnProcTva,gnPc)
			lnTVAMateriale = lnTotalCTVAMateriale - ocomanda.materialerecalc
		Else
			lnTVAMateriale = Round(ocomanda.materiale*(pnProcTva-1),gnPc)
		Endif
		*!*	modificare	v 2.0.41	^
		
		*!*	modificare	v 2.1.0
		Local lnTvaIncasare, lcContTVA
		Select actactan
		Calculate Max(tva_incasare) To lnTvaIncasare
		If lnTvaIncasare = 1
			pnIdJtvaColoana = getIdJtvaColoana(pnIdJtvaColoana,1)
			pnIdTva = getIdTva(pnIdTva,1)
			lcContTVA = [4428]
		Else
			lcContTVA = [4427]
		ENDIF
		
		
		*!*	modificare	v 2.1.0	^
		*!*	modificare	v 2.0.28
		Create Cursor crsalteserv(id_articol N(14) Not Null,denumire c(100) Not Null,codmat c(50) Null,um c(10) Null,;
			id_lucrare N(14) Not Null,nrord c(100) Not Null,;
			cantitate N(14,gnPCant) Default 1,pretftva N(14,gnPPretV) Default 0,valoareftva N(14,gnPc) Default 0)
		*!*	modificare	v 2.0.28	^
		pniesire=1
		*!*	modificare	v 2.0.33 : am adaugat pnAchitAsigurator
		Private pnAchitAsigurator
		pnAchitAsigurator = 0
		*!*	modificare	v 2.0.33	^
		*!*	modificare	v 2.0.41
		*!*	ofrmincasare=Createobject('frm_incasare_finala',lnTVAMateriale,ocomanda.bondifftva,ocomanda.bondiftva)
		Local lnProcDiscountManopera, lnProcDiscountMateriale, lnIdCtr
		lnProcDiscountManopera = 0
		lnProcDiscountMateriale = 0
		lnIdCtr = 0
		citeste_discount_contract(ocomanda.id_partener, @lnIdCtr, @lnProcDiscountManopera, @lnProcDiscountMateriale)
		
		ofrmincasare=Createobject('frm_incasare_finala',lnTvaIncasare,lnTVAMateriale,!Empty(Nvl(ocomanda.asigurator,[])))
		*!*	modificare	v 2.0.41	^
		With ofrmincasare
			.clb_manopera.text_simplu1.Value=Round(ocomanda.manopera,gnPc)
			.clb_tvam.text_simplu1.Value=Round(ocomanda.manopera*(pnProcTva-1),gnPc)
			*!*	modificare	v 2.0.41
			*!*		.clb_materiale.text_simplu1.Value=Round(ocomanda.materiale,gnPa)+ocomanda.bondifftva
			*!*		*!*	modificare	v 2.0.22
			*!*		*!*		.clb_tvan.text_simplu1.Value=Round(ocomanda.materiale*(pnProcTva-1),gnPa)
			*!*		.clb_tvan.text_simplu1.Value = lnTVAMateriale + ocomanda.bondiftva
			*!*		*!*	modificare	v 2.0.22	^
			.clb_materiale.text_simplu1.Value=Round(ocomanda.materialerecalc,gnPc)
			.clb_tvan.text_simplu1.Value = lnTVAMateriale
			*!*	modificare	v 2.0.41	^
			.clb_avans.text_simplu1.Value = pnAvans
			.navansfaratva = pnAvansFTva	&&	modificare	v 2.0.52
		
			If Nvl(ocomanda.manopera, 0) <> 0
				.clb_procdiscm.text_simplu1.Value = lnProcDiscountManopera
			Endif
			If Nvl(ocomanda.materialerecalc, 0) <> 0
				.clb_procdiscn.text_simplu1.Value = lnProcDiscountMateriale
			Endif
		Endwith
		ofrmincasare.calculeaza_total()
		ofrmincasare.Show(1)
		Use In v_nom_casa
		Release ofrmincasare
		
		If pniesire!=1
			*!*		dezaloca_numar_bf()		&&	oserii_numere.prg
			*!*		Do dezaloca_numar_fact In oserii_numere.prg
			poGeneratorNumere.dezaloca_numere()
			Use In Select('crsBonDetaliat')
			Use In Select('crsalteserv')	&&	modificare	v 2.0.28
			Return
		Endif
		
		SELECT actactan
		GO TOP 
		ldDataAct = dataact
		pnTaxCode = GetTaxCodeIdPart(m.gnAn, m.gnLuna, m.ldDataAct, m.pnIdJtvaColoana, ocomanda.id_partener)
		
		*!*	SELECT * FROM actactan INTO TABLE C:\actactan.dbf
		*!*	SELECT * FROM crstotaluri INTO TABLE C:\crstotaluri.dbf
		*!*	SELECT * FROM crsselectate INTO TABLE C:\crsselectate.dbf
		
		*!*	modificare v 2.0.6 : am concatenat explicatia5
		*!*	modificare	v 2.0.35 : am modificat suma din c.tva in IIF(pnProcTva=1,000000000000.0000,Nvl(c.tva,000000000000.0000))
		*!*	modificare	v 2.0.41 : am modificat suma din IIF(a.nr_nota = 2,Iif(glAutoBonDet,IIF(pnProcTva=1,000000000000.0000,Nvl(c.tva,000000000000.0000)),Round(Nvl(c.Pret,000000000000.0000)*(pnProcTva-1),gnPc)),...
		Insert Into actactan(nr_nota,id_act,luna,an,cod,datairegt,dataireg,dataact,nract,dataactt,datascad,suma,explicatia,scd,ascd,;
			scc,ascc,pereched,perechec,explicatia4,explicatia5,datascadt,nnir,id_util,util,dataora,;
			id_responsabil,nresp,id_venchelt,dst_chlt,id_lucrare,nrord,id_ctr,contract,id_sectie,sectie,;
			proc_tva,id_set,id_fact,id_factd,id_factc,id_partd,partd,id_partc,partc,id_sucursala,sucursala,;
			id_fdoc,fdoc,id_gestin,id_jtva_coloana,taxcode,gestin,id_gestout,gestout,id_valuta,nume_val,serie_act) ;
			SELECT Distinct a.nr_nota,a.id_act,a.luna,a.an,a.cod,a.datairegt,a.dataireg,a.dataact,a.nract,a.dataactt,;
			IIF(Alltrim(a.scd) = '711',{},a.datascad) As datascad,;
			IIF(Alltrim(a.scc) = '332',Nvl(c.Pret,000000000000.0000),;
			IIF(Alltrim(a.scc) = '707',Nvl(c.Pret,000000000000.0000),;
			IIF(Alltrim(a.scc) = '704',Nvl(d.Pret,000000000000.0000),;
			IIF(a.nr_nota = 2,Round(Nvl(c.Pret,000000000000.0000)*(pnProcTva-1),gnPc),;
			IIF(a.nr_nota = 4,Round(Nvl(d.Pret,000000000000.0000)*(pnProcTva-1),gnPc),000000000000.0000))))) As suma,;
			IIF(Alltrim(a.scc) = '332',Padr([PRODUCTIE TERMINATA],50,[ ]),;
			IIF(Alltrim(a.scc) = '707',Padr([MATERIALE],50,[ ]),;
			IIF(Alltrim(a.scc) = '704',Padr([MANOPERA],50,[ ]),;
			IIF(a.nr_nota = 2,Padr([TVA MATERIALE],50,[ ]),;
			IIF(a.nr_nota = 4,Padr([TVA MANOPERA],50,[ ]),Space(50)))))) As explicatia,;
			a.scd,a.ascd,a.scc,a.ascc,a.pereched,a.perechec,;
			b.asigurator As explicatia4,Alltrim(Nvl(a.explicatia5,''))+[;]+Alltrim(Nvl(b.inspector,''))+[;]+Alltrim(Nvl(b.nr_dosar,'')) As explicatia5,a.datascadt,a.nnir,a.id_util,a.util,a.dataora,;
			a.id_responsabil,a.nresp,a.id_venchelt,a.dst_chlt,b.id_lucrare,b.nrord,a.id_ctr,a.contract,;
			IIF(Alltrim(a.scc) = '332',Nvl(c.id_sectie,000000000000),;
			IIF(Alltrim(a.scc) = '707',Nvl(c.id_sectie,000000000000),;
			IIF(Alltrim(a.scc) = '704',Nvl(d.id_sectie,000000000000),;
			IIF(a.nr_nota = 2,Nvl(c.id_sectie,000000000000),;
			IIF(a.nr_nota = 4,Nvl(d.id_sectie,000000000000),000000000000))))) As id_sectie,;
			IIF(Alltrim(a.scc) = '332',Padr(c.sectie,50,[ ]),;
			IIF(Alltrim(a.scc) = '707',Padr(c.sectie,50,[ ]),;
			IIF(Alltrim(a.scc) = '704',Padr(d.sectie,50,[ ]),;
			IIF(a.nr_nota = 2,Padr(c.sectie,50,[ ]),;
			IIF(a.nr_nota = 4,Padr(d.sectie,50,[ ]),Space(50)))))) As sectie,;
			IIF(Alltrim(a.scd) = '711',00000000000,pnProcTva) As proc_tva,;
			a.id_set,a.id_fact,a.id_factd,a.id_factc,a.id_partd,a.partd,;
			a.id_partc,a.partc,a.id_sucursala,a.sucursala,;
			IIF(!Empty(Nvl(b.asigurator,[])),Nvl(gnid_fdoc_factasig,a.id_fdoc),a.id_fdoc) As id_fdoc,;		&&	modificare	v 2.0.28
		Iif(!Empty(Nvl(b.asigurator,[])),a.fdoc+[ ASIGURATOR],a.fdoc) As fdoc,;							&&	modificare	v 2.0.28
		a.id_gestin,;
			IIF(Alltrim(a.scd) = '711',00000000000,Iif(Alltrim(a.scc)=lcContTVA,pnIdTva,pnIdJtvaColoana)) As id_jtva_coloana,;
			CAST(IIF(Alltrim(a.scd) = '711',NULL,pnTaxcode) as N(6)) As taxcode,;
			a.gestin,a.id_gestout,a.gestout,a.id_valuta,a.nume_val,a.serie_act From actactan a ;
			Left Join crsselectate b On 2 = 2 ;
			left Join crsTotaluri c On b.id_lucrare = c.id_lucrare And c.tip = 1 ;
			left Join crsTotaluri d On b.id_ordl = d.id_ordl And d.tip = 2
		
		*!*	modificare	v 2.0.28
		If Reccount('crsalteserv') > 0
			If Used('crstotaluriserv')
				Use In crstotaluriserv
			Endif
			Select Sum(valoareftva) As totalftva,Sum(Round(valoareftva*(pnProcTva-1),gnPc)) As totaltva,id_lucrare,nrord ;
				FROM crsalteserv Group By id_lucrare,nrord ;
				INTO Cursor crstotaluriserv
			Insert Into actactan(nr_nota,id_act,luna,an,cod,datairegt,dataireg,dataact,nract,dataactt,datascad,suma,explicatia,scd,ascd,;
				scc,ascc,pereched,perechec,explicatia4,explicatia5,datascadt,nnir,id_util,util,dataora,;
				id_responsabil,nresp,id_venchelt,dst_chlt,id_lucrare,nrord,id_ctr,contract,id_sectie,sectie,;
				proc_tva,id_set,id_fact,id_factd,id_factc,id_partd,partd,id_partc,partc,id_sucursala,sucursala,;
				id_fdoc,fdoc,id_gestin,id_jtva_coloana,taxcode,gestin,id_gestout,gestout,id_valuta,nume_val,serie_act) ;
				SELECT Distinct a.nr_nota*(-1) As nr_nota,a.id_act,a.luna,a.an,a.cod,a.datairegt,a.dataireg,a.dataact,a.nract,a.dataactt,a.datascad,;
				IIF(Alltrim(a.scc) = lcContTVA,b.totaltva,b.totalftva) As suma,;
				IIF(Alltrim(a.scc) = lcContTVA,Padr([TVA ALTELE],50,[ ]),Padr([ALTELE],50,[ ])) As explicatia,;
				a.scd,a.ascd,Iif(Alltrim(a.scc) = lcContTVA,a.scc,Padl(gcDevContAltele,4,[ ])) As scc,a.ascc,a.pereched,a.perechec,;
				c.asigurator As explicatia4,Alltrim(Nvl(a.explicatia5,''))+[;]+Alltrim(Nvl(c.inspector,''))+[;]+Alltrim(Nvl(c.nr_dosar,'')) As explicatia5,;
				a.datascadt,a.nnir,a.id_util,a.util,a.dataora,;
				a.id_responsabil,a.nresp,a.id_venchelt,a.dst_chlt,b.id_lucrare,b.nrord,a.id_ctr,a.contract,;
				a.id_sectie,a.sectie,pnProcTva As proc_tva,;
				a.id_set,a.id_fact,a.id_factd,a.id_factc,a.id_partd,a.partd,;
				a.id_partc,a.partc,a.id_sucursala,a.sucursala,a.id_fdoc,a.fdoc,a.id_gestin,;
				Iif(Alltrim(a.scc)=lcContTVA,pnIdTva,pnIdJtvaColoana) As id_jtva_coloana,;
				CAST(m.pnTaxCode as N(6)) As taxcode,;		
				a.gestin,a.id_gestout,a.gestout,a.id_valuta,a.nume_val,a.serie_act From actactan a ;
				Left Join crstotaluriserv b On 2 = 2 ;
				left Join crsselectate c On b.id_lucrare = c.id_lucrare ;
				Where Inlist(a.nr_nota,1,2) And a.id_lucrare = -1
			Update actactan Set scc = Alltrim(scc)		&&	ca sa-mi scoata spatiul de la gcDevContAltele ; daca nu pun spatiu, atunci imi arata 442, in loc de 4427
			Use In crstotaluriserv
		Endif
		*!*	modificare	v 2.0.28	^
		Delete From actactan Where id_lucrare = -1
		
		*!*	SELECT actactan
		*!*	BROWSE
		*!*	modificare	v 2.0.41
		*!*	*!*	modificare	v 2.0.22
		*!*	If pnProcTva = 1
		*!*		ocomanda.bondiftva = 0
		*!*		ocomanda.bondifftva = 0
		*!*		If Used('crsBonDetaliat')
		*!*			Select crsBonDetaliat
		*!*			Replace Pret With pretv All
		*!*		Endif
		*!*	Endif
		*!*	If ocomanda.bondifftva <> 0
		*!*		Select actactan
		*!*		Locate For nr_nota = 1
		*!*		Scatter Name oactan
		*!*		Insert Into actactan(suma,explicatia) Values(ocomanda.bondifftva,"MATERIALE ROTUNJIRE BON")
		*!*		Gather Name oactan Fields Except suma,explicatia
		*!*	Endif
		*!*	If ocomanda.bondiftva <> 0
		*!*		Select actactan
		*!*		Locate For nr_nota = 2
		*!*		Scatter Name oactan
		*!*		Insert Into actactan(suma,explicatia) Values(ocomanda.bondiftva,"TVA MATERIALE ROTUNJIRE BON")
		*!*		Gather Name oactan Fields Except suma,explicatia
		*!*	Endif
		*!*	*!*	modificare	v 2.0.22	^
		If pnProcTva = 1
			If Used('crsBonDetaliat')
				Select crsBonDetaliat
				Replace Pret With pretv All
			Endif
		Else
			Select actactan
			lnTotalMater = 0
			lnTotalMaterTVA = 0
			&&	pun diferentele pe o comanda care are materiale
			Locate For Alltrim(scd) = '4111' And Alltrim(scc) = '707' And Left(Alltrim(explicatia),3) = "MAT" And suma > 0
			If Found()
				lnIdLucrareDif = id_lucrare
				lcNrOrdDif = nrord
			Else
				lnIdLucrareDif = 0
				lcNrOrdDif = []
			Endif
			Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = '707' And Left(Alltrim(explicatia),3) = "MAT" To lnTotalMater
			Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = lcContTVA And Left(Alltrim(explicatia),7) = "TVA MAT" To lnTotalMaterTVA
			If ocomanda.materialerecalc <> lnTotalMater
				Select actactan
				Locate For nr_nota = 1
				Scatter Name oactan
				Insert Into actactan(suma,explicatia,id_lucrare,nrord) Values(ocomanda.materialerecalc-lnTotalMater,"MATERIALE ROTUNJIRE BON",lnIdLucrareDif,lcNrOrdDif)
				If Empty(lnIdLucrareDif)
					Gather Name oactan Fields Except suma,explicatia
				Else
					Gather Name oactan Fields Except suma,explicatia,id_lucrare,nrord
				Endif
			Endif
			If lnTVAMateriale <> lnTotalMaterTVA
				Select actactan
				Locate For nr_nota = 2
				Scatter Name oactan
				Insert Into actactan(suma,explicatia,id_lucrare,nrord) Values(lnTVAMateriale-lnTotalMaterTVA,"TVA MATERIALE ROTUNJIRE BON",lnIdLucrareDif,lcNrOrdDif)
				If Empty(lnIdLucrareDif)
					Gather Name oactan Fields Except suma,explicatia
				Else
					Gather Name oactan Fields Except suma,explicatia,id_lucrare,nrord
				Endif
			Endif
			Select actactan
			lnTotalManop = 0
			lnTotalManopTVA = 0
			Locate For Alltrim(scd) = '4111' And Alltrim(scc) = '704' And Left(Alltrim(explicatia),3) = "MAN" And suma > 0
			If Found()
				lnIdLucrareDif = id_lucrare
				lcNrOrdDif = nrord
			Else
				lnIdLucrareDif = 0
				lcNrOrdDif = []
			Endif
			Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = '704' And Left(Alltrim(explicatia),3) = "MAN" To lnTotalManop
			Sum suma For Alltrim(scd) = '4111' And Alltrim(scc) = lcContTVA And Left(Alltrim(explicatia),7) = "TVA MAN" To lnTotalManopTVA
			If Round(lnTotalManop*(pnProcTva-1),gnPc) <> lnTotalManopTVA
				Select actactan
				Locate For nr_nota = 4
				Scatter Name oactan
				Insert Into actactan(suma,explicatia,id_lucrare,nrord) Values(Round(lnTotalManop*(pnProcTva-1),gnPc)-lnTotalManopTVA,"TVA MANOPERA ROTUNJIRE",lnIdLucrareDif,lcNrOrdDif)
				If Empty(lnIdLucrareDif)
					Gather Name oactan Fields Except suma,explicatia
				Else
					Gather Name oactan Fields Except suma,explicatia,id_lucrare,nrord
				Endif
			Endif
		Endif
		*!*	modificare	v 2.0.41	^
		
		*!*	modificare	v 2.0.41
		*!*	lnProcDiscN=Round(pnDiscountN*100/ocomanda.materiale,2)
		lnProcDiscN=Round(pnDiscountN*100/ocomanda.materialerecalc,2)
		*!*	modificare	v 2.0.41	^
		lnProcDiscM=Round(pnDiscountM*100/ocomanda.manopera,2)
		
		*!*	scriere discount-uri
		Insert Into actactan(nr_nota,id_act,luna,an,cod,datairegt,dataireg,dataact,nract,dataactt,datascad,suma,explicatia,scd,ascd,;
			scc,ascc,pereched,perechec,explicatia4,explicatia5,datascadt,nnir,id_util,util,dataora,;
			id_responsabil,nresp,id_venchelt,dst_chlt,id_lucrare,nrord,id_ctr,contract,id_sectie,sectie,;
			proc_tva,id_set,id_fact,id_factd,id_factc,id_partd,partd,id_partc,partc,id_sucursala,sucursala,;
			id_fdoc,fdoc,id_gestin,id_jtva_coloana,taxcode,gestin,id_gestout,gestout,id_valuta,nume_val,serie_act) ;
			Select Recno() As nr_nota,a.id_act,a.luna,a.an,a.cod,a.datairegt,a.dataireg,a.dataact,a.nract,a.dataactt,a.datascad,;
			IIF(Alltrim(a.scc) = lcContTVA,;
			IIF(a.nr_nota=2,Round((-1)*lnProcDiscN*a.suma/100,gnPc),;			&&	707
		Iif(a.nr_nota=4,Round((-1)*lnProcDiscM*a.suma/100,gnPc),0)),;		&&	704
		Iif(Alltrim(a.scc) = '707',;
			IIF(gnDiscount411 = 1,Round((-1)*lnProcDiscN*a.suma/100,gnPc),Round((-1)*lnProcDiscN*a.suma/100,gnPc)),;
			IIF(gnDiscount411 = 1,Round((-1)*lnProcDiscM*a.suma/100,gnPc),Round((-1)*lnProcDiscM*a.suma/100,gnPc)))) As suma,;
			IIF(Alltrim(a.scc) = lcContTVA,;
			IIF(a.nr_nota=2,Padr([TVA DISCOUNT MATERIALE ]+Alltrim(Str(lnProcDiscN,6,2))+[%],50,[ ]),;			&&	707
		Iif(a.nr_nota=4,Padr([TVA DISCOUNT MANOPERA ]+Alltrim(Str(lnProcDiscM,6,2))+[%],50,[ ]),[])),;		&&	704
		Iif(Alltrim(a.scc) = '707',Padr([DISCOUNT MATERIALE ]+Alltrim(Str(lnProcDiscN,6,2))+[%],50,[ ]),;
			PADR([DISCOUNT MANOPERA ]+Alltrim(Str(lnProcDiscM,6,2))+[%],50,[ ]))) As explicatia,;
			IIF(Alltrim(a.scc) <> lcContTVA And gnDiscount411 = 0,'667',a.scd) As scd,;
			IIF(Alltrim(a.scc) <> lcContTVA And gnDiscount411 = 0,'',a.ascd) As ascd,;
			IIF(Alltrim(a.scc) <> lcContTVA And gnDiscount411 = 0,a.scd,a.scc) As scc,;
			IIF(Alltrim(a.scc) <> lcContTVA And gnDiscount411 = 0,a.ascd,a.ascc) As ascc,;
			a.pereched,a.perechec,a.explicatia4,a.explicatia5,a.datascadt,a.nnir,a.id_util,a.util,a.dataora,;
			a.id_responsabil,a.nresp,a.id_venchelt,a.dst_chlt,a.id_lucrare,a.nrord,a.id_ctr,a.contract,;
			a.id_sectie,a.sectie,a.proc_tva,a.id_set,a.id_fact,a.id_factd,a.id_factc,;
			IIF(Alltrim(a.scc) <> lcContTVA And gnDiscount411 = 0,00000000000000,a.id_partd) As id_partd,;
			IIF(Alltrim(a.scc) <> lcContTVA And gnDiscount411 = 0,Space(50),a.partd) As partd,;
			IIF(Alltrim(a.scc) <> lcContTVA And gnDiscount411 = 0,a.id_partd,a.id_partc) As id_partc,;
			IIF(Alltrim(a.scc) <> lcContTVA And gnDiscount411 = 0,a.partd,a.partc) As partc,;
			a.id_sucursala,a.sucursala,a.id_fdoc,a.fdoc,a.id_gestin,a.id_jtva_coloana,a.taxcode,;
			a.gestin,a.id_gestout,a.gestout,a.id_valuta,a.nume_val,a.serie_act From actactan a ;
			WHERE a.scd = '4111' And a.suma <> 0 And a.nr_nota > 0		&&	modificare	v 2.0.28 : am adaugat nr_nota > 0
		
		*!*	SELECT actactan
		*!*	BROWSE
		Select actactan
		Calculate Sum(suma) To lnVerifMan For Like(explicatia,[DISCOUNT MANOPERA*])
		Calculate Sum(suma) To lnVerifManTva For Like(explicatia,[TVA DISCOUNT MANOPERA*])
		Calculate Sum(suma) To lnVerifMat For Like(explicatia,[DISCOUNT MATERIALE*])
		Calculate Sum(suma) To lnVerifMatTva For Like(explicatia,[TVA DISCOUNT MATERIALE*])
		
		If lnVerifMan <> pnDiscountM Then
			Locate For Like(explicatia,[DISCOUNT MANOPERA*])
			If Found()
				Replace suma With suma + lnVerifMan - pnDiscountM
			Endif
		Endif
		
		If lnVerifManTva <> pnDiscountTvaM Then
			Locate For Like(explicatia,[TVA DISCOUNT MANOPERA*])
			If Found()
				Replace suma With suma + lnVerifManTva - pnDiscountTvaM
			Endif
		Endif
		
		If lnVerifMat <> pnDiscountN Then
			Locate For Like(explicatia,[DISCOUNT MATERIALE*])
			If Found()
				Replace suma With suma + lnVerifMat - pnDiscountN
			Endif
		Endif
		
		If lnVerifMatTva <> pnDiscountTvaN Then
			Locate For Like(explicatia,[TVA DISCOUNT MATERIALE*])
			If Found()
				Replace suma With suma + lnVerifMatTva - pnDiscountTvaN
			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
		
		*!*	SELECT actactan
		*!*	BROWSE
		Select actactan
		Go Top
		Scatter Name poActDate
		
		If pnAvans > 0
			Insert Into actactan(nr_nota,luna,an,cod,datairegt,dataireg,dataact,serie_act,nract,dataactt,datascad,suma,explicatia,scd,ascd,;
				scc,ascc,pereched,perechec,explicatia4,explicatia5,datascadt,nnir,id_util,util,dataora,;
				id_responsabil,nresp,id_venchelt,dst_chlt,id_lucrare,nrord,id_ctr,contract,id_sectie,sectie,;
				proc_tva,id_set,id_fact,id_factd,id_factc,id_partd,partd,id_partc,partc,id_sucursala,sucursala,;
				id_fdoc,fdoc,id_gestin,id_jtva_coloana,gestin,id_gestout,gestout,id_valuta,nume_val) ;
				Select Recno() As nr_nota,poActDate.luna As luna,poActDate.an As an,poActDate.cod As cod,poActDate.datairegt As datairegt,;
				poActDate.dataireg As dataireg,poActDate.dataact As dataact,poActDate.serie_act As serie_act,poActDate.nract As nract,poActDate.dataactt As dataactt,poActDate.datascad As datascad,;
				(-1) * avans As suma,[STORNARE AVANS] As explicatia,scd,ascd,scc,ascc,poActDate.pereched As pereched,poActDate.perechec As perechec,;
				NVL(poActDate.explicatia4,[]) As explicatia4,Alltrim(Nvl(poActDate.explicatia5,[])) As explicatia5,poActDate.datascadt As datascadt,poActDate.nnir As nnir,;
				poActDate.id_util As id_util,poActDate.util As util,poActDate.dataora As dataora,poActDate.id_responsabil As id_responsabil,;
				poActDate.nresp As nresp,poActDate.id_venchelt As id_venchelt,poActDate.dst_chlt As dst_chlt,id_lucrare,nrord,poActDate.id_ctr As id_ctr,;
				poActDate.contract As contract,id_sectie,sectie,proc_tva As proc_tva,poActDate.id_set As id_set,poActDate.id_fact As id_fact,;
				poActDate.id_factd As id_factd,poActDate.id_factc As id_factc,id_partd,partd,id_partc,partc,;
				poActDate.id_sucursala As id_sucursala,poActDate.sucursala As sucursala,poActDate.id_fdoc As id_fdoc,poActDate.fdoc As fdoc,;
				poActDate.id_gestin As id_gestin,id_jtva_coloana,taxcode,poActDate.gestin As gestin,poActDate.id_gestout As id_gestout,;
				poActDate.gestout As gestout,poActDate.id_valuta As id_valuta,poActDate.nume_val As nume_val ;
				From crsavansuri_complet
		Endif
		
		If pnTipIncasare>1
			*!*		Insert Into actactan(nr_nota,luna,an,cod,datairegt,dataireg,dataact,nract,dataactt,datascad,suma,explicatia,scd,ascd,;
			*!*		scc,ascc,pereched,perechec,explicatia4,explicatia5,datascadt,nnir,id_util,util,dataora,;
			*!*		id_responsabil,nresp,id_venchelt,dst_chlt,id_lucrare,nrord,id_ctr,contract,id_sectie,sectie,;
			*!*		proc_tva,id_set,id_fact,id_factd,id_factc,id_partd,partd,id_partc,partc,id_sucursala,sucursala,;
			*!*		id_fdoc,fdoc,id_gestin,id_jtva_coloana,gestin,id_gestout,gestout,id_valuta,nume_val) ;
			*!*		Select RECNO() as nr_nota,luna,an,cod,datairegt,dataireg,dataact,pnNrChit as nract,dataactt,{} as datascad,;
			*!*		SUM(suma) as suma,[INCASARE] As explicatia,[5311] as scd,[] as ascd,[4111] as scc,MIN(ascc) as ascc,pereched,;
			*!*		nract as perechec,explicatia4,explicatia5,datascadt,nnir,id_util,util,dataora,;
			*!*		id_responsabil,nresp,0 as id_venchelt,[] as dst_chlt,id_lucrare,nrord,id_ctr,contract,;
			*!*		0 as id_sectie,[] as sectie,0.00 as proc_tva,id_set,id_fact,id_fact as id_factd,id_factc,;
			*!*		pnIdCasa as id_partd,[] as partd,id_partd as id_partc,partd as partc,id_sucursala,sucursala,;
			*!*		IIF(pnTipIncasare=2,gnid_fdoc_bonfiscal,gnid_fdoc_incasare) as id_fdoc,;
			*!*		IIF(pnTipIncasare=2,[BON FISCAL],[CHITANTA]) as fdoc,;
			*!*		id_gestin,00000000000 as id_jtva_coloana,gestin,id_gestout,gestout,id_valuta,nume_val ;
			*!*		From actactan WHERE scd <> '711' ;
			*!*		group by luna,an,cod,datairegt,dataireg,dataact,nract,dataactt,pereched,nract,;
			*!*		explicatia4,explicatia5,datascadt,nnir,id_util,util,dataora,id_responsabil,nresp,;
			*!*		id_lucrare,nrord,id_ctr,contract,id_set,id_fact,id_factc,id_partd,partd,id_sucursala,sucursala,;
			*!*		id_gestin,gestin,id_gestout,gestout,id_valuta,nume_val
			*!*	modificare	v 2.0.28 : pcSerieChit
			Insert Into actactan(nr_nota,luna,an,cod,datairegt,dataireg,dataact,serie_act,nract,dataactt,datascad,suma,explicatia,scd,ascd,;
				scc,ascc,pereched,perechec,explicatia4,explicatia5,datascadt,nnir,id_util,util,dataora,;
				id_responsabil,nresp,id_venchelt,dst_chlt,id_lucrare,nrord,id_ctr,contract,id_sectie,sectie,;
				proc_tva,id_set,id_fact,id_factd,id_factc,id_partd,partd,id_partc,partc,id_sucursala,sucursala,;
				id_fdoc,fdoc,id_gestin,id_jtva_coloana,gestin,id_gestout,gestout,id_valuta,nume_val) ;
				VALUES (Recno(),poActDate.luna,poActDate.an,poActDate.cod,poActDate.datairegt,;
				poActDate.dataireg,poActDate.dataact,pcSerieChit,pnNrChit,poActDate.dataactt,;
				{},pnIncasat,[INCASARE],[5311],[],[4111],poActDate.ascd,;
				poActDate.pereched,poActDate.nract,Nvl(poActDate.explicatia4,[]),;
				ALLTRIM(Nvl(poActDate.explicatia5,[])),poActDate.datascadt,poActDate.nnir,;
				poActDate.id_util,poActDate.util,poActDate.dataora,;
				poActDate.id_responsabil,poActDate.nresp,0,[],;
				0,[],0,[],0,[],0.00,poActDate.id_set,poActDate.id_fact,poActDate.id_fact,poActDate.id_factc,;
				pnIdCasa,pcCasa,poActDate.id_partd,poActDate.partd,poActDate.id_sucursala,poActDate.sucursala,;
				IIF(pnTipIncasare=2,gnid_fdoc_bonfiscal,gnid_fdoc_chitanta),;		&&	modificare v 2.0.29 : am inlocuit gnid_fdoc_incasare
			Iif(pnTipIncasare=2,[BON FISCAL],[CHITANTA]),;
				poActDate.id_gestin,00000000000,poActDate.gestin,poActDate.id_gestout,;
				poActDate.gestout,poActDate.id_valuta,poActDate.nume_val)
			*!*	modificare	v 2.1.0
			If lnTvaIncasare = 1
				Select actactan
				Locate For scc = lcContTVA
				If Found()
					Scatter Name oTva
					Append Blank
					Gather Name oTva Fields Except nr_nota,serie_act,nract,suma,explicatia,scd,scc,perechec,id_fact,id_partd,id_partc,partd,partc,id_fdoc,fdoc,id_jtva_coloana
					Replace nr_nota With Recno(),serie_act With pcSerieChit,nract With pnNrChit,;
						suma With Round(pnIncasat*(oTva.proc_tva-1)/oTva.proc_tva,gnPc),;
						explicatia With [INCASARE],scd With '4428',scc With '4427',perechec With oTva.nract,;
						id_fact With -5,id_partd With 0,partd With '',id_partc With 0,partc With '',;
						id_fdoc With Iif(pnTipIncasare=2,gnid_fdoc_bonfiscal,Iif(pnTipIncasare=3,gnid_fdoc_chitanta,0)),;
						fdoc With Iif(pnTipIncasare=2,[BON FISCAL],Iif(pnTipIncasare=3,[CHITANTA],[])),;
						id_jtva_coloana With getIdTva(pnIdTva,0)
				Endif
				*!*			local lnProcentIncasat
				*!*			lnProcentIncasat = Round(pnIncasat / pnTotalFactura,2)
				*!*			Insert Into actactan(nr_nota,id_act,luna,an,cod,datairegt,dataireg,dataact,serie_act,nract,dataactt,suma,explicatia,scd,;
				*!*				scc,pereched,perechec,explicatia4,explicatia5,datascadt,nnir,id_util,util,dataora,;
				*!*				id_responsabil,nresp,id_venchelt,dst_chlt,id_lucrare,nrord,id_ctr,contract,id_sectie,sectie,;
				*!*				proc_tva,id_set,id_fact,id_factd,id_factc,id_partd,partd,id_partc,partc,id_sucursala,sucursala,;
				*!*				id_fdoc,fdoc,id_gestin,id_jtva_coloana,gestin,id_gestout,gestout,id_valuta,nume_val) ;
				*!*				Select Recno() As nr_nota,a.id_act,a.luna,a.an,a.cod,a.datairegt,a.dataireg,a.dataact,pcSerieChit as serie_act,pnNrChit As nract,a.dataactt,;
				*!*				round(a.suma*lnProcentIncasat,gnPc) as suma,[INCASARE] As explicatia,'4428' as scd,'4427' as scc,a.pereched,a.nract as perechec,;
				*!*				a.explicatia4,a.explicatia5,a.datascadt,a.nnir,a.id_util,a.util,a.dataora,;
				*!*				a.id_responsabil,a.nresp,a.id_venchelt,a.dst_chlt,a.id_lucrare,a.nrord,a.id_ctr,a.contract,;
				*!*				a.id_sectie,a.sectie,a.proc_tva,a.id_set,-5 as id_fact,a.id_factd,a.id_factc,0 as id_partd,'' as partd,;
				*!*				0 as id_partc,'' as partc,a.id_sucursala,a.sucursala,;
				*!*				IIF(pnTipIncasare=2,gnid_fdoc_bonfiscal,Iif(pnTipIncasare=3,gnid_fdoc_chitanta,0)) as id_fdoc,;
				*!*				IIF(pnTipIncasare=2,[BON FISCAL],Iif(pnTipIncasare=3,[CHITANTA],[])) as fdoc,a.id_gestin,;
				*!*				getIdTva(pnIdTva,0) As id_jtva_coloana,;
				*!*				a.gestin,a.id_gestout,a.gestout,a.id_valuta,a.nume_val From actactan a where a.scc = lcContTVA
		
				Release lnProcentIncasat
			Endif
			*!*	modificare	v 2.1.0	^
		
			*** inlocuiesc nota 5311 = 4111.client cu 5113.client = 4111.client
			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 && pnTipIncasare>1
		Release poDateAct
		*!*	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)
		*!*	Release ofrmdelegat
		
		Private buton
		buton=1
		
		*!*	modificare	v 2.4.24
		IF pnAchitAsigurator = 1
			SELECT actactan
			replace id_partd WITH ocomanda.id_part_asig,partd WITH ocomanda.asigurator FOR id_partd = ocomanda.id_partener
			replace id_partc WITH ocomanda.id_part_asig,partc WITH ocomanda.asigurator for id_partc = ocomanda.id_partener
		ENDIF
		*!*	modificare	v 2.4.24	^
		
		UPDATE actactan SET PAYMENTCODE = '42', PAYMENTNAME = 'Plata in contul bancar' WHERE LEFT(scd, 3) = '512'
		UPDATE actactan SET PAYMENTCODE = '10', PAYMENTNAME = 'Numerar' WHERE LEFT(scd, 3) = '531'	
		UPDATE actactan SET TAXCODE = NULL, TAXNAME = '' WHERE INLIST(LEFT(scd, 3), '531', '512')
		
			
		Select actactan
		* Sterg liniile cu 0 doar daca am inregistrari cu suma <> 0, altfel nu gasesc inregistrari 411 = xxx la salvarea facturii si da eroare
		Locate For suma <> 0
		If Found()
			Delete For suma = 0
		Endif
		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
			*!*		dezaloca_numar_bf()		&&	oserii_numere.prg
			*!*		Do dezaloca_numar_fact In oserii_numere.prg
			poGeneratorNumere.dezaloca_numere()
			Use In actactan
			Use In Select('crsBonDetaliat')
			Use In Select('crsalteserv')	&&	modificare	v 2.0.28
			Return
		Endif
		
		Select actactan
		*!*	modificare	v 2.1.0
		*!*	Replace All id_fact With -1
		Replace id_fact With -1 For id_fact <> -5
		*!*	modificare	v 2.1.0	^
		*!*	lnSucces = oscrie_in_fisiere()	&&	modificare	v 2.0.28
		Use In crsavansuri_complet
		
		*!*	modificare	v 2.0.28
		*!*	If lnSucces>0
		*!*		lcSql = [begin pack_devize.dev_completeaza_rul(?gcS,?pcSirIdLucrare,?pcSeparator); end;]
		*!*		lnSucces = goExecutor.oExecute(lcSql)
		*!*		If lnSucces < 0
		*!*			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		*!*			Use In Select('crsBonDetaliat')
		*!*			Return
		*!*		Endif
		*!*	modificare	v 2.0.28	^
		Thisform.AlwaysOnTop = .F.
		If Empty(pnDiscountN)
			Store 0 To lnProcDiscN,pnDiscountN,pnDiscountTvaN
		Endif
		
		If Empty(pnDiscountM)
			Store 0 To lnProcDiscM,pnDiscountM,pnDiscountTvaM
		Endif
		*!*	modificare	v 2.0.28
		*!*		Do listare_FACTURA With ocomanda.id_partener,'actactan',pcSirNrOrd,ocomanda.nrinmat,4,lnProcDiscM ,lnProcDiscN,-pnDiscountM,-pnDiscountN,pnDiscountTvaM,pnDiscountTvaN,'MANOPERA',0 In oproceduri_listari
		*!*	modificare	v 2.0.35	: am adaugat pcSirIdOrdl
		*!*	modificare	v 2.0.41	: am adaugat pcSirIdLucrare
		If !factureaza_deviz(ocomanda.id_lucrare,pcSirNrOrd,ocomanda.nrinmat,[],1,-pnDiscountM,-pnDiscountN,lnProcDiscM,lnProcDiscN,IIF(pnAchitAsigurator = 1,ocomanda.id_ordl,Null),pcSirIdOrdl,pcSirIdLucrare)	&&	in oproceduri_devize.prg
			poGeneratorNumere.dezaloca_numere()
		Else
			Thisform.actualizeaza_grid1()
		Endif
		*!*	modificare	v 2.0.28	^
		
		Thisform.AlwaysOnTop = .T.
		*!*	Thisform.actualizeaza_grid1()	&&	modificare	v 2.0.28
		Select crscomenzi
		If Reccount('crscomenzi')>=lnPozitieCursor
			Go lnPozitieCursor
		Endif
		*!*	modificare	v 2.0.28
		*!*	Else
		*!*		*!*		dezaloca_numar_bf()		&&	oserii_numere.prg
		*!*		*!*		Do dezaloca_numar_fact In oserii_numere.prg
		*!*		poGeneratorNumere.dezaloca_numere()
		*!*	Endif
		*!*	modificare	v 2.0.28	^
		*!*	modificare	v 2.0.21
		Use In Select('crsBonDetaliat')
		Use In Select('crsalteserv')	&&	modificare	v 2.0.28
		*!*	modificare	v 2.0.21	^
		 
	ENDPROC

	PROCEDURE do_listare
		lnOptiune = xmenu('Listare deviz;Listare raport comanda;\-;Relistare factura')
		If Empty(m.lnOptiune)
			Return
		Endif
		
		Do Case
			Case m.lnOptiune = 1
				If Reccount('crscomenzi')>0
					Private porul,pooper,pcschema1,pcselect1,poFirma
					Store '' To porul,pooper,poFirma
		
					Select crscomenzi
					lnRecno = Recno()
					Use In (Select('crsdevize'))
					Calculate Sum(ales) To lnAlese
					If lnAlese = 0
						Select * From crscomenzi Where Recno() = lnRecno Into Cursor crsdevize
					Else
						Select * From crscomenzi With (Buffering = .T.) Where ales = 1 Into Cursor crsdevize
					Endif
		
					Select crsdevize
					Scan
						Scatter Name ocomanda
						listare_comanda_deviz(Thisform,ocomanda)
					Endscan
					Use In (Select('crsdevize'))
		
					Select crscomenzi
					Go lnRecno
					Thisform.grdcomenzi.SetFocus()
				Else
					amessagebox("Nu ati selectat nici o comanda!",0+48,"Atentie")
					Thisform.grdcomenzi.SetFocus()
				Endif
			Case m.lnOptiune = 2
				If Reccount('crscomenzi') > 0
					Thisform.AlwaysOnTop = .F.
					lnIdOrdl = crscomenzi.id_ordl
					Do listare_precomanda With m.lnIdOrdl
					Thisform.AlwaysOnTop = .T.
				Endif
			Case m.lnOptiune = 4
				This.do_relisteaza_factura()
		Endcase
		
	ENDPROC

	PROCEDURE do_modifica
		*!* 29.01.2016
		*!* marius.mutu
		*!* se permite schimbarea si a masinii nu numai a clientului cu aceeasi masina
		
		If Reccount('crscomenzi')>0 And Thisform.cmd_modifica1.Enabled
			Private pnButon,pnIdMasiniClient, pcNrordNou
			LOCAL lcNrInmat
			pcNrordNou = ''
			Store 0 To pnButon,pnIdMasiniClient
			Use In (SELECT('crsclienti'))
		
			Select crscomenzi
			lnPozitieCursor=Recno()
			Scatter Name loRec
			
			*!* se permite schimbarea si a masinii nu numai a clientului cu aceeasi masina
			LOCAL lcNrInmat, lcNrInmatVechi, lcNrOrdNou, lcNrOrdVechi
			lcNrInmat = Alltrim(loRec.nrinmat)
			lcNrInmatVechi = Alltrim(loRec.nrinmat)	
			lcNrOrdVechi = ALLTRIM(lorec.nrord)
			lnOptiune = xmenu('Alt client cu aceeasi \<masina ' + m.lcNrInmat + ';Alt \<client cu alta masina')
		
			IF m.lnOptiune = 2
				lcNrInmat = INPUTBOX('Numarul masinii','Introduceti numarul masinii', m.lcNrInmat)
			ENDIF
			lcNrInmat = UPPER(ALLTRIM(IIF(EMPTY(m.lcNrInmat), m.lcNrInmatVechi, m.lcNrInmat))) 
			lcNrOrdNou = ALLTRIM(STRTRAN(lcNrOrdVechi, m.lcNrInmatVechi, m.lcNrinmat))
			
			lcSql=[select id_masiniclient,series,seriem,culoare,kmint,marca,masina,partener,]+;
				[cod_fiscal,adresa from ]+gcS+[.auto_vmasiniclienti_simplu ]+;
				[where nrinmat=']+m.lcNrInmat+[' and id_masiniclient<>]+Alltrim(Str(loRec.id_masiniclient))
			lnSucces=goExecutor.oExecute(lcSql,'crsclienti')
			If lnSucces<0
				amessagebox(goExecutor.cEroare,0+16,'Eroare')
				Return
			Endif
			If Reccount('crsclienti')=0
				amessagebox("Nu exista alti clienti cu acest numar de masina!",0+48,"Atentie")
				Use In crsclienti
				Return
			Endif
			ofrmmodificarecom=Createobject('frm_modificare_mc',loRec.nrord,loRec.nume)
			ofrmmodificarecom.Show(1)
			Release ofrmmodificarecom
			Use In crsclienti
			If pnButon=1
				lcSql=[begin pack_auto.modifica_client_comanda(']+gcS+[',]+;
					Alltrim(Str(loRec.id_ordl))+[,]+Alltrim(Str(pnIdMasiniClient))+[,]+;
					ALLTRIM(Str(gnIdUtil))+[); end;]
				lnSucces=goExecutor.oExecute(lcSql)
				If lnSucces<0
					amessagebox(goExecutor.cEroare,0+16,"Eroare")
					RETURN
				ELSE
					IF m.lcNrOrdNou <> m.lcNrOrdVechi
						AMESSAGEBOX('Se va schimba si numarul comenzii din ' + m.lcNrOrdVechi + ' in ' + m.lcNrOrdNou + '!',0+48,_screen.Caption)
						pcNrordNou = m.lcNrordNou
						lcSql = [update nom_lucrari set nrord = ?pcNrordNou where id_lucrare = (select MIN(id_lucrare) from dev_ordl where id_ordl = ] + ALLTRIM(STR(loRec.id_ordl)) + [)] 
						llSucces=goExecutor.oExecuta(lcSql)
					ENDIF 	
				Endif
				Thisform.actualizeaza_grid1()
				Select crscomenzi
				If Reccount('crscomenzi')>=lnPozitieCursor
					Go lnPozitieCursor
				Endif
			Endif
		Endif
		
	ENDPROC

	PROCEDURE do_relisteaza_factura
		Thisform.AlwaysOnTop = .F.
		Do alege_facturi_relistare WITH 'crsComenzi' In oproceduri_devize.prg
		Thisform.grdcomenzi.SetFocus()
		Thisform.AlwaysOnTop = .T.
		
	ENDPROC

	PROCEDURE do_reset
		With Thisform
			For i=1 To .Objects.Count
				If Upper(.Objects(i).BaseClass)='CHECKBOX'
					.Objects(i).Value=0
				Endif
			Endfor
		Endwith
		Thisform.opt_facturat.Value=Thisform.opt_facturat.ndefault
		Thisform.opt_validat.Value=Thisform.opt_validat.ndefault
		Thisform.ck_nrord.SetFocus()
		
	ENDPROC

	PROCEDURE do_sterge
		*!*	Private pnvalidat,pnid_ordl,pcnrord,pnrecno,pnfacturat
		*!*	Select crscomenzi
		*!*	pnvalidat=Validat
		*!*	pnid_ordl=id_ordl
		*!*	pnfacturat=facturat
		*!*	pcnrord=nrord
		*!*	pnrecno=Recno()
		*!*	If pnvalidat>0 AND pnfacturat=0
		*!*		If amessagebox("Sunteti sigur ca doriti sa anulati validarea comenzii "+Alltrim(pcnrord)+" ?",4+32+256,"Confirmare")==6
		*!*			Thisform.LockScreen=.T.
		*!*			Thisform.MousePointer= 11
		*!*			lcSql=[begin pack_devize.dev_invalideaza_comanda('] + Alltrim(gcS) + [',] + Alltrim(Str(pnid_ordl)) + [,] + Alltrim(Str(gnIdutil)) + [); end;]
		*!*			lnSucces=goExecutor.oExecute(lcSql)
		*!*			Thisform.MousePointer= 0
		*!*			Thisform.LockScreen=.F.
		
		*!*			If lnSucces < 0
		*!*				amessagebox(goExecutor.cEroare,0+16,'Eroare')
		*!*				Return
		*!*			Endif
		*!*			Thisform.actualizeaza_grid1()
		*!*			Go pnrecno
		*!*		Endif
		*!*	Else
		*!*		amessagebox("Aceasta comanda nu este validata!",0+48,"Atentie")
		*!*	Endif
		
	ENDPROC

	PROCEDURE do_storneaza_avans
		*!*	modificare	v 2.0.38	:	am adaugat tcSirIdOrdl
		*!*	modificare	v 2.0.41	:	am adaugat tcSirIdLucrare
		Lparameters tnIncasat,tcSirNrOrd,tnDevizeMultiple,tcSirIdOrdl,tcSirIdLucrare
		Local lnLungime
		*!*	If amessagebox("Se achita factura cu bon fiscal?",4+32+256,"Confirmare") = 7
		*!*		Return .T.
		*!*	Endif
		
		Thisform.MousePointer=11
		Thisform.LockScreen=.T.
		
		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.
		
		*!*	modificare	v 2.0.28
		*!*	If !Isnull(gnid_fdoc_factura)
		If !Isnull(gnid_fdoc_fact)
			*!*	modificare	v 2.0.28	^
			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]=Alltrim(Str(gnid_fdoc_fact))
			*!*	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
		Endif
		
		If !Isnull(gnid_casa_achit) And tnIncasat <> 0
			*!*	modificare	v 2.0.28
			If Used('v_nom_casa')
				Use In v_nom_casa
			Endif
			lcSql=[select id_part,nume from ] + gcS + [.vnom_casa_lei where id_part = ?gnId_casa_achit]
			lnSucces=goExecutor.oExecute(lcSql,'v_nom_casa')
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,0+16,'Eroare')
				lcNumeCasa = [<CASA LEI>]
			Else
				Select v_nom_casa
				lcNumeCasa = Alltrim(nume)
				Use In v_nom_casa
			Endif
			Dimension taValori[lnLungime+2,3]
			taValori[lnLungime+1,1]="poAct.v53110"
			taValori[lnLungime+1,2]=Alltrim(lcNumeCasa)
			taValori[lnLungime+1,3]=.T.
			taValori[lnLungime+2,1]="poAct.id_vv53110"
			taValori[lnLungime+2,2]=Alltrim(Str(gnid_casa_achit))
			taValori[lnLungime+2,3]=.T.
			lnLungime=lnLungime+2
			*!*		Select v_nom_casa
			*!*		Locate For id_part = gnid_casa_achit
			*!*		If Found()
			*!*			Dimension taValori[lnLungime+2,3]
			*!*			taValori[lnLungime+1,1]="poAct.v53110"
			*!*			taValori[lnLungime+1,2]=Alltrim(nume)
			*!*			taValori[lnLungime+1,3]=.T.
			*!*			taValori[lnLungime+2,1]="poAct.id_vv53110"
			*!*			taValori[lnLungime+2,2]=Alltrim(Str(id_part))
			*!*			taValori[lnLungime+2,3]=.T.
			*!*			lnLungime=lnLungime+2
			*!*		Endif
			*!*	modificare	v 2.0.28	^
		Endif
		
		Thisform.MousePointer=0
		Thisform.LockScreen=.F.
		
		Thisform.AlwaysOnTop=.F.
		If gnAvans419=1
			Dimension taValori[lnLungime+2,3]
			taValori[lnLungime+1,1]="poAct.v419"
			taValori[lnLungime+1,2]=Alltrim(ocomanda.nume)
			taValori[lnLungime+1,3]=.T.
			taValori[lnLungime+2,1]="poAct.id_vv419"
			taValori[lnLungime+2,2]=Alltrim(Str(ocomanda.id_partener))
			taValori[lnLungime+2,3]=.T.
			lans(31013,.F.,.T.,@taValori)
		Else
			lans(31012,.F.,.T.,@taValori)	&&   id_set,daca se executa procedura de mai multe ori,
			&& daca verifica analiticele,array de valori
		Endif
		Thisform.AlwaysOnTop=.T.
		
		If buton=2
			poGeneratorNumere.dezaloca_numere()
			Return .F.
		Endif
		
		Private poDateFactSt,poDateDispPlata
		Select actactan
		*!*	modificare	v 2.1.0
		local lnTvaIncasare
		calculate max(tva_incasare) to lnTvaIncasare
		*!*	modificare	v 2.1.0	^
		Go Top
		Scatter Name poDateAct
		Locate For nr_nota = 3
		Scatter Name poDateDispPlata
		Delete All
		Insert Into actactan(nr_nota,luna,an,cod,datairegt,dataireg,dataact,serie_act,nract,dataactt,datascad,suma,explicatia,scd,ascd,;
			scc,ascc,pereched,perechec,explicatia4,explicatia5,datascadt,nnir,id_util,util,dataora,;
			id_responsabil,nresp,id_venchelt,dst_chlt,id_lucrare,nrord,id_ctr,contract,id_sectie,sectie,;
			proc_tva,id_set,id_fact,id_factd,id_factc,id_partd,partd,id_partc,partc,id_sucursala,sucursala,;
			id_fdoc,fdoc,id_gestin,id_jtva_coloana,taxcode,gestin,id_gestout,gestout,id_valuta,nume_val) ;
			Select Recno() As nr_nota,poDateAct.luna As luna,poDateAct.an As an,poDateAct.cod As cod,poDateAct.datairegt As datairegt,;
			poDateAct.dataireg As dataireg,poDateAct.dataact As dataact,poDateAct.serie_act As serie_act,poDateAct.nract As nract,poDateAct.dataactt As dataactt,poDateAct.dataact As datascad,;
			(-1) * avans As suma,[STORNARE AVANS] As explicatia,scd,ascd,scc,ascc,poDateAct.pereched As pereched,poDateAct.perechec As perechec,;
			NVL(poDateAct.explicatia4,[]) As explicatia4,Alltrim(Nvl(poDateAct.explicatia5,[])) As explicatia5,poDateAct.dataactt As datascadt,poDateAct.nnir As nnir,;
			poDateAct.id_util As id_util,poDateAct.util As util,poDateAct.dataora As dataora,poDateAct.id_responsabil As id_responsabil,;
			poDateAct.nresp As nresp,poDateAct.id_venchelt As id_venchelt,poDateAct.dst_chlt As dst_chlt,id_lucrare,nrord,poDateAct.id_ctr As id_ctr,;
			poDateAct.contract As contract,id_sectie,sectie,proc_tva,poDateAct.id_set As id_set,poDateAct.id_fact As id_fact,;
			poDateAct.id_factd As id_factd,poDateAct.id_factc As id_factc,id_partd,partd,id_partc,partc,;
			poDateAct.id_sucursala As id_sucursala,poDateAct.sucursala As sucursala,poDateAct.id_fdoc As id_fdoc,poDateAct.fdoc As fdoc,;
			poDateAct.id_gestin As id_gestin,id_jtva_coloana,;
			GetTaxCodeIdPart(m.gnAn, m.gnLuna, poDateAct.dataact, crsavansuri_complet.id_jtva_coloana, crsavansuri_complet.id_partd), ;
			poDateAct.gestin As gestin,poDateAct.id_gestout As id_gestout,;
			poDateAct.gestout As gestout,poDateAct.id_valuta As id_valuta,poDateAct.nume_val As nume_val ;
			From crsavansuri_complet
		
		Insert Into actactan(nr_nota,luna,an,cod,datairegt,dataireg,dataact,nract,dataactt,datascad,suma,explicatia,scd,ascd,;
			scc,ascc,pereched,perechec,explicatia4,explicatia5,datascadt,nnir,id_util,util,dataora,;
			id_responsabil,nresp,id_venchelt,dst_chlt,id_lucrare,nrord,id_ctr,contract,id_sectie,sectie,;
			proc_tva,id_set,id_fact,id_factd,id_factc,id_partd,partd,id_partc,partc,id_sucursala,sucursala,;
			id_fdoc,fdoc,id_gestin,id_jtva_coloana,gestin,id_gestout,gestout,id_valuta,nume_val) ;
			SELECT Recno()+Reccount(),poDateDispPlata.luna,poDateDispPlata.an,poDateDispPlata.cod,poDateDispPlata.datairegt,;
			poDateDispPlata.dataireg,poDateDispPlata.dataact,poDateDispPlata.nract,poDateDispPlata.dataactt,;
			{},(-1)*incasat,[DISPOZITIE DE PLATA],poDateDispPlata.scd,ascc,poDateDispPlata.scc,ascd,;
			poDateDispPlata.pereched,poDateDispPlata.perechec,Nvl(poDateDispPlata.explicatia4,[]),;
			ALLTRIM(Nvl(poDateDispPlata.explicatia5,[])),poDateDispPlata.datascadt,poDateDispPlata.nnir,;
			poDateDispPlata.id_util,poDateDispPlata.util,poDateDispPlata.dataora,;
			poDateDispPlata.id_responsabil,poDateDispPlata.nresp,0,[],;
			id_lucrare,nrord,0,[],0,[],0.00,poDateDispPlata.id_set,poDateDispPlata.id_fact,poDateDispPlata.id_factd,poDateDispPlata.id_factc,;
			poDateDispPlata.id_partd,poDateDispPlata.partd,poDateDispPlata.id_partc,poDateDispPlata.partc,poDateDispPlata.id_sucursala,poDateDispPlata.sucursala,;
			gnId_Fdoc_Dispplata,[DISPOZITIE DE PLATA],;
			poDateDispPlata.id_gestin,00000000000,poDateDispPlata.gestin,poDateDispPlata.id_gestout,;
			poDateDispPlata.gestout,poDateDispPlata.id_valuta,poDateDispPlata.nume_val From crsavansuri_complet Where incasat <> 0
		*!*	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
		
		Select actactan
		replace all tva_incasare with lnTvaIncasare	&&	modificare	v 2.1.0
		Go Top
		Private buton
		buton=1
		If !verificare_note_contabile('actactan', .T.,.T., .F.)
			Do Form verificare With .T.
		Endif
		If buton=2
			Use In actactan
			poGeneratorNumere.dezaloca_numere()
			Return .F.
		Endif
		
		*!*	modificare	v 2.0.28
		*!*	Select actactan
		*!*	lnSucces = oscrie_in_fisiere()
		
		*!*	If lnSucces>0
		*!*		poGeneratorNumere.ResetAll()
		Thisform.AlwaysOnTop = .F.
		*!*		Do listare_avans With ocomanda.id_partener,'actactan',tcSirNrOrd,ocomanda.nrinmat,tnDevizeMultiple
		*!*	modificare	v 2.0.35
		*!*	If !factureaza_deviz(ocomanda.id_lucrare,tcSirNrOrd,ocomanda.nrinmat,[],tnDevizeMultiple)
		*!*	modificare	v 2.0.41	:	am adaugat tcSirIdLucrare
		If !factureaza_deviz(ocomanda.id_lucrare,tcSirNrOrd,ocomanda.nrinmat,[],tnDevizeMultiple,,,,,,tcSirIdOrdl,tcSirIdLucrare)
		*!*	modificare	v 2.0.35	^
			poGeneratorNumere.dezaloca_numere()
			Return .F.
		Else
			poGeneratorNumere.ResetAll()
		Endif
		Thisform.AlwaysOnTop = .T.
		*!*	Else
		*!*		poGeneratorNumere.dezaloca_numere()
		*!*		Return .F.
		*!*	Endif
		*!*	modificare	v 2.0.28	^
		Return .T.
	ENDPROC

	PROCEDURE do_verifica_com
	ENDPROC

	PROCEDURE do_verifica_part
		Lparameters tcSirIdOrdl,toComanda
		Thisform.MousePointer=11
		Thisform.LockScreen=.T.
		
		lcSql=[select a.nrord,to_char(a.datai,'DD/MM/YYYY') as datai ] + ;
			[from ] + gcS + [.auto_normare_comenzi a ] + ;
			[left join ] + gcS + [.dev_masiniclienti b on a.id_masiniclient = b.id_masiniclient ] + ;
			[where a.id_masiniclient = ] + Alltrim(Str(toComanda.id_masiniclient)) + [ ] + ;
			[and a.id_ordl not in (] + tcSirIdOrdl + [) ] + ;
			[and a.facturat = 0 ] + ;
			[and ] + gcCondLuna + [ ] + ;
			[and b.id_partener = ] + Alltrim(Str(toComanda.id_partener)) + [ ] + ;
			[order by a.datai]
		lnSucces=goExecutor.oExecute(lcSql,'crsverificari')
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		Endif
		
		Thisform.MousePointer=0
		Thisform.LockScreen=.F.
		
		pniesire=1
		ofrmverificari = Createobject("frm_rezultate_verificari_part")
		ofrmverificari.lb_client.Caption = "Client: " + Alltrim(Nvl(toComanda.nume,''))
		ofrmverificari.Show(1)
		Release ofrmverificari
		Use In crsverificari
		Return pniesire
	ENDPROC

	PROCEDURE Init
		DoDefault()
		Thisform.grdcomenzi.SetAll("DynamicForeColor","IIF(facturat=1,RGB(128,128,128),RGB(0,0,0))","Column")
		Thisform.grdcomenzi.cales.ReadOnly = .F.
		
	ENDPROC

	PROCEDURE verifica_stornare
	ENDPROC

	PROCEDURE grdcomenzi.AfterRowColChange
		Lparameters nColIndex
		If This.RowColChange!=2
			Select crscomenzi
			DoDefault()
		*!*	modificare 07.06
		*!*		Do Case
		*!*		Case Validat=0
		*!*			Thisform.cmd_factavans.Enabled=.T.
		*!*			Thisform.cmd_factfinal.Enabled=.F.
		*!*	*!*			Thisform.cmd_vizualizare.Enabled=.F.
		*!*		Case Facturat = 1
		*!*			Thisform.cmd_factavans.Enabled=.F.
		*!*			Thisform.cmd_factfinal.Enabled=.F.
		*!*		Otherwise
		*!*			Thisform.cmd_factavans.Enabled=.T.
		*!*			Thisform.cmd_factfinal.Enabled=.T.
		*!*			Thisform.cmd_vizualizare.Enabled=.T.
		*!*		Endcase
		*!*	modificare 07.06	^
			Thisform.cmd_modifica1.Enabled=Iif(Empty(nrfact),.T.,.F.)
		Endif
		
	ENDPROC

	PROCEDURE opt_validat.Click
		If This.Value=3
			Thisform.opt_facturat.Value=3
			Thisform.opt_facturat.Enabled=.F.
		Else
			Thisform.opt_facturat.Enabled=.T.
		Endif
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_factact AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="grdfacturi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cDatai.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cDatai.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNume.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNume.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cExplicatia.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cExplicatia.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNrFact.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNrFact.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cDataFact.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cDataFact.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cSuma.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cSuma.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cScd.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cScd.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cScc.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cScc.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cSerie_act.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cSerie_act.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_total" UniqueID="" Timestamp="" />

	*<PropValue>
		cgridsortlist = grdfacturi
		DoCreate = .T.
		Height = 382
		Name = "frm_factact"
		Width = 793
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Tag = "RESIZABLE,NOVERTICAL_RESIZE"
		_shape1.Top = 0
		_shape1.Width = 792
		_shape1.ZOrderSet = 0
		_shape2.Height = 29
		_shape2.Left = 756
		_shape2.Name = "_shape2"
		_shape2.Tag = "MOVABLE,NOVERTICAL_MOVE"
		_shape2.Top = -1
		_shape2.Width = 38
		_shape2.ZOrderSet = 8
		Lb_titlu_alb_b121.Caption = "VIZUALIZARE FACTURI EMISE PENTRU COMANDA"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 10
		Lb_titlu_alb_b121.ZOrderSet = 1
		BUT_TERMIN1.Left = 762
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 8
		BUT_TERMIN1.Tag = "MOVABLE,NOVERTICAL_MOVE"
		BUT_TERMIN1.Top = 0
		BUT_TERMIN1.ZOrderSet = 11
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'Clb_total' AS clb_tx_simplu WITH ;
		Left = 490, ;
		Name = "Clb_total", ;
		TabStop = .F., ;
		Top = 347, ;
		TEXT_SIMPLU1.Alignment = 3, ;
		TEXT_SIMPLU1.Format = "R", ;
		TEXT_SIMPLU1.InputMask = (get_mask(12,gnPc)), ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.ReadOnly = .T., ;
		TEXT_SIMPLU1.Value = 0, ;
		LB_SIMPLU1.Caption = "Total", ;
		LB_SIMPLU1.Name = "LB_SIMPLU1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'grdfacturi' AS _grdrow WITH ;
		ColumnCount = 9, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		Height = 300, ;
		Left = 17, ;
		Name = "grdfacturi", ;
		Panel = 1, ;
		RecordSource = "crsfacturi", ;
		TabIndex = 7, ;
		Tag = "RESIZABLE", ;
		Top = 36, ;
		Width = 763, ;
		ZOrderSet = 2, ;
		Column1.ColumnOrder = 1, ;
		Column1.ControlSource = "TTOD(datai)", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cDatai", ;
		Column1.Width = 65, ;
		Column2.ColumnOrder = 5, ;
		Column2.ControlSource = "nume", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cNume", ;
		Column2.Width = 160, ;
		Column3.ColumnOrder = 6, ;
		Column3.ControlSource = "explicatia", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.Name = "cExplicatia", ;
		Column3.Width = 116, ;
		Column4.ColumnOrder = 3, ;
		Column4.ControlSource = "nract", ;
		Column4.FontName = "Arial Narrow", ;
		Column4.InputMask = (get_mask(14,0)), ;
		Column4.Name = "cNrFact", ;
		Column5.ColumnOrder = 4, ;
		Column5.ControlSource = "TTOD(dataact)", ;
		Column5.FontName = "Arial Narrow", ;
		Column5.Name = "cDataFact", ;
		Column6.ColumnOrder = 7, ;
		Column6.ControlSource = "suma", ;
		Column6.FontName = "Arial Narrow", ;
		Column6.Format = "R", ;
		Column6.InputMask = (get_mask(12,gnPc)), ;
		Column6.Name = "cSuma", ;
		Column6.Width = 113, ;
		Column7.ColumnOrder = 8, ;
		Column7.ControlSource = "scd", ;
		Column7.FontName = "Arial Narrow", ;
		Column7.Name = "cScd", ;
		Column7.Width = 56, ;
		Column8.ColumnOrder = 9, ;
		Column8.ControlSource = "scc", ;
		Column8.FontName = "Arial Narrow", ;
		Column8.Name = "cScc", ;
		Column8.Width = 62, ;
		Column9.ColumnOrder = 2, ;
		Column9.ControlSource = "serie_act", ;
		Column9.FontName = "Arial Narrow", ;
		Column9.Name = "cSerie_act", ;
		Column9.Width = 63
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdfacturi.cDataFact.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data factura", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cDataFact.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cDatai.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cDatai.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cExplicatia.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Explicatia", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cExplicatia.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cNrFact.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. factura", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cNrFact.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cNume.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nume client", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cNume.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cScc.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cont creditor", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cScc.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cScd.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cont debitor", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cScd.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cSerie_act.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Serie factura", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cSerie_act.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cSuma.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Suma", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cSuma.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />
	
	PROCEDURE Init
		DoDefault()
		Select crsfacturi
		Calculate Sum(suma) For scd='4111' To lnSuma
		Calculate Sum(suma) For scd='667' To lnSumaDisc
		Go Top
		Thisform.clb_total.text_simplu1.Value=lnSuma-lnSumaDisc
	ENDPROC

	PROCEDURE grdfacturi.AfterRowColChange
		Lparameters nColIndex
		If This.RowColChange!=2
			DoDefault()
		Endif
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_incasare_avans AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_shape3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_totalftva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_totalctva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="LB_SIMPLU1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cb_casa" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="opt_incasat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_modifica1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_nrchit" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cbo_explicatie_tva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_explicatie_tva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_serie_chit" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="chkPOS" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_aloca_nr_bon
		*m: do_calculeaza
		*p: cseriechit
		*p: nnrbon
		*p: nnrchit
		*p: npos		&& Incasare bon fiscal numerar = 0; CARD POS = 1
		*p: nproc_tva
		*p: nrezultatserii
	*</DefinedPropArrayMethod>

	*<PropValue>
		cseriechit = 
		DoCreate = .T.
		Height = 312
		Name = "frm_incasare_avans"
		nnrbon = 0
		nnrchit = 0
		npos = 0
		nproc_tva = 0
		nrezultatserii = 0
		Width = 530
		_memberdata = <VFPData>
			<memberdata name="npos" display="nPOS"/>
		</VFPData>
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 551
		_shape1.ZOrderSet = 1
		_shape2.Height = 29
		_shape2.Left = 489
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 64
		_shape2.ZOrderSet = 2
		Lb_titlu_alb_b121.Caption = "FACTURĂ AVANS"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 11
		Lb_titlu_alb_b121.ZOrderSet = 3
		BUT_TERMIN1.Left = 497
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 8
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 4
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT '_shape3' AS _shape WITH ;
		BackColor = 255,255,255, ;
		Height = 110, ;
		Left = 12, ;
		Name = "_shape3", ;
		Top = 184, ;
		Width = 324, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="shape" />

	ADD OBJECT 'But_modifica1' AS but_modifica WITH ;
		caction = do_modifica, ;
		Height = 27, ;
		Left = 299, ;
		Name = "But_modifica1", ;
		TabIndex = 4, ;
		Top = 197, ;
		Width = 30, ;
		ZOrderSet = 14
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Left = 467, ;
		Name = "But_renunt1", ;
		TabIndex = 10, ;
		Top = 1, ;
		ZOrderSet = 11
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cb_casa' AS cb_tx_simplu WITH ;
		Left = 30, ;
		Name = "Cb_casa", ;
		TabIndex = 7, ;
		Top = 254, ;
		ZOrderSet = 10, ;
		_CBBASE1.Name = "_CBBASE1", ;
		_CBBASE1.RowSource = "v_nom_casa.nume,id_part", ;
		_CBBASE1.RowSourceType = 6, ;
		_LBBASE1.Caption = "Casa", ;
		_LBBASE1.Name = "_LBBASE1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'cbo_explicatie_tva' AS combobox WITH ;
		BorderColor = 128,128,128, ;
		BorderStyle = 1, ;
		ColumnCount = 2, ;
		ColumnLines = .F., ;
		ColumnWidths = "200,10", ;
		ControlSource = "", ;
		FontSize = 10, ;
		Height = 20, ;
		InputMask = "", ;
		Left = 309, ;
		Name = "cbo_explicatie_tva", ;
		RowSource = "jtva_coloane.denumire,cota_tva", ;
		RowSourceType = 6, ;
		SpecialEffect = 1, ;
		Style = 2, ;
		TabIndex = 14, ;
		TabStop = .F., ;
		Top = 67, ;
		Visible = .T., ;
		Width = 213
		*< END OBJECT: BaseClass="combobox" />

	ADD OBJECT 'chkPOS' AS _checkbox WITH ;
		Alignment = 0, ;
		Caption = "POS", ;
		ControlSource = "thisform.nPOS", ;
		Left = 276, ;
		Name = "chkPOS", ;
		ToolTipText = "Incasare bon fiscal prin CARD la POS", ;
		Top = 233, ;
		Visible = .F.
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Clb_nrchit' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 30, ;
		Name = "Clb_nrchit", ;
		TabIndex = 6, ;
		Top = 226, ;
		Width = 229, ;
		ZOrderSet = 15, ;
		TEXT_SIMPLU1.Alignment = 3, ;
		TEXT_SIMPLU1.ControlSource = "Thisform.nnrchit", ;
		TEXT_SIMPLU1.Format = "RK", ;
		TEXT_SIMPLU1.Height = 23, ;
		TEXT_SIMPLU1.InputMask = "999 999 999 999 999", ;
		TEXT_SIMPLU1.Left = 101, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Top = 3, ;
		TEXT_SIMPLU1.Value = 0, ;
		TEXT_SIMPLU1.Width = 123, ;
		LB_SIMPLU1.Caption = "Nr. chitanță", ;
		LB_SIMPLU1.Name = "LB_SIMPLU1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_serie_chit' AS clb_serie_act WITH ;
		cvariabila = cseriechit, ;
		cvariabiladoc = nnrchit, ;
		Height = 29, ;
		Left = 30, ;
		Name = "Clb_serie_chit", ;
		nid_tipdoc = 16, ;
		pcobj = Thisform, ;
		TabIndex = 5, ;
		Top = 198, ;
		Visible = .F., ;
		Width = 290, ;
		Text_simplu1.ControlSource = "Thisform.cseriechit", ;
		Text_simplu1.Left = 101, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.TabIndex = 2, ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 184, ;
		_cbbase1.Height = 23, ;
		_cbbase1.Left = 101, ;
		_cbbase1.Name = "_cbbase1", ;
		_cbbase1.TabIndex = 1, ;
		_cbbase1.Top = 3, ;
		_cbbase1.Width = 184, ;
		_lbbase1.Caption = "Serie chitanță", ;
		_lbbase1.Name = "_lbbase1", ;
		_lbbase1.TabIndex = 3
		*< END OBJECT: ClassLib="..\comun\clase\serii_numere.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_totalctva' AS clb_tx_simplu WITH ;
		Left = 11, ;
		Name = "Clb_totalctva", ;
		TabIndex = 2, ;
		Top = 105, ;
		ZOrderSet = 7, ;
		TEXT_SIMPLU1.Alignment = 3, ;
		TEXT_SIMPLU1.Format = "RK", ;
		TEXT_SIMPLU1.InputMask = (get_mask(12,gnPc)), ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.TerminateRead = .T., ;
		TEXT_SIMPLU1.Value = 0, ;
		LB_SIMPLU1.Caption = "Total cu TVA", ;
		LB_SIMPLU1.Name = "LB_SIMPLU1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_totalftva' AS clb_tx_simplu WITH ;
		Left = 11, ;
		Name = "Clb_totalftva", ;
		TabIndex = 1, ;
		Top = 49, ;
		ZOrderSet = 5, ;
		TEXT_SIMPLU1.Alignment = 3, ;
		TEXT_SIMPLU1.Format = "RK", ;
		TEXT_SIMPLU1.InputMask = (get_mask(12,gnPc)), ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Value = 0, ;
		LB_SIMPLU1.Caption = "Total fără TVA", ;
		LB_SIMPLU1.Name = "LB_SIMPLU1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tva' AS clb_tx_simplu WITH ;
		Left = 11, ;
		Name = "Clb_tva", ;
		TabIndex = 9, ;
		TabStop = .F., ;
		Top = 77, ;
		ZOrderSet = 6, ;
		TEXT_SIMPLU1.Alignment = 3, ;
		TEXT_SIMPLU1.Format = "RK", ;
		TEXT_SIMPLU1.InputMask = (get_mask(12,gnPc)), ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.ReadOnly = .T., ;
		TEXT_SIMPLU1.Value = 0, ;
		LB_SIMPLU1.Caption = "Total TVA", ;
		LB_SIMPLU1.Name = "LB_SIMPLU1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'lb_explicatie_tva' AS label WITH ;
		AutoSize = .T., ;
		BackStyle = 0, ;
		Caption = "Explicație TVA", ;
		FontCharSet = 238, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Height = 18, ;
		Left = 310, ;
		Name = "lb_explicatie_tva", ;
		TabIndex = 13, ;
		Top = 50, ;
		Visible = .T., ;
		Width = 88
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'LB_SIMPLU1' AS lb_simplu WITH ;
		BackColor = 255,255,255, ;
		BackStyle = 1, ;
		Caption = "Detalii încasare", ;
		Left = 20, ;
		Name = "LB_SIMPLU1", ;
		TabIndex = 12, ;
		Top = 177, ;
		ZOrderSet = 9
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'opt_incasat' AS _optiongrup WITH ;
		AutoSize = .T., ;
		ButtonCount = 3, ;
		Height = 27, ;
		Left = 34, ;
		Name = "opt_incasat", ;
		TabIndex = 3, ;
		Top = 138, ;
		Width = 291, ;
		ZOrderSet = 13, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Fără încasare", ;
		Option1.FontCharSet = 238, ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Bon fiscal", ;
		Option2.Left = 112, ;
		Option2.Name = "Option2", ;
		Option2.Top = 5, ;
		Option3.AutoSize = .T., ;
		Option3.BackStyle = 0, ;
		Option3.Caption = "Chitanță", ;
		Option3.FontCharSet = 238, ;
		Option3.Height = 17, ;
		Option3.Left = 222, ;
		Option3.Name = "Option3", ;
		Option3.Top = 5, ;
		Option3.Width = 64
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />
	
	PROCEDURE do_aloca_nr_bon
		Lparameters tcActiune
		Local lnNumarBon
		Store -1 To lnNumarBon
		If Empty(Thisform.nnrbon) Or Upper(tcActiune)='UPDATE'
			*!*		lnNumarBon = aloca_numar_bf()	&&	in oserii_numere.prg
			poGeneratorNumere.creeaza_cursor_serii(3)
			lnNumarBon = poGeneratorNumere.aloca_numar(3)
			If lnNumarBon <> -1
				Thisform.clb_nrchit.text_simplu1.Value = lnNumarBon
				Thisform.nnrbon = lnNumarBon
				Thisform.nnrchit = Thisform.nnrbon
			Endif
		Else
			Thisform.nnrchit = Thisform.nnrbon
		Endif
		Thisform.clb_nrchit.text_simplu1.Refresh()		&&	modificare	v 2.0.41
		
	ENDPROC

	PROCEDURE do_calculeaza
		Lparameters tcnume
		lnTotftva=Thisform.clb_totalftva.texT_SIMPLU1.Value
		lnTottva=Thisform.clb_tva.texT_SIMPLU1.Value
		lnTotctva=Thisform.clb_totalctva.texT_SIMPLU1.Value
		Do Case
		Case tcnume='TOTAL'
			lnTottva=Round(lnTotftva*(pnProcTva-1),gnPC)
			lnTotctva=lnTotftva+lnTottva
			pnPretCuTva = 0		&&	modificare	v 2.0.41
		Case tcnume='TVA'
			lnTotftva=Round(lnTottva/(pnProcTva-1),gnPC)
			lnTotctva=lnTotftva+lnTottva
			pnPretCuTva = 0		&&	modificare	v 2.0.41
		Case tcnume='TOTALCTVA'
			lnTottva=Round(Round(lnTotctva*(pnProcTva-1),gnPC)/pnProcTva,gnPC)
			lnTotftva=lnTotctva-lnTottva
			pnPretCuTva = 1		&&	modificare	v 2.0.41
		Endcase
		Thisform.clb_totalftva.texT_SIMPLU1.Value=lnTotftva
		Thisform.clb_tva.texT_SIMPLU1.Value=lnTottva
		Thisform.clb_totalctva.texT_SIMPLU1.Value=lnTotctva
		
	ENDPROC

	PROCEDURE do_modifica
		Private pniesire
		pniesire=0
		DO viz_config_serii_complet WITH 3 IN oserii_numere.prg
		If pniesire=1
		*!*		dezaloca_numar_bf()
			poGeneratorNumere.dezaloca_numar(3)
			Thisform.do_aloca_nr_bon([UPDATE])
		Endif
	ENDPROC

	PROCEDURE inainte_de_do_renunt
		If Type('poGeneratorNumere') = 'O' And This.opt_incasat.Value = 3 And Thisform.nRezultatSerii <> 0
			poGeneratorNumere.dezaloca_numar(16)
		Endif
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local llReturn
		Store .T. To llReturn
		pnTotalfTva=Thisform.clb_totalftva.text_simplu1.Value
		pnTotalTva=Thisform.clb_tva.text_simplu1.Value
		pnTotalcTva=Thisform.clb_totalctva.text_simplu1.Value
		
		pnPOS = thisform.nPOS && incasare bon fiscal prin CARD POS
		*!*	modificare	v 2.0.35
		Do Case
			Case pnTotalfTva = 0
				amessagebox("Totalul fara TVA nu poate fi 0!",48,"Atentie")
				Thisform.clb_totalftva.text_simplu1.SetFocus()
				llReturn = .F.
			Case pnTotalcTva = 0
				amessagebox("Totalul cu TVA nu poate fi 0!",48,"Atentie")
				Thisform.clb_totalctva.text_simplu1.SetFocus()
				llReturn = .F.
			Otherwise
		*!*	modificare	v 2.0.35	^
				If Thisform.opt_incasat.Value>1
					pnIdCasa=v_nom_casa.id_part
					pcCasa=Thisform.cb_casa._CBBASE1.Value
					pnTipIncasare=Thisform.opt_incasat.Value
					If pnTipIncasare=3
						If !Empty(Thisform.nnrbon)
							poGeneratorNumere.dezaloca_numar(3)
						Endif
						poGeneratorNumere.verifica_numar(16,Thisform.nnrchit)
					Endif
					*!*	modificare	v 2.0.28
					pcSerieChit = Thisform.cseriechit
					pnNrChit=Thisform.nnrchit &&	Thisform.clb_nrchit.text_simplu1.Value
					*!*	modificare	v 2.0.28	^
					lcDocument=Iif(pnTipIncasare=2,[bonului],[chitantei])
					If pnNrChit<=0
						amessagebox("Numarul "+lcDocument+" trebuie sa fie diferit de 0!",0+48,"Atentie")
						Thisform.clb_nrchit.SetFocus()
						llReturn=.F.
					Endif
					If pnIdCasa=0 Or Empty(pcCasa)
						amessagebox("Nu ati ales casa!",0+48,"Atentie")
						Thisform.cb_casa.SetFocus()
						llReturn=.F.
					Endif
				Endif
		*!*	modificare	v 2.0.35
		Endcase
		*!*	modificare	v 2.0.35	^
		Return llReturn
	ENDPROC

	PROCEDURE Init
		*!*	modificare	v 2.0.41
		Lparameters tnTvaIncasare,tnTip
		*!*	tnTip :
		*!*		1	-	fara TVA
		*!*		2	-	cu TVA
		*!*		0	-	ambele
		Do Case
			Case tnTip = 1
				Thisform.clb_totalctva.text_simplu1.ReadOnly = .T.
				Thisform.clb_totalftva.text_simplu1.SetFocus()
			Case tnTip = 2
				Thisform.clb_totalftva.text_simplu1.ReadOnly = .T.
				Thisform.clb_totalctva.text_simplu1.SetFocus()
			Otherwise
				*!*	le las asa
		Endcase
		*!*	modificare	v 2.0.41	^
		DoDefault()
		Thisform.Height = Thisform.opt_incasat.Top + Thisform.opt_incasat.Height + 10	&&	modificare	v 2.0.41
		Thisform.cb_casa.Enabled=.F.
		Thisform.clb_nrchit.text_simplu1.ReadOnly=.T.
		Thisform.AutoCenter=.T.
		Thisform.Refresh
		Select v_nom_casa
		Locate For id_part=gnid_casa_achit
		If Found()
			Thisform.cb_casa._CBBASE1.Value=Alltrim(nume)
		Endif
		Select jtva_coloane
		*!*	modificare	v 2.1.0
		*!*	Set Filter To Inlist(cota_tva,0,gnCotaTVAStandard*100-100)	&&	modificare	v 2.0.22
		If empty(tnTvaIncasare)
			Set Filter To Inlist(cota_tva,0,gnCotaTVAStandard*100-100) and isnull(id_jtva_ex)
		Else
			Set Filter To Inlist(cota_tva,0,gnCotaTVAStandard*100-100) and isnull(id_jtva_neex)
		Endif
		*!*	modificare	v 2.1.0	^
		Locate For id_jtva_coloana = pnIdJtvaColoana
		If !Found()
			Go Top
			pnIdJtvaColoana = id_jtva_coloana
		Endif
		pnIdTva = id_tva
		pnProcTva = (cota_tva+100)/100
		This.cbo_explicatie_tva.Value = Alltrim(denumire)
		
	ENDPROC

	PROCEDURE cbo_explicatie_tva.InteractiveChange
		Select jtva_coloane
		pnIdJtvaColoana = id_jtva_coloana
		pnIdTva = id_tva
		pnProcTva = (cota_tva+100)/100
		Thisform.do_calculeaza('TOTAL')
	ENDPROC

	PROCEDURE chkPOS.Valid
		IF this.Value = 0
			thisform.cb_casa._lbbase1.Caption = 'Casa'
		ELSE
			thisform.cb_casa._lbbase1.Caption = 'Banca POS'
		ENDIF 
		thisform.cb_casa._lbbase1.Refresh()
	ENDPROC

	PROCEDURE Clb_nrchit.TEXT_SIMPLU1.InteractiveChange
		If Thisform.opt_incasat.Value = 3
			Thisform.clb_serie_chit.genereazaNumar()
		Endif
	ENDPROC

	PROCEDURE Clb_serie_chit._cbbase1.InteractiveChange
		This.Parent.genereazaNumar()
	ENDPROC

	PROCEDURE Clb_totalctva.TEXT_SIMPLU1.GotFocus
		this.Tag=ALLTRIM(STR(this.value,20,4))
	ENDPROC

	PROCEDURE Clb_totalctva.TEXT_SIMPLU1.LostFocus
		If Alltrim(Str(This.Value,20,4))!=This.Tag
			Thisform.do_calculeaza('TOTALCTVA')
		Endif
		
	ENDPROC

	PROCEDURE Clb_totalftva.TEXT_SIMPLU1.GotFocus
		this.Tag=ALLTRIM(STR(this.value,20,4))
	ENDPROC

	PROCEDURE Clb_totalftva.TEXT_SIMPLU1.LostFocus
		If Alltrim(Str(This.Value,20,4))!=This.Tag
			Thisform.do_calculeaza('TOTAL')
		Endif
	ENDPROC

	PROCEDURE Clb_tva.TEXT_SIMPLU1.GotFocus
		this.Tag=ALLTRIM(STR(this.value,20,4))
	ENDPROC

	PROCEDURE Clb_tva.TEXT_SIMPLU1.LostFocus
		If Alltrim(Str(This.Value,20,4))!=This.Tag
			Thisform.do_calculeaza('TVA')
		Endif
		
	ENDPROC

	PROCEDURE opt_incasat.Click
		Do Case
			Case This.Value=1 && Fara incasare
				Thisform.Height = This.Top + This.Height + 10	&&	modificare	v 2.0.41
				Thisform.cb_casa.Enabled=.F.
				Thisform.lactiv3=.F.
				Thisform.but_modifica1.Visible=.F.
				Thisform.clb_nrchit.text_simplu1.ReadOnly=.T.
				Thisform.clb_nrchit.text_simplu1.Value=0
				Thisform.clb_serie_chit.Visible = .F.		&&	modificare	v 2.0.28
				poGeneratorNumere.dezaloca_numar(16)		&&	modificare	v 2.0.28
				thisform.chkPOS.Value = 0					&& modificare v 2.1.14
				thisform.chkPOS.Visible = .F.				&& modificare v 2.1.14		
			Case This.Value=2 && Bon fiscal
				Thisform.Height = Thisform._shape3.Top + Thisform._shape3.Height + 10	&&	modificare	v 2.0.41
				Thisform.cb_casa.Enabled=.T.
				Thisform.clb_nrchit.lB_SIMPLU1.Caption=[Nr. bon]
				Thisform.lactiv3=.T.
				Thisform.but_modifica1.Visible=.T.
				Thisform.clb_nrchit.text_simplu1.ReadOnly=.T.
				Thisform.do_aloca_nr_bon([CLICK])
				Thisform.clb_serie_chit.Visible = .F.		&&	modificare	v 2.0.28
				poGeneratorNumere.dezaloca_numar(16)		&&	modificare	v 2.0.28
				thisform.chkPOS.Value = 0					&& modificare v 2.1.14
				thisform.chkPOS.Visible = .T.				&& modificare v 2.1.14		
			Case This.Value=3  && Chitanta
				Thisform.Height = Thisform._shape3.Top + Thisform._shape3.Height + 10	&&	modificare	v 2.0.41
				Thisform.cb_casa.Enabled=.T.
				Thisform.clb_nrchit.lB_SIMPLU1.Caption=[Nr. chitanță]
				Thisform.lactiv3=.F.
				Thisform.but_modifica1.Visible=.F.
				Thisform.clb_nrchit.text_simplu1.ReadOnly=.F.
				Thisform.clb_nrchit.text_simplu1.Value=0
				thisform.chkPOS.Value = 0					&& modificare v 2.1.14
				thisform.chkPOS.Visible = .F.				&& modificare v 2.1.14
				*!*	modificare	v 2.0.28
				Thisform.clb_serie_chit.Visible = .T.
				If Thisform.nRezultatSerii = 0
					Thisform.nRezultatSerii = poGeneratorNumere.creeaza_cursor_serii(16)
					Thisform.clb_serie_chit.do_initializeaza(Thisform.nRezultatSerii)
					If !Empty(Nvl(Thisform.cseriechit,[]))
						If Thisform.nRezultatSerii <> 1
							Select (Thisform.clb_serie_chit._cbbase1.RowSource)
							Locate For Alltrim(serie) = Alltrim(Thisform.cseriechit)
							If !Found()
								Go Top
							Endif
							Thisform.clb_serie_chit._cbbase1.Value = Alltrim(serie)
						Endif
					Endif
				Endif
				Thisform.clb_serie_chit.genereazaNumar()
				*!*	modificare	v 2.0.28	^
		Endcase
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_incasare_finala AS _frmbase OF "..\comun\clase\_frm_base.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_totalfact" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_shape3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_shape4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_manopera" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tvam" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_procdiscm" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_materiale" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tvan" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_procdiscn" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_avans" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_totaldeviz" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_discountm" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_discountn" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tvadiscm" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tvadiscn" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_explicatie_tva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="LB_SIMPLU1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cb_casa" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_nrchit" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_incasat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_totaldisc" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu7" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu8" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu9" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu10" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu11" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu13" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu15" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu18" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu17" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_achit_asigurator" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="opt_incasat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_modifica1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cbo_explicatie_tva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_altele" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_altele.cDenumire.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_altele.cDenumire.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_altele.cNrord.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_altele.cNrord.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_altele.cCantitate.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_altele.cCantitate.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_altele.cPretFTva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_altele.cPretFTva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_altele.cValoareftva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grd_altele.cValoareftva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_nou1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_sterge1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="chkPOS" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_serie_chit" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: actualizeaza_tipincasare
		*m: calculeaza_total
		*m: do_aloca_nr_bon
		*m: do_calculeaza
		*m: do_modifica_alteserv
		*m: do_recalculeaza_total
		*m: verifica_tipincasare
		*p: cseriechit
		*p: navans
		*p: navansfaratva
		*p: nbondifftva
		*p: nbondiftva
		*p: nincasat
		*p: nnrbon
		*p: nnrchit
		*p: npos		&& Incasare bon fiscal numerar = 0; CARD POS = 1
		*p: nrezultatserii
		*p: ntvamateriale
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 1
		cseriechit = 
		DoCreate = .T.
		FontCharSet = 238
		Height = 577
		lactiv4 = .T.
		Name = "frm_incasare_finala"
		navans = 0
		navansfaratva = 0
		nbondifftva = 0
		nbondiftva = 0
		nincasat = 0
		nnrbon = 0
		nnrchit = 0
		npos = 0
		nrezultatserii = 0
		ntvamateriale = 0
		Width = 775
		_memberdata = <VFPData>
			<memberdata name="ntvamateriale" display="nTVAMateriale"/>
			<memberdata name="nrezultatserii" display="nRezultatSerii"/>
			<memberdata name="npos" display="nPOS"/>
		</VFPData>
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 792
		_shape1.ZOrderSet = 3
		_shape2.Height = 29
		_shape2.Left = 711
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 64
		_shape2.ZOrderSet = 4
		Lb_titlu_alb_b121.Caption = "FACTURA FINALA"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 24
		Lb_titlu_alb_b121.ZOrderSet = 5
		BUT_TERMIN1.Left = 744
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 11
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 10
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT '_shape3' AS _shape WITH ;
		BackColor = 255,255,255, ;
		Height = 132, ;
		Left = 389, ;
		Name = "_shape3", ;
		Top = 269, ;
		Visible = .F., ;
		Width = 337, ;
		ZOrderSet = 1
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="shape" />

	ADD OBJECT '_shape4' AS _shape WITH ;
		BackColor = 255,255,255, ;
		Height = 360, ;
		Left = 22, ;
		Name = "_shape4", ;
		Top = 48, ;
		Width = 356, ;
		ZOrderSet = 2
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="shape" />

	ADD OBJECT 'But_modifica1' AS but_modifica WITH ;
		Left = 668, ;
		Name = "But_modifica1", ;
		TabIndex = 13, ;
		Top = 281, ;
		ZOrderSet = 44
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_nou1' AS but_nou WITH ;
		Anchor = 12, ;
		Left = 694, ;
		Name = "But_nou1", ;
		TabIndex = 5, ;
		Top = 402, ;
		ZOrderSet = 47
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Left = 715, ;
		Name = "But_renunt1", ;
		TabIndex = 12, ;
		Top = 1, ;
		ZOrderSet = 24
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_sterge1' AS but_sterge WITH ;
		Anchor = 12, ;
		Left = 726, ;
		Name = "But_sterge1", ;
		TabIndex = 45, ;
		Top = 402, ;
		Visible = .T., ;
		ZOrderSet = 48
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cb_casa' AS cb_tx_simplu WITH ;
		Left = 399, ;
		Name = "Cb_casa", ;
		TabIndex = 10, ;
		Top = 365, ;
		Visible = .F., ;
		ZOrderSet = 25, ;
		_CBBASE1.Name = "_CBBASE1", ;
		_CBBASE1.RowSource = "v_nom_casa.nume,id_part", ;
		_CBBASE1.RowSourceType = 6, ;
		_LBBASE1.Caption = "Casa", ;
		_LBBASE1.Name = "_LBBASE1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'cbo_explicatie_tva' AS combobox WITH ;
		BorderColor = 128,128,128, ;
		BorderStyle = 1, ;
		ColumnCount = 2, ;
		ColumnLines = .F., ;
		ColumnWidths = "200,10", ;
		ControlSource = "", ;
		FontSize = 10, ;
		Height = 20, ;
		InputMask = "", ;
		Left = 144, ;
		Name = "cbo_explicatie_tva", ;
		RowSource = "jtva_coloane.denumire,cota_tva", ;
		RowSourceType = 6, ;
		SpecialEffect = 1, ;
		Style = 2, ;
		TabIndex = 14, ;
		TabStop = .F., ;
		Top = 66, ;
		Visible = .T., ;
		Width = 231, ;
		ZOrderSet = 45
		*< END OBJECT: BaseClass="combobox" />

	ADD OBJECT 'chkPOS' AS _checkbox WITH ;
		Alignment = 0, ;
		Caption = "POS", ;
		ControlSource = "thisform.nPOS", ;
		Left = 647, ;
		Name = "chkPOS", ;
		ToolTipText = "Incasare bon fiscal prin CARD la POS", ;
		Top = 342, ;
		Visible = .F.
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'ck_achit_asigurator' AS _checkbox WITH ;
		Alignment = 0, ;
		Caption = "Se achita de catre asigurator", ;
		Left = 397, ;
		Name = "ck_achit_asigurator", ;
		TabIndex = 46, ;
		Top = 408, ;
		ZOrderSet = 50
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Clb_avans' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 391, ;
		Name = "Clb_avans", ;
		TabIndex = 15, ;
		TabStop = .F., ;
		Top = 149, ;
		Width = 337, ;
		ZOrderSet = 14, ;
		Text_simplu1.Alignment = 1, ;
		Text_simplu1.Format = "RK", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Left = 205, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Value = 0, ;
		Text_simplu1.Width = 126, ;
		Lb_simplu1.Caption = "Avans cu TVA facturat", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_discountm' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 34, ;
		Name = "Clb_discountm", ;
		TabIndex = 2, ;
		Top = 178, ;
		Width = 302, ;
		ZOrderSet = 17, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.Format = "RK", ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Left = 112, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Discount", ;
		Lb_simplu1.Left = 4, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_discountn' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 34, ;
		Name = "Clb_discountn", ;
		TabIndex = 4, ;
		Top = 337, ;
		Width = 302, ;
		ZOrderSet = 18, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.Format = "RK", ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Left = 112, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Discount", ;
		Lb_simplu1.Left = 4, ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_incasat' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 399, ;
		Name = "Clb_incasat", ;
		TabIndex = 9, ;
		Top = 337, ;
		Visible = .F., ;
		Width = 244, ;
		ZOrderSet = 27, ;
		Text_simplu1.ControlSource = "thisform.nincasat", ;
		Text_simplu1.Format = "RK", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Left = 101, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 138, ;
		Lb_simplu1.Caption = "Încasat", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_manopera' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 34, ;
		Name = "Clb_manopera", ;
		TabIndex = 18, ;
		TabStop = .F., ;
		Top = 94, ;
		Width = 302, ;
		ZOrderSet = 7, ;
		TEXT_SIMPLU1.Alignment = 3, ;
		TEXT_SIMPLU1.Format = "RK", ;
		TEXT_SIMPLU1.InputMask = (get_mask(12,gnPc)), ;
		TEXT_SIMPLU1.Left = 112, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.ReadOnly = .T., ;
		TEXT_SIMPLU1.Top = 3, ;
		TEXT_SIMPLU1.Value = 0, ;
		LB_SIMPLU1.Caption = "Manopera", ;
		LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		LB_SIMPLU1.Top = 6
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_materiale' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 34, ;
		Name = "Clb_materiale", ;
		TabIndex = 19, ;
		TabStop = .F., ;
		Top = 253, ;
		Width = 302, ;
		ZOrderSet = 11, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.Format = "RK", ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Left = 112, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Materiale", ;
		Lb_simplu1.Left = 4, ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_nrchit' AS clb_tx_simplu WITH ;
		Left = 399, ;
		Name = "Clb_nrchit", ;
		TabIndex = 8, ;
		Top = 309, ;
		Visible = .F., ;
		ZOrderSet = 26, ;
		TEXT_SIMPLU1.Alignment = 3, ;
		TEXT_SIMPLU1.ControlSource = "Thisform.nnrchit", ;
		TEXT_SIMPLU1.Format = "RK", ;
		TEXT_SIMPLU1.InputMask = "999 999 999 999 999", ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Value = 0, ;
		LB_SIMPLU1.Caption = "Nr. chitanta", ;
		LB_SIMPLU1.Name = "LB_SIMPLU1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_procdiscm' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 34, ;
		Name = "Clb_procdiscm", ;
		TabIndex = 1, ;
		Top = 150, ;
		Width = 302, ;
		ZOrderSet = 9, ;
		TEXT_SIMPLU1.Alignment = 3, ;
		TEXT_SIMPLU1.Format = "RK", ;
		TEXT_SIMPLU1.InputMask = "999.99", ;
		TEXT_SIMPLU1.Left = 112, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.Value = 0, ;
		LB_SIMPLU1.Caption = "Procent discount", ;
		LB_SIMPLU1.Left = 4, ;
		LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		LB_SIMPLU1.Top = 6
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_procdiscn' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 34, ;
		Name = "Clb_procdiscn", ;
		TabIndex = 3, ;
		Top = 309, ;
		Width = 302, ;
		ZOrderSet = 13, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.Format = "RK", ;
		Text_simplu1.InputMask = "999.99", ;
		Text_simplu1.Left = 112, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Procent discount", ;
		Lb_simplu1.Left = 4, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_serie_chit' AS clb_serie_act WITH ;
		cvariabila = cseriechit, ;
		cvariabiladoc = nnrchit, ;
		Height = 29, ;
		Left = 399, ;
		Name = "Clb_serie_chit", ;
		nid_tipdoc = 16, ;
		pcobj = Thisform, ;
		TabIndex = 7, ;
		Top = 281, ;
		Visible = .F., ;
		Width = 290, ;
		ZOrderSet = 49, ;
		Text_simplu1.ControlSource = "Thisform.cseriechit", ;
		Text_simplu1.Left = 101, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.TabIndex = 2, ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 184, ;
		_cbbase1.Height = 23, ;
		_cbbase1.Left = 101, ;
		_cbbase1.Name = "_cbbase1", ;
		_cbbase1.TabIndex = 1, ;
		_cbbase1.Top = 3, ;
		_cbbase1.Width = 184, ;
		_lbbase1.Caption = "Serie chitanta", ;
		_lbbase1.Name = "_lbbase1", ;
		_lbbase1.TabIndex = 3
		*< END OBJECT: ClassLib="..\comun\clase\serii_numere.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_totaldeviz' AS clb_tx_simplu WITH ;
		Height = 51, ;
		Left = 391, ;
		Name = "Clb_totaldeviz", ;
		TabIndex = 20, ;
		TabStop = .F., ;
		Top = 49, ;
		Width = 337, ;
		ZOrderSet = 15, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.Format = "RK", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Left = 205, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 25, ;
		Text_simplu1.Value = 0, ;
		Text_simplu1.Width = 126, ;
		Lb_simplu1.Caption = "Total deviz cu TVA", ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 27
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_totaldisc' AS clb_tx_simplu WITH ;
		Height = 51, ;
		Left = 391, ;
		Name = "Clb_totaldisc", ;
		TabIndex = 21, ;
		TabStop = .F., ;
		Top = 99, ;
		Width = 337, ;
		ZOrderSet = 28, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.Format = "RK", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Left = 205, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 25, ;
		Text_simplu1.Value = 0, ;
		Text_simplu1.Width = 126, ;
		Lb_simplu1.Caption = "Total discount cu TVA", ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 27
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_totalfact' AS clb_nr_intre WITH ;
		Height = 51, ;
		Left = 391, ;
		Name = "Clb_totalfact", ;
		TabIndex = 25, ;
		Top = 177, ;
		Width = 337, ;
		ZOrderSet = 0, ;
		tx_n1.Alignment = 1, ;
		tx_n1.Height = 23, ;
		tx_n1.InputMask = (get_mask(12,gnPc)), ;
		tx_n1.Left = 57, ;
		tx_n1.Name = "tx_n1", ;
		tx_n1.ReadOnly = .T., ;
		tx_n1.Top = 26, ;
		tx_n1.Width = 126, ;
		Lb_simplu1.Caption = "Total factura", ;
		Lb_simplu1.FontBold = .T., ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		tx_n2.Alignment = 1, ;
		tx_n2.FontBold = .T., ;
		tx_n2.Height = 23, ;
		tx_n2.InputMask = (get_mask(12,gnPc)), ;
		tx_n2.Left = 205, ;
		tx_n2.Name = "tx_n2", ;
		tx_n2.ReadOnly = .T., ;
		tx_n2.Top = 26, ;
		tx_n2.Width = 126
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tvadiscm' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 34, ;
		Name = "Clb_tvadiscm", ;
		TabIndex = 17, ;
		TabStop = .F., ;
		Top = 206, ;
		Width = 302, ;
		ZOrderSet = 19, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.Format = "RK", ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Left = 112, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "TVA", ;
		Lb_simplu1.Left = 4, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tvadiscn' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 34, ;
		Name = "Clb_tvadiscn", ;
		TabIndex = 16, ;
		TabStop = .F., ;
		Top = 365, ;
		Width = 302, ;
		ZOrderSet = 20, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.Format = "RK", ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Left = 112, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "TVA", ;
		Lb_simplu1.Left = 4, ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tvam' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 34, ;
		Name = "Clb_tvam", ;
		TabIndex = 23, ;
		TabStop = .F., ;
		Top = 122, ;
		Width = 302, ;
		ZOrderSet = 8, ;
		TEXT_SIMPLU1.Alignment = 3, ;
		TEXT_SIMPLU1.Format = "RK", ;
		TEXT_SIMPLU1.InputMask = (get_mask(12,gnPc)), ;
		TEXT_SIMPLU1.Left = 112, ;
		TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		TEXT_SIMPLU1.ReadOnly = .T., ;
		TEXT_SIMPLU1.Top = 3, ;
		TEXT_SIMPLU1.Value = 0, ;
		LB_SIMPLU1.Caption = "TVA manopera", ;
		LB_SIMPLU1.Left = 4, ;
		LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		LB_SIMPLU1.Top = 6
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tvan' AS clb_tx_simplu WITH ;
		Height = 29, ;
		Left = 34, ;
		Name = "Clb_tvan", ;
		TabIndex = 22, ;
		TabStop = .F., ;
		Top = 281, ;
		Width = 302, ;
		ZOrderSet = 12, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.Format = "RK", ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Left = 112, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "TVA materiale", ;
		Lb_simplu1.Left = 4, ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'grd_altele' AS _grdrow WITH ;
		Anchor = 14, ;
		ColumnCount = 5, ;
		DeleteMark = .F., ;
		FontCharSet = 1, ;
		FontSize = 10, ;
		Height = 132, ;
		Left = 22, ;
		Name = "grd_altele", ;
		Panel = 1, ;
		ReadOnly = .F., ;
		RecordSource = "crsalteserv", ;
		RowHeight = 19, ;
		TabIndex = 44, ;
		Top = 432, ;
		Width = 734, ;
		ZOrderSet = 46, ;
		Column1.ControlSource = "denumire", ;
		Column1.FontCharSet = 1, ;
		Column1.FontName = "Arial", ;
		Column1.FontSize = 10, ;
		Column1.Name = "cDenumire", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 331, ;
		Column2.ControlSource = "nrord", ;
		Column2.FontCharSet = 1, ;
		Column2.FontName = "Arial", ;
		Column2.FontSize = 10, ;
		Column2.Name = "cNrord", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 100, ;
		Column3.BackColor = 253,252,223, ;
		Column3.ControlSource = "cantitate", ;
		Column3.DynamicBackColor = "rgb(253,252,223)", ;
		Column3.FontCharSet = 1, ;
		Column3.FontName = "Arial", ;
		Column3.FontSize = 10, ;
		Column3.InputMask = (get_mask(7,gnPCant)), ;
		Column3.Name = "cCantitate", ;
		Column3.ReadOnly = .F., ;
		Column3.Width = 56, ;
		Column4.BackColor = 253,252,223, ;
		Column4.ControlSource = "pretftva", ;
		Column4.DynamicBackColor = "rgb(253,252,223)", ;
		Column4.FontCharSet = 1, ;
		Column4.FontName = "Arial", ;
		Column4.FontSize = 10, ;
		Column4.InputMask = (get_mask(14,gnPPretV)), ;
		Column4.Name = "cPretFTva", ;
		Column4.ReadOnly = .F., ;
		Column4.Width = 98, ;
		Column5.ControlSource = "valoareftva", ;
		Column5.FontCharSet = 1, ;
		Column5.FontName = "Arial", ;
		Column5.FontSize = 10, ;
		Column5.InputMask = (get_mask(14,gnPc)), ;
		Column5.Name = "cValoareftva", ;
		Column5.ReadOnly = .T., ;
		Column5.Width = 102
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grd_altele.cCantitate.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cantitate", ;
		FontCharSet = 1, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_altele.cCantitate.Text1' AS textbox WITH ;
		BackColor = 253,252,223, ;
		BorderStyle = 0, ;
		FontCharSet = 1, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .F., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_altele.cDenumire.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Denumire", ;
		FontCharSet = 1, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_altele.cDenumire.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontCharSet = 1, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_altele.cNrord.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Lucrare", ;
		FontCharSet = 1, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_altele.cNrord.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontCharSet = 1, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_altele.cPretFTva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret fara TVA", ;
		FontCharSet = 238, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_altele.cPretFTva.Text1' AS textbox WITH ;
		BackColor = 253,252,223, ;
		BorderStyle = 0, ;
		FontCharSet = 1, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .F., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grd_altele.cValoareftva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare fara TVA", ;
		FontCharSet = 1, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grd_altele.cValoareftva.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontCharSet = 1, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'lb_explicatie_tva' AS lb_simplu WITH ;
		BackColor = 255,255,255, ;
		BackStyle = 1, ;
		Caption = "Explicatie TVA", ;
		Left = 40, ;
		Name = "lb_explicatie_tva", ;
		TabIndex = 27, ;
		Top = 68, ;
		ZOrderSet = 21
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'LB_SIMPLU1' AS lb_simplu WITH ;
		BackColor = 255,255,255, ;
		BackStyle = 1, ;
		Caption = "Detalii încasare", ;
		Left = 403, ;
		Name = "LB_SIMPLU1", ;
		TabIndex = 26, ;
		Top = 263, ;
		Visible = .F., ;
		ZOrderSet = 23
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu10' AS lb_simplu WITH ;
		Caption = "(8)", ;
		FontSize = 10, ;
		Left = 128, ;
		Name = "Lb_simplu10", ;
		TabIndex = 36, ;
		Top = 370, ;
		ZOrderSet = 36
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu11' AS lb_simplu WITH ;
		Caption = "(9) = (1)+(2)+(5)+(6)", ;
		Left = 606, ;
		Name = "Lb_simplu11", ;
		TabIndex = 37, ;
		Top = 55, ;
		ZOrderSet = 37
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu13' AS lb_simplu WITH ;
		Caption = "(10) = (3)+(4)+(7)+(8)", ;
		Left = 604, ;
		Name = "Lb_simplu13", ;
		TabIndex = 39, ;
		Top = 105, ;
		ZOrderSet = 39
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu15' AS lb_simplu WITH ;
		Caption = "(11)", ;
		Left = 568, ;
		Name = "Lb_simplu15", ;
		TabIndex = 41, ;
		Top = 155, ;
		ZOrderSet = 41
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu17' AS lb_simplu WITH ;
		Caption = "Cu TVA ( (9)-(10)-(11) )", ;
		FontBold = .T., ;
		Left = 589, ;
		Name = "Lb_simplu17", ;
		TabIndex = 43, ;
		Top = 181, ;
		ZOrderSet = 42
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu18' AS lb_simplu WITH ;
		Caption = "Fara TVA", ;
		FontBold = .T., ;
		Left = 511, ;
		Name = "Lb_simplu18", ;
		TabIndex = 42, ;
		Top = 182, ;
		ZOrderSet = 42
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu2' AS lb_simplu WITH ;
		BackColor = 255,255,255, ;
		BackStyle = 1, ;
		Caption = "Detalii factura", ;
		Left = 32, ;
		Name = "Lb_simplu2", ;
		TabIndex = 28, ;
		Top = 42, ;
		ZOrderSet = 22
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu3' AS lb_simplu WITH ;
		Caption = "(2)", ;
		FontSize = 10, ;
		Left = 128, ;
		Name = "Lb_simplu3", ;
		TabIndex = 29, ;
		Top = 127, ;
		ZOrderSet = 29
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu4' AS lb_simplu WITH ;
		Caption = "(1)", ;
		FontSize = 10, ;
		Left = 128, ;
		Name = "Lb_simplu4", ;
		TabIndex = 30, ;
		Top = 99, ;
		ZOrderSet = 30
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu5' AS lb_simplu WITH ;
		Caption = "(3)", ;
		FontSize = 10, ;
		Left = 128, ;
		Name = "Lb_simplu5", ;
		TabIndex = 31, ;
		Top = 183, ;
		ZOrderSet = 31
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu6' AS lb_simplu WITH ;
		Caption = "(4)", ;
		FontSize = 10, ;
		Left = 128, ;
		Name = "Lb_simplu6", ;
		TabIndex = 32, ;
		Top = 211, ;
		ZOrderSet = 32
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu7' AS lb_simplu WITH ;
		Caption = "(5)", ;
		FontSize = 10, ;
		Left = 128, ;
		Name = "Lb_simplu7", ;
		TabIndex = 33, ;
		Top = 258, ;
		ZOrderSet = 33
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu8' AS lb_simplu WITH ;
		Caption = "(6)", ;
		FontSize = 10, ;
		Left = 128, ;
		Name = "Lb_simplu8", ;
		TabIndex = 34, ;
		Top = 286, ;
		ZOrderSet = 34
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu9' AS lb_simplu WITH ;
		Caption = "(7)", ;
		FontSize = 10, ;
		Left = 128, ;
		Name = "Lb_simplu9", ;
		TabIndex = 35, ;
		Top = 342, ;
		ZOrderSet = 35
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'opt_incasat' AS _optiongrup WITH ;
		AutoSize = .T., ;
		ButtonCount = 3, ;
		Height = 27, ;
		Left = 394, ;
		Name = "opt_incasat", ;
		TabIndex = 6, ;
		Top = 232, ;
		Width = 291, ;
		ZOrderSet = 43, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Fara încasare", ;
		Option1.FontCharSet = 238, ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Bon fiscal", ;
		Option2.Left = 112, ;
		Option2.Name = "Option2", ;
		Option2.Top = 5, ;
		Option3.AutoSize = .T., ;
		Option3.BackStyle = 0, ;
		Option3.Caption = "Chitanta", ;
		Option3.FontCharSet = 238, ;
		Option3.Height = 17, ;
		Option3.Left = 222, ;
		Option3.Name = "Option3", ;
		Option3.Top = 5, ;
		Option3.Width = 64
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />
	
	PROCEDURE actualizeaza_tipincasare
		Local lnValoare
		lnValoare = Thisform.opt_incasat.Value
		Do Case
			Case lnValoare=1 && fara incasare
				Thisform.cb_casa.Visible=.F.
				Thisform.clb_nrchit.Visible=.F.
				Thisform.clb_incasat.Visible=.F.
				Thisform._shape3.Visible=.F.
				Thisform.lb_simplu1.Visible=.F.
				Thisform.lactiv3=.F.
				Thisform.but_modifica1.Visible=.F.
				Thisform.clb_nrchit.text_simplu1.ReadOnly=.T.
				Thisform.clb_nrchit.text_simplu1.Value=0
				Thisform.clb_serie_chit.Visible = .F.		&&	modificare	v 2.0.28
				poGeneratorNumere.dezaloca_numar(16)		&&	modificare	v 2.0.28
				thisform.chkPOS.Value = 0					&& modificare v 2.1.14
				thisform.chkPOS.Visible = .F.				&& modificare v 2.1.14
			Case lnValoare=2 && bon fiscal
				Thisform.cb_casa.Visible=.T.
				Thisform.clb_nrchit.Visible=.T.
				Thisform.clb_nrchit.lb_simplu1.Caption=[Nr. bon]
				Thisform.clb_incasat.Visible=.T.
				Thisform._shape3.Visible=.T.
				Thisform.lb_simplu1.Visible=.T.
				Thisform.lactiv3=.T.
				Thisform.but_modifica1.Visible=.T.
				Thisform.clb_nrchit.text_simplu1.ReadOnly=.T.
				Thisform.do_aloca_nr_bon([CLICK])
				Thisform.clb_serie_chit.Visible = .F.		&&	modificare	v 2.0.28
				poGeneratorNumere.dezaloca_numar(16)		&&	modificare	v 2.0.28
				thisform.chkPOS.Value = 0					&& modificare v 2.1.14
				thisform.chkPOS.Visible = .T.				&& modificare v 2.1.14		
			Case lnValoare=3 && chitanta
				Thisform.cb_casa.Visible=.T.
				Thisform.clb_nrchit.Visible=.T.
				Thisform.clb_nrchit.lb_simplu1.Caption=[Nr. chitanță]
				Thisform.clb_incasat.Visible=.T.
				Thisform._shape3.Visible=.T.
				Thisform.lb_simplu1.Visible=.T.
				Thisform.lactiv3=.F.
				Thisform.but_modifica1.Visible=.F.
				Thisform.clb_nrchit.text_simplu1.ReadOnly=.F.
				Thisform.clb_nrchit.text_simplu1.Value=0
				thisform.chkPOS.Value = 0					&& modificare v 2.1.14
				thisform.chkPOS.Visible = .F.				&& modificare v 2.1.14		
				*!*	modificare	v 2.0.28
				Thisform.clb_serie_chit.Visible = .T.
				If Thisform.nRezultatSerii = 0
					Thisform.nRezultatSerii = poGeneratorNumere.creeaza_cursor_serii(16)
					Thisform.clb_serie_chit.do_initializeaza(Thisform.nRezultatSerii)
					If !Empty(Nvl(Thisform.cseriechit,[]))
						If Thisform.nRezultatSerii <> 1
							Select (Thisform.clb_serie_chit._cbbase1.RowSource)
							Locate For Alltrim(serie) = Alltrim(Thisform.cseriechit)
							If !Found()
								Go Top
							Endif
							Thisform.clb_serie_chit._cbbase1.Value = Alltrim(serie)
						Endif
					Endif
				Endif
				Thisform.clb_serie_chit.genereazaNumar()
				*!*	modificare	v 2.0.28	^
		Endcase
		*!*	modificare	v 2.0.23
		Thisform.do_recalculeaza_total()
		*!*	modificare	v 2.0.23	^
	ENDPROC

	PROCEDURE calculeaza_total
		Local lnManopera, lnMateriale, lnTvaM, lnTvaN, lnDiscountM, lnDiscountN, lnTvaDiscM, lnTvaDiscN, lnTotalDeviz, lnTotalDisc, ;
			lnAvans, lcCursor, lnProcTva, lnTotalAltele, lnTotalFTvaAltele
		lnManopera=Thisform.clb_manopera.text_simplu1.Value
		lnMateriale=Thisform.clb_materiale.text_simplu1.Value
		lnTvaM=Thisform.clb_tvam.text_simplu1.Value
		lnTvaN=Thisform.clb_tvan.text_simplu1.Value
		lnTotalDeviz=lnManopera+lnTvaM+lnMateriale+lnTvaN
		
		lnDiscountM=Thisform.clb_discountm.text_simplu1.Value
		lnTvaDiscM=Thisform.clb_tvadiscm.text_simplu1.Value
		lnDiscountN=Thisform.clb_discountn.text_simplu1.Value
		lnTvaDiscN=Thisform.clb_tvadiscn.text_simplu1.Value
		lnTotalDisc=lnDiscountM+lnTvaDiscM+lnDiscountN+lnTvaDiscN
		
		lnAvans=Thisform.clb_avans.text_simplu1.Value
		
		*!*	modificare	v 2.0.28
		*!*	lnTotalFact=lnTotalDeviz-lnTotalDisc-lnAvans
		lcCursor = Thisform.grd_altele.RecordSource
		If Reccount(lcCursor) > 0
			Select jtva_coloane
			lnProcTva = (cota_tva+100)/100
			Select (lcCursor)
			lnRecno = Recno()
			Calculate Sum(valoareftva+Round(valoareftva*(lnProcTva-1),gnPc)),sum(valoareftva) To lnTotalAltele,lnTotalFTvaAltele
			Go lnRecno
		Else
			lnTotalAltele = 0
			lnTotalFTvaAltele = 0
		Endif
		lnTotalFact=lnTotalDeviz-lnTotalDisc-lnAvans+lnTotalAltele
		*!*	modificare	v 2.0.28	^
		
		Thisform.clb_totaldeviz.text_simplu1.Value=lnTotalDeviz
		Thisform.clb_totaldisc.text_simplu1.Value=lnTotalDisc
		Thisform.clb_totalfact.tx_n1.Value = lnManopera + lnMateriale - lnDiscountM - lnDiscountN - Thisform.navansfaratva + lnTotalFTvaAltele
		Thisform.clb_totalfact.tx_n2.Value = lnTotalFact
		*!*	Thisform.clb_incasat.text_simplu1.Value=lnTotalFact
		Thisform.nincasat=lnTotalFact
		Thisform.clb_totalfact.tx_n1.Refresh()
		Thisform.clb_totalfact.tx_n2.Refresh()
		Thisform.clb_incasat.text_simplu1.Refresh()
	ENDPROC

	PROCEDURE do_adauga
		Local lcXMLArticole, lcCursor, lcCursorArt, loLucrare
		lcCursor = Thisform.grd_altele.RecordSource
		Thisform.LockScreen = .T.	&&	modificare	v 2.0.30
		Thisform.grd_altele.salveaza_grid()
		*!*	cauta lucrare ( in caz ca sunt mai multe lucrari selectate )
		If Type('pcSirIdLucrare') <> 'U'
			loLucrare = caut_lucrare(.F., .F., [id_lucrare in (]+pcSirIdLucrare+[)])
			If gnButon = 1 And !Empty(Nvl(loLucrare.id_lucrare,0))
				lnIdLucrare = loLucrare.id_lucrare
				lcNrOrd = loLucrare.nrord
			Else
				gnButon = 2
			Endif
		Else
			lnIdLucrare = ocomanda.id_lucrare
			lcNrOrd = ocomanda.nrord
			gnButon = 1				&&	modificare	v 2.0.30
		Endif
		If gnButon = 1
			lcXMLArticole = cauta_nom_articole([in_stoc = 0 and in_crm = 1 and id_articol not between -100008 and -100000])
			lcCursorArt = [crstmpart]
			If gnButon = 1
				Xmltocursor(lcXMLArticole, lcCursorArt)
				Select (lcCursorArt)
				Scan
					Scatter Name loArticol
					Select (lcCursor)
					Append Blank
					Replace id_articol With loArticol.id_articol,denumire With loArticol.denumire,um With loArticol.um,codmat With loArticol.codmat,;
						id_lucrare With lnIdLucrare,nrord With lcNrOrd
					Select (lcCursorArt)
				Endscan
				Use In (lcCursorArt)
				Select (lcCursor)
				Go Top
			Endif
		Endif
		Thisform.grd_altele.incarca_grid()
		Thisform.LockScreen = .F.	&&	modificare	v 2.0.30
		Thisform.grd_altele.cCantitate.SetFocus()
	ENDPROC

	PROCEDURE do_aloca_nr_bon
		Lparameters tcActiune
		Local lnNumarBon
		Store -1 To lnNumarBon
		If Empty(Thisform.nnrbon) Or Upper(tcActiune)='UPDATE'
		*!*		lnNumarBon = aloca_numar_bf()	&&	in oserii_numere.prg
			poGeneratorNumere.creeaza_cursor_serii(3)
			lnNumarBon = poGeneratorNumere.aloca_numar(3)
			If lnNumarBon <> -1
				Thisform.clb_nrchit.text_simplu1.Value = lnNumarBon
				Thisform.nnrbon = lnNumarBon
				Thisform.nnrchit = Thisform.nnrbon
			Endif
		Else
			Thisform.nnrchit = Thisform.nnrbon
		ENDIF
		Thisform.clb_nrchit.text_simplu1.Refresh()		&&	modificare	v 2.0.41
	ENDPROC

	PROCEDURE do_calculeaza
		Lparameters tcnume
		Local lcnume
		lcnume=Upper(tcnume)
		 
		Do Case
			Case lcnume='PROCDISCM'
				lnProcDisc=Thisform.clb_procdiscm.text_simplu1.Value
				lnManopera=Thisform.clb_manopera.text_simplu1.Value
				*!*	modificare	v 2.0.41
				*!*			lnDiscount=Round(lnManopera*Round(lnProcDisc/100,2),gnPc)
				*!*			lnTvaDiscM=Round(lnDiscount*(pnProcTva-1),gnPc)
				If glAutoBonDet
					lnTVAManopera = Thisform.clb_tvam.text_simplu1.Value
					lnDiscount = Round(Round((lnManopera+lnTVAManopera)*(lnProcDisc/100),gnPc)/pnProcTva,gnPc)
					lnTvaDiscM = Round((lnManopera+lnTVAManopera)*(lnProcDisc/100),gnPc) - lnDiscount
				Else
					lnDiscount=Round(lnManopera*(lnProcDisc/100),gnPc)
					lnTvaDiscM=Round(lnDiscount*(pnProcTva-1),gnPc)
				Endif
				*!*	modificare	v 2.0.41	^
				Thisform.clb_discountm.text_simplu1.Value=lnDiscount
				Thisform.clb_tvadiscm.text_simplu1.Value=lnTvaDiscM
			Case lcnume='DISCOUNTM'
				lnDiscount=Thisform.clb_discountm.text_simplu1.Value
				lnManopera=Thisform.clb_manopera.text_simplu1.Value
				lnTvaDiscM=Round(lnDiscount*(pnProcTva-1),gnPc)
				*!*	modificare	v 2.0.41
				*!*			lnProcDisc=Round(lnDiscount*100/lnManopera,2)
				If glAutoBonDet
					lnTVAManopera = Thisform.clb_tvam.text_simplu1.Value
					lnProcDisc=Round((lnDiscount+lnTvaDiscM)*100/(lnManopera+lnTVAManopera),2)
					lnDiscount = Round(Round((lnManopera+lnTVAManopera)*(lnProcDisc/100),gnPc)/pnProcTva,gnPc)
					lnTvaDiscM = Round((lnManopera+lnTVAManopera)*(lnProcDisc/100),gnPc) - lnDiscount
					Thisform.clb_discountm.text_simplu1.Value = lnDiscount
				Else
					lnProcDisc=Round(lnDiscount*100/lnManopera,2)
				Endif
				*!*	modificare	v 2.0.41	^
				Thisform.clb_procdiscm.text_simplu1.Value=lnProcDisc
				Thisform.clb_tvadiscm.text_simplu1.Value=lnTvaDiscM
			Case lcnume='PROCDISCN'
				lnProcDisc=Thisform.clb_procdiscn.text_simplu1.Value
				lnMateriale=Thisform.clb_materiale.text_simplu1.Value
				*!*	modificare	v 2.0.41
				*!*			lnDiscount=Round(lnMateriale*Round(lnProcDisc/100,2),gnPc)
				*!*			lnTvaDiscN=Round(lnDiscount*(pnProcTva-1),gnPc)
				If glAutoBonDet
					lnTVAMateriale = Thisform.clb_tvan.text_simplu1.Value
					lnDiscount = Round(Round((lnMateriale+lnTVAMateriale)*(lnProcDisc/100),gnPc)/pnProcTva,gnPc)
					lnTvaDiscN = Round((lnMateriale+lnTVAMateriale)*(lnProcDisc/100),gnPc) - lnDiscount
				Else
					lnDiscount=Round(lnMateriale*(lnProcDisc/100),gnPc)
					lnTvaDiscN=Round(lnDiscount*(pnProcTva-1),gnPc)
				Endif
				*!*	modificare	v 2.0.41	^
				Thisform.clb_discountn.text_simplu1.Value=lnDiscount
				Thisform.clb_tvadiscn.text_simplu1.Value=lnTvaDiscN
			Case lcnume='DISCOUNTN'
				lnDiscount=Thisform.clb_discountn.text_simplu1.Value
				lnMateriale=Thisform.clb_materiale.text_simplu1.Value
				lnTvaDiscN=Round(lnDiscount*(pnProcTva-1),gnPc)
				*!*	modificare	v 2.0.41
				*!*			lnProcDisc=Round(lnDiscount*100/lnMateriale,2)
				If glAutoBonDet
					lnTVAMateriale = Thisform.clb_tvan.text_simplu1.Value
					lnProcDisc=Round((lnDiscount+lnTvaDiscN)*100/(lnMateriale+lnTVAMateriale),2)
					lnDiscount = Round(Round((lnMateriale+lnTVAMateriale)*(lnProcDisc/100),gnPc)/pnProcTva,gnPc)
					lnTvaDiscN = Round((lnMateriale+lnTVAMateriale)*(lnProcDisc/100),gnPc) - lnDiscount
					Thisform.clb_discountn.text_simplu1.Value = lnDiscount
				Else
					lnProcDisc=Round(lnDiscount*100/lnMateriale,2)
				Endif
				*!*	modificare	v 2.0.41	^
				Thisform.clb_procdiscn.text_simplu1.Value=lnProcDisc
				Thisform.clb_tvadiscn.text_simplu1.Value=lnTvaDiscN
		Endcase
		Thisform.calculeaza_total()
	ENDPROC

	PROCEDURE do_modifica
		Private pniesire
		pniesire=0
		DO viz_config_serii_complet WITH 3 IN oserii_numere.prg
		If pniesire=1
		*!*		dezaloca_numar_bf()
			poGeneratorNumere.dezaloca_numar(3)
			Thisform.do_aloca_nr_bon([UPDATE])
		Endif
	ENDPROC

	PROCEDURE do_modifica_alteserv
		Local lcCursor
		lcCursor = Thisform.grd_altele.RecordSource
		Select (lcCursor)
		Replace valoareftva With cantitate * pretftva
		Thisform.do_recalculeaza_total()
	ENDPROC

	PROCEDURE do_recalculeaza_total
		*!*	modificare	v 2.0.41 : daca glAutoBonDet = .T., atunci in toate cazurile ( fara incasare, incasare cu bon fiscal,
		*!* 	incasare cu chitanta ),	la materiale pornesc de la pretul de vanzare cu TVA
		*!*	If glAutoBonDet
		*!*		If Thisform.opt_incasat.Value = 2
		*!*			ocomanda.bondifftva = Thisform.nbondifftva
		*!*			ocomanda.bondiftva = Thisform.nbondiftva
		*!*		Else
		*!*			ocomanda.bondifftva = 0
		*!*			ocomanda.bondiftva = 0
		*!*		Endif
		*!*	Endif
		*!*	With Thisform
		*!*		.clb_materiale.text_simplu1.Value = Iif(glAutoBonDet And pnProcTva <> 1,ocomanda.materiale+ocomanda.bondifftva,ocomanda.materiale)
		*!*		.clb_tvan.text_simplu1.Value = Iif(glAutoBonDet And pnProcTva <> 1,Thisform.nTVAMateriale,Round(ocomanda.materiale*(pnProcTva-1),gnPa)) + Iif(pnProcTva<>1,ocomanda.bondiftva,0)
		*!*	Endwith
		With Thisform
			.clb_materiale.text_simplu1.Value = Iif(glAutoBonDet And pnProcTva <> 1,ocomanda.materialerecalc,ocomanda.materiale)
			.clb_tvan.text_simplu1.Value = Iif(pnProcTva = 1,0,Thisform.nTVAMateriale)
		Endwith
		*!*	modificare	v 2.0.41	^
		If !Empty(Thisform.clb_discountm.text_simplu1.Value)
			Thisform.do_calculeaza('DISCOUNTM')
		Endif
		If !Empty(Thisform.clb_discountn.text_simplu1.Value)
			Thisform.do_calculeaza('DISCOUNTN')
		Endif
		Thisform.calculeaza_total()
	ENDPROC

	PROCEDURE do_sterge
		Local lcCursor
		lcCursor = Thisform.grd_altele.RecordSource
		Select (lcCursor)
		If Reccount(lcCursor) > 0 And !Deleted()
			lcArticol = Alltrim(denumire)
			If amessagebox("Sunteti sigur ca doriti sa stergeti articolul "+lcArticol+" de pe factura?",4+32,"Confirmare stergere") = 6
				Delete
			Endif
		Endif
		Thisform.grd_altele.Refresh()
	ENDPROC

	PROCEDURE inainte_de_do_renunt
		If Type('poGeneratorNumere') = 'O' And This.opt_incasat.Value = 3 And Thisform.nRezultatSerii <> 0
			poGeneratorNumere.dezaloca_numar(16)
		Endif
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local llReturn
		Store .T. To llReturn
		pnDiscountM=Thisform.clb_discountm.text_simplu1.Value
		pnDiscountN=Thisform.clb_discountn.text_simplu1.Value
		pnDiscountTvaM=Thisform.clb_tvadiscm.text_simplu1.Value
		pnDiscountTvaN=Thisform.clb_tvadiscn.text_simplu1.Value
		pnTotalFactura = Thisform.clb_totalfact.tx_N2.Value			&&	modificare	v 2.1.0
		*!*	modificare	v 2.0.28
		lcCursor = Thisform.grd_altele.RecordSource
		*!*	modificare	v 2.1.12
		Do Case
		Case Sign(pnDiscountM) <> Sign(Thisform.clb_manopera.text_simplu1.Value) AND pnDiscountM <> 0
			amessagebox("Valoarea înscrisă la discount manoperă trebuie să aibă acelasi semn cu valoarea manoperei!",48,"Atentie")
			Thisform.clb_discountm.text_simplu1.SetFocus()
			llReturn = .F.
		Case Sign(pnDiscountN) <> Sign(Thisform.clb_materiale.text_simplu1.Value) AND pnDiscountN <> 0
			amessagebox("Valoarea înscrisă la discount materiale trebuie să aibă acelasi semn cu valoarea materialelor!",48,"Atentie")
			Thisform.clb_discountn.text_simplu1.SetFocus()
			llReturn = .F.
		Otherwise
			llReturn = .T.
		Endcase
		*!*	modificare	v 2.1.12
		If Reccount(lcCursor) <> 0 And llReturn
			lcMesaj = []
			lcCursor2 = [crstmpverart]
			Select Count(*) As nr,id_articol,denumire From (lcCursor) Group By id_articol,denumire Order By 1,3 Into Cursor (lcCursor2)
			Select (lcCursor2)
			Scan For nr > 1
				lcMesaj = [,] + lcMesaj + Alltrim(denumire)
			Endscan
			If !Empty(lcMesaj)
				If amessagebox(Iif(Occurs([,],lcMesaj)=2,"Următorul articol este prezent de două ori pe factură : ", ;
						"Următoarele articole sunt prezente de două ori pe factură : ")+Substr(lcMesaj,2)+"." + ;
						CHR(13)+ Chr(10)+Chr(13)+ Chr(10)+"Doriti să continuați?",4+48,"Articole dublate") = 7
					llReturn = .F.
				Endif
			Endif
			If llReturn
				Select (lcCursor)
				Locate For !Deleted() And valoareftva = 0
				If Found()
					If amessagebox("Există articole care au valoarea fără TVA egală cu 0. Doriți să continuati?",4+48,"Articole cu total 0") = 7
						llReturn = .F.
					Else
						Go Top
					Endif
				Else
					Go Top
				Endif
			Endif
		Endif
		*!*	If Thisform.opt_incasat.Value<>1
		If Thisform.opt_incasat.Value<>1 And llReturn
		*!*	modificare	v 2.0.28	^
			lcDocument=Iif(Thisform.opt_incasat.Value=2,[bonului],[chitantei])
			pnTipIncasare=Thisform.opt_incasat.Value
			If pnTipIncasare=3
				If !Empty(Thisform.nnrbon)
		*!*			dezaloca_numar_bf()		&&	oserii_numere.prg
					poGeneratorNumere.dezaloca_numar(3)
				Endif
				poGeneratorNumere.verifica_numar(16,Thisform.nnrchit)
			Endif
		
			pnIdCasa = v_nom_casa.id_part
			pcCasa = v_nom_casa.nume
		*!*		pnIncasat=Thisform.clb_incasat.text_simplu1.Value
			pnIncasat=Thisform.nincasat
		*!*	modificare	v 2.0.28
			pcSerieChit = Thisform.cseriechit
			pnNrChit=Thisform.nnrchit &&	Thisform.clb_nrchit.text_simplu1.Value
		*!*	modificare	v 2.0.28	^
			Do Case
			Case pnIncasat=0
				amessagebox("Nu ati specificat suma încasată!",0+48,"Atentie")
				Thisform.clb_incasat.SetFocus()
				llReturn=.F.
			Case pnIncasat<0
				amessagebox("Nu puteti încasa o sumă negativă!",0+48,"Atentie")
				Thisform.clb_incasat.SetFocus()
				llReturn=.F.
			Case pnIdCasa<=0
				amessagebox("Nu ati ales casa!",0+48,"Atentie")
				Thisform.cb_casa.SetFocus()
				llReturn=.F.
			Case Empty(Thisform.cb_casa._CBBASE1.Value)
				amessagebox("Numărul "+lcDocument+" trebuie să fie diferit de 0!",0+48,"Atentie")
				Thisform.clb_nrchit.SetFocus()
				llReturn=.F.
			Endcase
		Endif
		pnAchitAsigurator = Thisform.ck_achit_asigurator.Value	&&	modificare	v 2.0.33
		
		pnPOS = thisform.nPOS && incasare bon fiscal prin CARD POS
		
		Return llReturn
	ENDPROC

	PROCEDURE Init
		*!*	modificare	v 2.0.41
		LPARAMETERS tnTvaIncasare,tnTvaMateriale,tlAchitaAsigurator
		*!*	LPARAMETERS tnTvaMateriale,tnBonDifFTva,tnBonDifTva,tlAchitaAsigurator
		DoDefault()
		This.nTVAMateriale = tnTVAMateriale
		*!*	This.nBonDifFTva = tnBonDifFTva
		*!*	This.nBonDifTva = tnBonDifTva
		Thisform.ck_achit_asigurator.Visible = tlAchitaAsigurator	&&	modificare	v 2.0.33
		*!*	ocomanda.bondiftva = 0
		*!*	ocomanda.bondifftva = 0
		*!*	modificare	v 2.0.41	^
		If !Empty(gnid_casa_achit)
			Select v_nom_casa
			Locate For id_part=gnid_casa_achit
			If Found()
				Thisform.cb_casa._CBBASE1.Value=Alltrim(nume)
			Endif
		ENDIF
		
		Select jtva_coloane
		*!*	modificare	v 2.1.0
		*!*	Set Filter To Inlist(cota_tva,0,gnCotaTVAStandard*100-100)	&&	modificare	v 2.0.22
		* Nu pun filtru si pe cota de tva standard 21% si 0% pentru ca este posibil sa se factureze storno 19%
		If Empty(tnTvaIncasare)
			Set Filter To isnull(id_jtva_ex)
		Else
			Set Filter To isnull(id_jtva_neex)
		Endif
		*!*	modificare	v 2.1.0	^
		Locate For id_jtva_coloana = pnIdJtvaColoana
		If !Found()
			Go Top
			pnIdJtvaColoana = id_jtva_coloana
		Endif
		pnIdTva = id_tva
		pnProcTva = (cota_tva+100)/100
		This.cbo_explicatie_tva.Value = Alltrim(denumire)
	ENDPROC

	PROCEDURE Show
		Lparameters nStyle
		DoDefault(nStyle)
		If Thisform.clb_manopera.text_simplu1.Value = 0
			Thisform.clb_procdiscm.text_simplu1.ReadOnly = .T.
			Thisform.clb_discountm.text_simplu1.ReadOnly = .T.
		Endif
		If Thisform.clb_materiale.text_simplu1.Value = 0
			Thisform.clb_procdiscn.text_simplu1.ReadOnly = .T.
			Thisform.clb_discountn.text_simplu1.ReadOnly = .T.
		Endif
	ENDPROC

	PROCEDURE verifica_tipincasare
		Local lnValoare, lnOptiuneIncas
		lnValoare = Thisform.ck_achit_asigurator.Value
		lnOptiuneIncas = Thisform.opt_incasat.Value
		Do Case
			Case lnValoare = 1 And lnOptiuneIncas = 2
				Thisform.opt_incasat.option2.Enabled = .F.
				Thisform.opt_incasat.Value = 3
				Thisform.actualizeaza_tipincasare()
			Case lnValoare = 1
				Thisform.opt_incasat.option2.Enabled = .F.
			Otherwise
				Thisform.opt_incasat.option2.Enabled = .T.
		Endcase
		
	ENDPROC

	PROCEDURE cbo_explicatie_tva.InteractiveChange
		Select jtva_coloane
		pnIdJtvaColoana = id_jtva_coloana
		pnIdTva = id_tva
		pnProcTva = (cota_tva+100)/100
		With Thisform
		*!*	modificare	v 2.0.22
		*!*		.clb_tvam.text_simplu1.Value=Round(	.clb_manopera.text_simplu1.Value*(pnProcTva-1),gnPa)
		*!*		.clb_tvan.text_simplu1.Value=Round(	.clb_materiale.text_simplu1.Value*(pnProcTva-1),gnPa)
			.clb_tvam.text_simplu1.Value=Round(ocomanda.manopera*(pnProcTva-1),gnPc)
		*!*	modificare	v 2.0.23
		*!*		.clb_materiale.text_simplu1.Value = IIF(glAutoBonDet and pnProcTva <> 1,ocomanda.materiale+ocomanda.bondifftva,ocomanda.materiale)
		*!*		.clb_tvan.text_simplu1.Value = IIF(glAutoBonDet and pnProcTva <> 1,Thisform.nTVAMateriale,Round(ocomanda.materiale*(pnProcTva-1),gnPa)) + IIF(pnProcTva<>1,ocomanda.bondiftva,0)
		*!*	modificare	v 2.0.23	^
		*!*	modificare	v 2.0.22	^
		Endwith
		*!*	modificare	v 2.0.23
		Thisform.do_recalculeaza_total()
		*!*	If !Empty(Thisform.clb_discountm.text_simplu1.Value)
		*!*		Thisform.do_calculeaza('DISCOUNTM')
		*!*	Endif
		*!*	If !Empty(Thisform.clb_discountn.text_simplu1.Value)
		*!*		Thisform.do_calculeaza('DISCOUNTN')
		*!*	Endif
		*!*	Thisform.calculeaza_total()
		*!*	modificare	v 2.0.23	^
	ENDPROC

	PROCEDURE chkPOS.Valid
		IF this.Value = 0
			thisform.cb_casa._lbbase1.Caption = 'Casa'
		ELSE
			thisform.cb_casa._lbbase1.Caption = 'Banca POS'
		ENDIF 
		thisform.cb_casa._lbbase1.Refresh()
	ENDPROC

	PROCEDURE ck_achit_asigurator.Click
		Thisform.verifica_tipincasare()
	ENDPROC

	PROCEDURE Clb_avans.Text_simplu1.GotFocus
		this.Tag=ALLTRIM(STR(this.value,20,4))
	ENDPROC

	PROCEDURE Clb_avans.Text_simplu1.LostFocus
		If Alltrim(Str(This.Value,20,4))!=This.Tag
			Thisform.do_calculeaza('TOTAL')
		Endif
	ENDPROC

	PROCEDURE Clb_discountm.Text_simplu1.GotFocus
		this.Tag=ALLTRIM(STR(this.value,20,4))
	ENDPROC

	PROCEDURE Clb_discountm.Text_simplu1.LostFocus
		If Alltrim(Str(This.Value,20,4))!=This.Tag
			Thisform.do_calculeaza('DISCOUNTM')
		Endif
		
	ENDPROC

	PROCEDURE Clb_discountn.Text_simplu1.GotFocus
		this.Tag=ALLTRIM(STR(this.value,20,4))
	ENDPROC

	PROCEDURE Clb_discountn.Text_simplu1.LostFocus
		If Alltrim(Str(This.Value,20,4))!=This.Tag
			Thisform.do_calculeaza('DISCOUNTN')
		Endif
		
	ENDPROC

	PROCEDURE Clb_incasat.Text_simplu1.InteractiveChange
		Thisform.nincasat=This.Value
	ENDPROC

	PROCEDURE Clb_incasat.Text_simplu1.Valid
		If Thisform.nincasat=0 And Thisform.opt_incasat.Value>1
			Thisform.nincasat=Thisform.clb_totalfact.text_simplu1.Value
		Endif
	ENDPROC

	PROCEDURE Clb_nrchit.TEXT_SIMPLU1.GotFocus
		If Thisform.opt_incasat.Value = 3
			Thisform.clb_serie_chit.genereazaNumar()
		Endif
	ENDPROC

	PROCEDURE Clb_procdiscm.TEXT_SIMPLU1.GotFocus
		this.Tag=ALLTRIM(STR(this.value,20,4))
	ENDPROC

	PROCEDURE Clb_procdiscm.TEXT_SIMPLU1.LostFocus
		If Alltrim(Str(This.Value,20,4))!=This.Tag
			Thisform.do_calculeaza('PROCDISCM')
		Endif
		
	ENDPROC

	PROCEDURE Clb_procdiscm.TEXT_SIMPLU1.ProgrammaticChange
		Thisform.do_calculeaza('PROCDISCM')
	ENDPROC

	PROCEDURE Clb_procdiscn.Text_simplu1.GotFocus
		this.Tag=ALLTRIM(STR(this.value,20,4))
	ENDPROC

	PROCEDURE Clb_procdiscn.Text_simplu1.LostFocus
		If Alltrim(Str(This.Value,20,4))!=This.Tag
			Thisform.do_calculeaza('PROCDISCN')
		Endif
		
	ENDPROC

	PROCEDURE Clb_procdiscn.Text_simplu1.ProgrammaticChange
			Thisform.do_calculeaza('PROCDISCN')
	ENDPROC

	PROCEDURE Clb_serie_chit._cbbase1.InteractiveChange
		This.Parent.genereazaNumar()
	ENDPROC

	PROCEDURE Clb_totaldeviz.Text_simplu1.GotFocus
		this.Tag=ALLTRIM(STR(this.value,20,4))
	ENDPROC

	PROCEDURE Clb_totaldeviz.Text_simplu1.LostFocus
		If Alltrim(Str(This.Value,20,4))!=This.Tag
			Thisform.do_calculeaza('TVA')
		Endif
		
	ENDPROC

	PROCEDURE Clb_totaldisc.Text_simplu1.GotFocus
		this.Tag=ALLTRIM(STR(this.value,20,4))
	ENDPROC

	PROCEDURE Clb_totaldisc.Text_simplu1.LostFocus
		If Alltrim(Str(This.Value,20,4))!=This.Tag
			Thisform.do_calculeaza('TVA')
		Endif
		
	ENDPROC

	PROCEDURE grd_altele.cCantitate.Text1.LostFocus
		Thisform.do_modifica_alteserv()
	ENDPROC

	PROCEDURE grd_altele.cPretFTva.Text1.LostFocus
		Thisform.do_modifica_alteserv()
	ENDPROC

	PROCEDURE grd_altele.Init
		*!*
	ENDPROC

	PROCEDURE opt_incasat.Click
		*!*	modificare	v 2.0.33
		Thisform.actualizeaza_tipincasare()
		*!*	Do Case
		*!*		Case This.Value=1
		*!*			Thisform.cb_casa.Visible=.F.
		*!*			Thisform.clb_nrchit.Visible=.F.
		*!*			Thisform.clb_incasat.Visible=.F.
		*!*			Thisform._shape3.Visible=.F.
		*!*			Thisform.lb_simplu1.Visible=.F.
		*!*			Thisform.lactiv3=.F.
		*!*			Thisform.but_modifica1.Visible=.F.
		*!*			Thisform.clb_nrchit.text_simplu1.ReadOnly=.T.
		*!*			Thisform.clb_nrchit.text_simplu1.Value=0
		*!*			Thisform.clb_serie_chit.Visible = .F.		&&	modificare	v 2.0.28
		*!*			poGeneratorNumere.dezaloca_numar(16)		&&	modificare	v 2.0.28
		*!*		Case This.Value=2
		*!*			Thisform.cb_casa.Visible=.T.
		*!*			Thisform.clb_nrchit.Visible=.T.
		*!*			Thisform.clb_nrchit.lb_simplu1.Caption=[Nr. bon]
		*!*			Thisform.clb_incasat.Visible=.T.
		*!*			Thisform._shape3.Visible=.T.
		*!*			Thisform.lb_simplu1.Visible=.T.
		*!*			Thisform.lactiv3=.T.
		*!*			Thisform.but_modifica1.Visible=.T.
		*!*			Thisform.clb_nrchit.text_simplu1.ReadOnly=.T.
		*!*			Thisform.do_aloca_nr_bon([CLICK])
		*!*			Thisform.clb_serie_chit.Visible = .F.		&&	modificare	v 2.0.28
		*!*			poGeneratorNumere.dezaloca_numar(16)		&&	modificare	v 2.0.28
		*!*		Case This.Value=3
		*!*			Thisform.cb_casa.Visible=.T.
		*!*			Thisform.clb_nrchit.Visible=.T.
		*!*			Thisform.clb_nrchit.lb_simplu1.Caption=[Nr. chitanta]
		*!*			Thisform.clb_incasat.Visible=.T.
		*!*			Thisform._shape3.Visible=.T.
		*!*			Thisform.lb_simplu1.Visible=.T.
		*!*			Thisform.lactiv3=.F.
		*!*			Thisform.but_modifica1.Visible=.F.
		*!*			Thisform.clb_nrchit.text_simplu1.ReadOnly=.F.
		*!*			Thisform.clb_nrchit.text_simplu1.Value=0
		*!*			*!*	modificare	v 2.0.28
		*!*			Thisform.clb_serie_chit.Visible = .T.
		*!*			If Thisform.nRezultatSerii = 0
		*!*				Thisform.nRezultatSerii = poGeneratorNumere.creeaza_cursor_serii(16)
		*!*				Thisform.clb_serie_chit.do_initializeaza(Thisform.nRezultatSerii)
		*!*				If !Empty(Nvl(Thisform.cseriechit,[]))
		*!*					If Thisform.nRezultatSerii <> 1
		*!*						Select (Thisform.clb_serie_chit._cbbase1.RowSource)
		*!*						Locate For Alltrim(serie) = Alltrim(Thisform.cseriechit)
		*!*						If !Found()
		*!*							Go Top
		*!*						Endif
		*!*						Thisform.clb_serie_chit._cbbase1.Value = Alltrim(serie)
		*!*					Endif
		*!*				Endif
		*!*			Endif
		*!*			Thisform.clb_serie_chit.genereazaNumar()
		*!*			*!*	modificare	v 2.0.28	^
		*!*	Endcase
		*!*	*!*	modificare	v 2.0.23
		*!*	Thisform.do_recalculeaza_total()
		*!*	*!*	modificare	v 2.0.23	^
		*!*	modificare	v 2.0.33	^
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_inchidere_productie AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="grdcomenzi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrord.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrord.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatai.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatai.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNume.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNume.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValidat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValidat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cManopera.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cManopera.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cMateriale.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cMateriale.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cUtil_valid.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cUtil_valid.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDataoravalid.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDataoravalid.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cFacturat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cFacturat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrFact.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrFact.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_cauta1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_reset1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nume" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_datai" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrinmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrord" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cmd_inchidere" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="opt_inchis" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="opt_validat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_vizualizare" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_aratanote
		*m: do_executa2
	*</DefinedPropArrayMethod>

	*<PropValue>
		cgridsortlist = grdcomenzi
		DoCreate = .T.
		Height = 504
		lactiv2 = .T.
		lactiv3 = .T.
		Name = "frm_inchidere_productie"
		Width = 793
		WindowState = 2
		_shape1.Anchor = 10
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Tag = "RESIZABLE,NOVERTICAL_RESIZE"
		_shape1.Top = 0
		_shape1.Width = 792
		_shape1.ZOrderSet = 0
		_shape2.Anchor = 9
		_shape2.Height = 29
		_shape2.Left = 731
		_shape2.Name = "_shape2"
		_shape2.Tag = "MOVABLE,NOVERTICAL_MOVE"
		_shape2.Top = 0
		_shape2.Width = 64
		_shape2.ZOrderSet = 12
		Lb_titlu_alb_b121.Caption = "ÎNCHIDERE COMENZI PRODUCȚIE"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 13
		Lb_titlu_alb_b121.ZOrderSet = 1
		BUT_TERMIN1.Anchor = 9
		BUT_TERMIN1.Left = 763
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 11
		BUT_TERMIN1.Tag = "MOVABLE,NOVERTICAL_MOVE"
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 13
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'But_listare1' AS but_listare WITH ;
		Anchor = 9, ;
		Left = 733, ;
		Name = "But_listare1", ;
		TabIndex = 12, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 1, ;
		Visible = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Ck_datai' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.datai, ;
		Caption = "Data comenzii", ;
		FontName = "Arial Narrow", ;
		Left = 689, ;
		Name = "Ck_datai", ;
		TabIndex = 4, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		tip = D, ;
		Top = 73, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrinmat' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nrinmat, ;
		Caption = "Nr. înmatriculare", ;
		FontName = "Arial Narrow", ;
		Left = 689, ;
		Name = "Ck_nrinmat", ;
		TabIndex = 5, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 92, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrord' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nrord, ;
		Caption = "Nr. comandă", ;
		FontName = "Arial Narrow", ;
		Left = 689, ;
		Name = "Ck_nrord", ;
		TabIndex = 2, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 36, ;
		ZOrderSet = 11
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nume' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nume, ;
		Caption = "Nume client", ;
		FontName = "Arial Narrow", ;
		Left = 689, ;
		Name = "Ck_nume", ;
		TabIndex = 3, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 54, ;
		ZOrderSet = 5
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Cmd_cauta1' AS cmd_cauta WITH ;
		Anchor = 8, ;
		Left = 690, ;
		Name = "Cmd_cauta1", ;
		TabIndex = 8, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 262, ;
		ZOrderSet = 3
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'cmd_inchidere' AS cmd_executa WITH ;
		Anchor = 12, ;
		Caption = "\<Închidere comandă", ;
		Height = 36, ;
		Left = 684, ;
		Name = "cmd_inchidere", ;
		TabIndex = 10, ;
		Tag = "MOVABLE", ;
		Top = 461, ;
		Width = 96, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_reset1' AS cmd_reset WITH ;
		Anchor = 8, ;
		Left = 690, ;
		Name = "Cmd_reset1", ;
		TabIndex = 14, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 295, ;
		ZOrderSet = 4
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_vizualizare' AS cmd_executa WITH ;
		Anchor = 12, ;
		caction = do_aratanote, ;
		Caption = "\<Vizualizare note comandă", ;
		Height = 36, ;
		Left = 684, ;
		Name = "Cmd_vizualizare", ;
		TabIndex = 9, ;
		Top = 398, ;
		Visible = .F., ;
		Width = 96, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grdcomenzi' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 10, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		Height = 456, ;
		Left = 17, ;
		Name = "grdcomenzi", ;
		Panel = 1, ;
		ReadOnly = .T., ;
		RecordSource = "crscomenzi", ;
		TabIndex = 1, ;
		Tag = "RESIZABLE", ;
		Top = 36, ;
		Width = 655, ;
		ZOrderSet = 2, ;
		Column1.ControlSource = "nrord", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cNrord", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 90, ;
		Column2.ColumnOrder = 3, ;
		Column2.ControlSource = "IIF(TYPE('datai')=='D',datai,TTOD(datai))", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cDatai", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 65, ;
		Column3.ColumnOrder = 2, ;
		Column3.ControlSource = "nume", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.Name = "cNume", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 160, ;
		Column4.ColumnOrder = 4, ;
		Column4.ControlSource = "IIF(validat=1,'Da','Nu')", ;
		Column4.FontName = "Arial Narrow", ;
		Column4.Name = "cValidat", ;
		Column4.ReadOnly = .T., ;
		Column4.Width = 36, ;
		Column5.ColumnOrder = 7, ;
		Column5.ControlSource = "ROUND(manopera,gnPc)", ;
		Column5.FontName = "Arial Narrow", ;
		Column5.Format = "R", ;
		Column5.InputMask = (get_mask(12,gnPc)), ;
		Column5.Name = "cManopera", ;
		Column5.ReadOnly = .T., ;
		Column6.ColumnOrder = 8, ;
		Column6.ControlSource = "ROUND(materiale,gnPc)", ;
		Column6.FontName = "Arial Narrow", ;
		Column6.Format = "R", ;
		Column6.InputMask = (get_mask(12,gnPc)), ;
		Column6.Name = "cMateriale", ;
		Column6.ReadOnly = .T., ;
		Column7.ColumnOrder = 9, ;
		Column7.ControlSource = "util_valid", ;
		Column7.FontName = "Arial Narrow", ;
		Column7.Name = "cUtil_valid", ;
		Column7.ReadOnly = .T., ;
		Column7.Width = 115, ;
		Column8.ColumnOrder = 10, ;
		Column8.ControlSource = "dataoravalid", ;
		Column8.FontName = "Arial Narrow", ;
		Column8.Name = "cDataoravalid", ;
		Column8.ReadOnly = .T., ;
		Column8.Width = 94, ;
		Column9.ColumnOrder = 5, ;
		Column9.ControlSource = "IIF(facturat=1,'Da','Nu')", ;
		Column9.FontName = "Arial Narrow", ;
		Column9.Name = "cFacturat", ;
		Column9.ReadOnly = .T., ;
		Column9.Width = 39, ;
		Column10.ColumnOrder = 6, ;
		Column10.ControlSource = "nrfact", ;
		Column10.FontName = "Arial Narrow", ;
		Column10.InputMask = (get_mask(14,0)), ;
		Column10.Name = "cNrFact", ;
		Column10.ReadOnly = .T.
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdcomenzi.cDatai.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cDatai.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cDataoravalid.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data si ora validarii", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cDataoravalid.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cFacturat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Inchisa", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cFacturat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cManopera.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Manopera", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cManopera.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cMateriale.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Materiale", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cMateriale.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNrFact.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr.act", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNrFact.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNrord.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr.comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNrord.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNume.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nume client", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNume.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cUtil_valid.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Validata de catre", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cUtil_valid.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cValidat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Validat", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cValidat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'opt_inchis' AS _optiongrup WITH ;
		Anchor = 8, ;
		AutoSize = .F., ;
		ButtonCount = 3, ;
		Height = 65, ;
		Left = 696, ;
		Name = "opt_inchis", ;
		TabIndex = 7, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 188, ;
		Width = 77, ;
		OPTION1.AutoSize = .T., ;
		OPTION1.Caption = "Toate", ;
		OPTION1.FontName = "Arial Narrow", ;
		OPTION1.Left = 5, ;
		OPTION1.Name = "OPTION1", ;
		OPTION1.Top = 5, ;
		OPTION1.Value = 1, ;
		OPTION2.AutoSize = .T., ;
		OPTION2.Caption = "Închise", ;
		OPTION2.FontCharSet = 238, ;
		OPTION2.FontName = "Arial Narrow", ;
		OPTION2.Left = 5, ;
		OPTION2.Name = "OPTION2", ;
		OPTION2.Top = 24, ;
		Option3.AutoSize = .T., ;
		Option3.BackStyle = 0, ;
		Option3.Caption = "Deschise", ;
		Option3.FontName = "Arial Narrow", ;
		Option3.Height = 18, ;
		Option3.Left = 5, ;
		Option3.Name = "Option3", ;
		Option3.Top = 43, ;
		Option3.Value = 0, ;
		Option3.Width = 57
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT 'opt_validat' AS _optiongrup WITH ;
		Anchor = 8, ;
		AutoSize = .F., ;
		ButtonCount = 3, ;
		Height = 65, ;
		Left = 696, ;
		Name = "opt_validat", ;
		TabIndex = 6, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 120, ;
		Width = 77, ;
		OPTION1.AutoSize = .T., ;
		OPTION1.Caption = "Toate", ;
		OPTION1.FontName = "Arial Narrow", ;
		OPTION1.Left = 5, ;
		OPTION1.Name = "OPTION1", ;
		OPTION1.Top = 5, ;
		OPTION1.Value = 1, ;
		OPTION2.AutoSize = .T., ;
		OPTION2.Caption = "Validate", ;
		OPTION2.FontName = "Arial Narrow", ;
		OPTION2.Left = 5, ;
		OPTION2.Name = "OPTION2", ;
		OPTION2.Top = 24, ;
		Option3.AutoSize = .T., ;
		Option3.BackStyle = 0, ;
		Option3.Caption = "Nevalidate", ;
		Option3.FontName = "Arial Narrow", ;
		Option3.Height = 18, ;
		Option3.Left = 5, ;
		Option3.Name = "Option3", ;
		Option3.Top = 43, ;
		Option3.Value = 0, ;
		Option3.Width = 63
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />
	
	PROCEDURE actualizeaza_grid1
		Parameters tcFiltru
		Local lcFiltru
		If Empty(tcFiltru)
			lcFiltru = pocomenzi.ca_baza1.cfiltru
		Else
			lcFiltru = tcFiltru
		Endif
		
		Thisform.LockScreen = .T.
		Thisform.MousePointer = 11
		
		save_grid_comment(Thisform.grdcomenzi)
		pocomenzi.ca_baza1.cfiltru = lcFiltru
		pocomenzi.ca_baza1.afisare()
		restore_grid_comment(Thisform.grdcomenzi)
		Thisform.grdcomenzi.SetAll("DynamicForeColor","IIF(facturat=1,RGB(128,128,128),RGB(0,0,0))","Column")
		If Reccount('crscomenzi')>0
			Thisform.cmd_vizualizare.Enabled=.T.
			Thisform.grdcomenzi.SetFocus()
		Else
			Thisform.cmd_inchidere.Enabled = .F.
			Thisform.cmd_vizualizare.Enabled=.F.
		Endif
		
		Thisform.MousePointer = 0
		Thisform.LockScreen = .F.
		
	ENDPROC

	PROCEDURE do_aratanote
		If Reccount('crscomenzi')>0
			Local lnid_ordl
			Select crscomenzi
			lnid_ordl=id_ordl
			lcnrord=nrord
			If Used('crsfacturi')
				Use In crsfacturi
			Endif
			lcSql=[select a.datai,b.serie_act,b.nract,a.nume,b.dataact,b.explicatia,b.suma,b.scd,b.scc ] + ;
				[from ] + gcS + [.auto_vordl a ] + ;
				[left join ] + gcS + [.vact b on a.id_lucrare=b.id_lucrare ] + ;
				[where a.id_ordl = ] + Alltrim(Str(lnid_ordl)) + ;
				[order by b.dataact,b.nract]
		
			Thisform.MousePointer=11
			Thisform.LockScreen=.T.
			lnSucces=goExecutor.oExecute(lcSql,'crsfacturi')
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,0+16,'Eroare')
			Endif
			Thisform.LockScreen=.F.
			Thisform.MousePointer= 0
		
			If Reccount('crsfacturi')>0
				ofrmfacturi=Createobject('frm_factact')
				ofrmfacturi.lb_titlu_alb_b121.Caption = [Note contabile comanda ]+Alltrim(lcnrord)
				ofrmfacturi.Show(1)
			Else
				amessagebox("Nu exista note pentru aceasta comanda!",0+48,"Atentie")
			Endif
			Use In crsfacturi
		Else
			amessagebox("Nu ati selectat comanda!",0+48,"Atentie")
		Endif
		
	ENDPROC

	PROCEDURE do_cauta
		Local lcFiltru
		lcFiltru = gcCondLuna  + [ and a.id_tip=6 ]
		If Thisform.ck_datai.Value=1
			lcFiltru = lcFiltru + Thisform.ck_datai.filtru
		Endif
		
		If Thisform.ck_nrinmat.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nrinmat.filtru
		Endif
		
		If Thisform.ck_nrord.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nrord.filtru
		Endif
		
		If Thisform.ck_nume.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nume.filtru
		Endif
		
		With Thisform.opt_inchis
			Do Case
			Case .Value=2
				lcFiltru = lcFiltru + [ and a.facturat=1]
			Case .Value=3
				lcFiltru = lcFiltru + [ and a.facturat=0]
			Endcase
		Endwith
		
		With Thisform.opt_validat
			Do Case
			Case .Value=2
				lcFiltru = lcFiltru + [ and a.validat=1]
			Case .Value=3
				lcFiltru = lcFiltru + [ and a.validat=0]
			Endcase
		Endwith
		
		Thisform.actualizeaza_grid1(lcFiltru)
		
		If Reccount('crscomenzi')=0
			amessagebox('Cautarea nu a intors rezultate!',0+48,'Info cautare')
			Thisform.ck_nrord.SetFocus()
		Endif
	ENDPROC

	PROCEDURE do_executa
		If Used('crscomenzi') And Reccount('crscomenzi')>0
			Private pniesire
			Local lnPozitieCursor
			Select crscomenzi
			lnPozitieCursor=Recno()
			Scatter Name ocomanda
		&& optiuni cu analitice
		&& optiuni tip analitic
			lnLungime=2
			Dimension taValori[lnLungime,3]
			taValori[1,1]="poAct.nrord"
			taValori[1,2]=Alltrim(ocomanda.nrord)
			taValori[1,3]=.T.
			taValori[2,1]="poAct.id_lucrare"
			taValori[2,2]=Alltrim(Str(ocomanda.id_lucrare))
			taValori[2,3]=.T.
		
			If !Isnull(gnid_fdoc_inchprod)
				Dimension taValori[lnLungime+2,3]
				taValori[lnLungime+1,1]="poAct.id_fdoc"
				taValori[lnLungime+1,2]=Alltrim(Str(gnid_fdoc_inchprod))
				taValori[lnLungime+1,3]=.T.
				taValori[lnLungime+2,1]="poAct.fdoc"
				taValori[lnLungime+2,2]='<DOC. INCHIDERE COM.PRODUCTIE>'
				taValori[lnLungime+2,3]=.T.
				lnLungime=lnLungime+2
			Endif
		
			Thisform.AlwaysOnTop=.F.
			lans(31007,.F.,.T.,@taValori)	&&  id_set,daca se executa procedura de mai multe ori,
		&& 	daca verifica analiticele,array de valori
			Thisform.AlwaysOnTop=.T.
		
			If buton=2
				Do deschid_actc
				Return
			Endif
			
			If Used('crsTotaluri')
				Use In crsTotaluri
			Endif
		
			lcSql=[select NVL(sum(ROUND(] + ;
				[(case when a.an * 12 + a.luna < 2005 * 12 + 7 ] + ;
				[then ROUND(a.pretv/10000,?gnPc) else a.pretv end) ] + ;
				[ * a.cante, ?gnPc)), 0) as total,a.id_sectie,b.sectie ] + ;
				[from rul a ] + ;
				[left join nom_sectii b on a.id_sectie = b.id_sectie ] + ;
				[where a.id_lucrare = ] + Alltrim(Str(ocomanda.id_lucrare)) + [ and a.sters = 0 ] + ;
				[group by a.id_sectie,b.sectie ] 
				
			lnSucces=goExecutor.oExecute(lcSql,'crsTotaluri')
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,0+16,'Eroare')
			Endif
		
			Select actactan
			Locate For nr_nota = 1
			Scatter Name loNota1
			Delete For nr_nota = 1
		
			Select crsTotaluri
			Scan
				Scatter Name loMateriale
				With loMateriale
					Select actactan
					Append Blank
					Gather Name loNota1
					Replace suma WITH .total,id_sectie With .id_sectie,sectie With .sectie
				Endwith
			Endscan
			Select actactan
			*!*	modificare	v 2.1.0
			*!*	Replace All id_fact With -1
			Replace id_fact With -1 for id_fact <> -5
			*!*	modificare	v 2.1.0	^
			Use In crsTotaluri
		**********************************************
		
			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
		
			Private buton
			buton=1
			Select actactan
			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
				Use In actactan
				Return
			Endif
		
			lnSucces = oscrie_in_fisiere()
		
			If lnSucces>0
		*!*	modificare	v 2.0.35
		*!*			lcSql = [begin pack_devize.dev_completeaza_rul(?gcS,?ocomanda.id_lucrare); end;]
		*!*	modificare	v 2.0.47 : am adaugat poAct.id_set
		*!*	modificare	v 2.0.50 : am pus 31007 in loc de poAct.id_set ( dadea eroare pentru ca nu gasea poAct )
				lcSql = [begin pack_auto.actualizeaza_deviz(pack_contafin.getCotaTVAStandard(?gnLuna,?gnAn),'] + ALLTRIM(STR(ocomanda.id_lucrare)) + [',31007); end;]
		*!*	modificare	v 2.0.35	^
				lnSucces = goExecutor.oExecute(lcSql)
				If lnSucces < 0
					amessagebox(goExecutor.cEroare,0+16,'Eroare')
					Return
				Endif
		
				Thisform.actualizeaza_grid1()
				If Reccount('crscomenzi')>=lnPozitieCursor
					Go lnPozitieCursor
				Endif
			Endif
		
		Endif
	ENDPROC

	PROCEDURE do_executa2
	ENDPROC

	PROCEDURE do_listare
		If Reccount('crscomenzi')>0
			Private porul,pooper,pcschema1,pcselect1
			Store '' To porul,pooper
		
			Select crscomenzi
			Scatter Name ocomanda
			If ocomanda.Validat=1
		*!*	modificare	v 2.0.35
				listare_comanda_deviz(Thisform,ocomanda,2)
		*!*			lcSql = [select row_number() over (order by datai,id_oper) as nrcrt,id_ordl,codop,timpn,pret,denop,] + ;
		*!*				[datai from ] + gcS + [.dev_voper where id_ordl = ?ocomanda.id_ordl and ] + ;
		*!*				[extract(month from datai)+extract(year from datai)*12<=?gnLuna+?gnAn*12 ] + ;
		*!*				[order by 1]
		*!*			lnSucces = goExecutor.oExecute(lcSql,'oper')
		*!*			If lnSucces < 0
		*!*				amessagebox(goExecutor.cEroare,16,'Eroare')
		*!*				Return
		*!*			Endif
		*!*			lcSql = [select row_number() over (order by a.dataact,a.id_rul) as nrcrt,a.*,b.denumire,b.codmat from (] + ;
		*!*				[select id_articol,pretv,SUM(cante) as cante,MIN(dataact) as dataact,MIN(id_rul) as id_rul ] + ;
		*!*				[from ] + gcS + [.rul where sters = 0 and id_lucrare = ?ocomanda.id_lucrare ] + ;
		*!*				[group by id_articol,pretv) a ] + ;
		*!*				[left join nom_articole b on a.id_articol = b.id_articol where a.cante <> 0]
		*!*			lnSucces = goExecutor.oExecute(lcSql,'rul')
		*!*			If lnSucces < 0
		*!*				amessagebox(goExecutor.cEroare,16,'Eroare')
		*!*				Return
		*!*			Endif
		*!*			If Reccount('oper')>0 Or Reccount('rul')>0
		*!*				Private pdDataora,pcdataora,pntotaltn,pntotalval,pofirma,pcschema,pcselect,pcorder,pcfiltru
		*!*				Store '' To pofirma,pcschema,pcselect,pcorder,pcfiltru
		*!*				If Used('crsFirma')
		*!*					Use In crsfirma
		*!*				Endif
		*!*				lcSql = [select localitate,strada,numar,cod_fiscal,reg_comert from syn_nom_firme where ] + ;
		*!*					[id_firma = ?gnIdFirma]		&&	modificare	v 2.0.29 : am inlocuit gnId_Firma
		*!*				lnSucces=goExecutor.oExecute(lcSql,[crsfirma])
		*!*				If lnSucces<0
		*!*					amessagebox(goExecutor.cEroare,0+16,'Eroare')
		*!*					Return
		*!*				Endif
		*!*				Sele crsfirma
		*!*				Scatter Name firma
		*!*				Use In crsfirma
		*!*				If Used('crslistare')
		*!*					Use In crslistare
		*!*				Endif
		*!*				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,b.kmint,b.marca,b.masina ] + ;
		*!*					[from ] + gcS + [.dev_vordl a ] + ;
		*!*					[left join ] + gcS + [.dev_vmasiniclienti b on a.id_masiniclient=b.id_masiniclient ] + ;
		*!*					[where a.id_ordl = ?ocomanda.id_ordl]
		*!*				lnSucces=goExecutor.oExecute(lcSql,'crslistare')
		*!*				If lnSucces<0
		*!*					amessagebox(goExecutor.cEroare,0+16,'Eroare')
		*!*					Return
		*!*				Endif
		*!*				Select crslistare
		*!*				Scatter Name olistare Memo
		*!*				Use In crslistare
		*!*				pcdataora=get_ora(2)
		*!*				pdDataora=Ttod(Ctot(pcdataora))
		*!*				*!* modificare 27.07
		*!*				Select rul
		*!*				Calculate Sum(Round(cante*pretv,gnPc)) To pnTotalMatDeviz
		*!*				Select oper
		*!*				Calculate Sum(Round(timpn*Pret,gnPc)) To pnTotalManDeviz
		*!*				*!*
		*!*				Select nrcrt,olistare.nrord As nrord,'A' As semn,codmat,denumire,cante,pretv As Pret From rul Where cante <> 0 ;
		*!*					UNION All ;
		*!*					SELECT nrcrt,olistare.nrord As nrord,'B' As semn,codop As codmat,denop As denumire,timpn As cante,Pret ;
		*!*					From oper Order By 3,1 Into Cursor crslistare
		*!*				Thisform.AlwaysOnTop=.F.
		*!*				Select crslistare
		*!*				*!*	modificare MIX 07.09.2007
		*!*				*!*	*!*	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
		*!*				*!*				Select crslistare
		*!*				*!*				Go Top
		*!*				*!*	*!*	modificare 09.08.2006
		*!*				*!*	modificare MIX 07.09.2007	^
		*!*				*!*	modificare	v 2.0.5
		*!*				*!*				Do LISTAREUSERREPORT With "crsListare", "FRX", "RAP_DEVIZ_REGIE" In PROCEDURI_RAPOARTE.PRG
		*!*				goExport.export2frx([crslistare],[rap_deviz_regie])
		*!*				*!*	modificare	v 2.0.5	^
		*!*				*!* 26.06.2006
		*!*				Thisform.AlwaysOnTop=.T.
		*!*				Use In crslistare
		*!*			Else
		*!*				amessagebox("Nu exista manopera si materiale pe aceasta comanda!",0+48,"Atentie")
		*!*				Thisform.ck_nrord.SetFocus()
		*!*			Endif
		*!*					*!*	modificare	v 2.0.5
		*!*					If Used('oper')
		*!*						Use In oper
		*!*					Endif
		*!*					If Used('rul')
		*!*						Use In rul
		*!*					Endif
		*!*					*!*	modificare	v 2.0.5	^
		*!*	modificare	v 2.0.35	^
			Else
				amessagebox("Nu puteti lista deviz pentru aceasta comanda, deoarece nu este validata!",0+48,"Atentie")
				Thisform.grdcomenzi.SetFocus()
			Endif
		Else
			amessagebox("Nu ati selectat comanda!",0+48,"Atentie")
			Thisform.grdcomenzi.SetFocus()
		Endif
		
	ENDPROC

	PROCEDURE do_reset
		With Thisform
			For i=1 To .Objects.Count
				If Upper(.Objects(i).BaseClass)='CHECKBOX'
					.Objects(i).Value=0
				Endif
			Endfor
		Endwith
		Thisform.opt_inchis.Value=Thisform.opt_inchis.ndefault
		Thisform.opt_validat.Value=Thisform.opt_validat.ndefault
		Thisform.ck_nrord.SetFocus()
		
	ENDPROC

	PROCEDURE Init
		DoDefault()
		Thisform.grdcomenzi.SetAll("DynamicForeColor","IIF(facturat=1,RGB(128,128,128),RGB(0,0,0))","Column")
		
	ENDPROC

	PROCEDURE grdcomenzi.AfterRowColChange
		Lparameters nColIndex
		If This.RowColChange!=2
			Select crscomenzi
			DoDefault()
			Do Case
			Case Validat=0
				Thisform.cmd_inchidere.Enabled=.F.
		*!*			Thisform.cmd_vizualizare.Enabled=.F.
			Case Facturat = 1
				Thisform.cmd_inchidere.Enabled=.F.
			Otherwise
				Thisform.cmd_inchidere.Enabled=.T.
				Thisform.cmd_vizualizare.Enabled=.T.
			Endcase
		Endif
		
	ENDPROC

	PROCEDURE opt_validat.Click
		If This.Value=3
			Thisform.opt_inchis.Value=3
			Thisform.opt_inchis.Enabled=.F.
		Else
			Thisform.opt_inchis.Enabled=.T.
		Endif
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_inchidere_regie AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="grdcomenzi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrord.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrord.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatai.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatai.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNume.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNume.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValidat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValidat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cManopera.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cManopera.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cMateriale.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cMateriale.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cUtil_valid.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cUtil_valid.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDataoravalid.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDataoravalid.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cFacturat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cFacturat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrFact.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrFact.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_cauta1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_reset1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nume" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_datai" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrinmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrord" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cmd_inchidere" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="opt_inchis" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="opt_validat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_vizualizare" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_aratanote
		*m: do_executa2
	*</DefinedPropArrayMethod>

	*<PropValue>
		cgridsortlist = grdcomenzi
		DoCreate = .T.
		Height = 504
		lactiv2 = .T.
		lactiv3 = .T.
		Name = "frm_inchidere_regie"
		Width = 793
		WindowState = 2
		_shape1.Anchor = 10
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Tag = "RESIZABLE,NOVERTICAL_RESIZE"
		_shape1.Top = 0
		_shape1.Width = 792
		_shape1.ZOrderSet = 0
		_shape2.Anchor = 9
		_shape2.Height = 29
		_shape2.Left = 731
		_shape2.Name = "_shape2"
		_shape2.Tag = "MOVABLE,NOVERTICAL_MOVE"
		_shape2.Top = 0
		_shape2.Width = 64
		_shape2.ZOrderSet = 12
		Lb_titlu_alb_b121.Caption = "ÎNCHIDERE COMENZI REGIE"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 13
		Lb_titlu_alb_b121.ZOrderSet = 1
		BUT_TERMIN1.Anchor = 9
		BUT_TERMIN1.Left = 763
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 11
		BUT_TERMIN1.Tag = "MOVABLE,NOVERTICAL_MOVE"
		BUT_TERMIN1.Top = 2
		BUT_TERMIN1.ZOrderSet = 13
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'But_listare1' AS but_listare WITH ;
		Anchor = 9, ;
		Left = 733, ;
		Name = "But_listare1", ;
		TabIndex = 12, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 2, ;
		Visible = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Ck_datai' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.datai, ;
		Caption = "Data comenzii", ;
		FontName = "Arial Narrow", ;
		Left = 689, ;
		Name = "Ck_datai", ;
		TabIndex = 4, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		tip = D, ;
		Top = 73, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrinmat' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nrinmat, ;
		Caption = "Nr. înmatriculare", ;
		FontName = "Arial Narrow", ;
		Left = 689, ;
		Name = "Ck_nrinmat", ;
		TabIndex = 5, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 92, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrord' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nrord, ;
		Caption = "Nr. comandă", ;
		FontName = "Arial Narrow", ;
		Left = 689, ;
		Name = "Ck_nrord", ;
		TabIndex = 2, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 36, ;
		ZOrderSet = 11
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nume' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nume, ;
		Caption = "Nume client", ;
		FontName = "Arial Narrow", ;
		Left = 689, ;
		Name = "Ck_nume", ;
		TabIndex = 3, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 54, ;
		ZOrderSet = 5
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Cmd_cauta1' AS cmd_cauta WITH ;
		Anchor = 8, ;
		Left = 690, ;
		Name = "Cmd_cauta1", ;
		TabIndex = 8, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 262, ;
		ZOrderSet = 3
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'cmd_inchidere' AS cmd_executa WITH ;
		Anchor = 12, ;
		Caption = "\<Închidere comandă", ;
		Height = 36, ;
		Left = 684, ;
		Name = "cmd_inchidere", ;
		TabIndex = 10, ;
		Tag = "MOVABLE", ;
		Top = 461, ;
		Width = 96, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_reset1' AS cmd_reset WITH ;
		Anchor = 8, ;
		Left = 690, ;
		Name = "Cmd_reset1", ;
		TabIndex = 14, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 295, ;
		ZOrderSet = 4
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_vizualizare' AS cmd_executa WITH ;
		Anchor = 12, ;
		caction = do_aratanote, ;
		Caption = "\<Vizualizare note comandă", ;
		Height = 36, ;
		Left = 684, ;
		Name = "Cmd_vizualizare", ;
		TabIndex = 9, ;
		Top = 398, ;
		Visible = .F., ;
		Width = 96, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grdcomenzi' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 10, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		Height = 456, ;
		Left = 17, ;
		Name = "grdcomenzi", ;
		Panel = 1, ;
		ReadOnly = .T., ;
		RecordSource = "crscomenzi", ;
		TabIndex = 1, ;
		Tag = "RESIZABLE", ;
		Top = 36, ;
		Width = 655, ;
		ZOrderSet = 2, ;
		Column1.ControlSource = "nrord", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cNrord", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 90, ;
		Column2.ColumnOrder = 3, ;
		Column2.ControlSource = "IIF(TYPE('datai')=='D',datai,TTOD(datai))", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cDatai", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 65, ;
		Column3.ColumnOrder = 2, ;
		Column3.ControlSource = "nume", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.Name = "cNume", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 160, ;
		Column4.ColumnOrder = 4, ;
		Column4.ControlSource = "IIF(validat=1,'Da','Nu')", ;
		Column4.FontName = "Arial Narrow", ;
		Column4.Name = "cValidat", ;
		Column4.ReadOnly = .T., ;
		Column4.Width = 36, ;
		Column5.ColumnOrder = 7, ;
		Column5.ControlSource = "ROUND(manopera,gnPc)", ;
		Column5.FontName = "Arial Narrow", ;
		Column5.Format = "R", ;
		Column5.InputMask = (get_mask(12,gnPc)), ;
		Column5.Name = "cManopera", ;
		Column5.ReadOnly = .T., ;
		Column6.ColumnOrder = 8, ;
		Column6.ControlSource = "ROUND(materiale,gnPc)", ;
		Column6.FontName = "Arial Narrow", ;
		Column6.Format = "R", ;
		Column6.InputMask = (get_mask(12,gnPc)), ;
		Column6.Name = "cMateriale", ;
		Column6.ReadOnly = .T., ;
		Column7.ColumnOrder = 9, ;
		Column7.ControlSource = "util_valid", ;
		Column7.FontName = "Arial Narrow", ;
		Column7.Name = "cUtil_valid", ;
		Column7.ReadOnly = .T., ;
		Column7.Width = 115, ;
		Column8.ColumnOrder = 10, ;
		Column8.ControlSource = "dataoravalid", ;
		Column8.FontName = "Arial Narrow", ;
		Column8.Name = "cDataoravalid", ;
		Column8.ReadOnly = .T., ;
		Column8.Width = 94, ;
		Column9.ColumnOrder = 5, ;
		Column9.ControlSource = "IIF(facturat=1,'Da','Nu')", ;
		Column9.FontName = "Arial Narrow", ;
		Column9.Name = "cFacturat", ;
		Column9.ReadOnly = .T., ;
		Column9.Width = 39, ;
		Column10.ColumnOrder = 6, ;
		Column10.ControlSource = "nrfact", ;
		Column10.FontName = "Arial Narrow", ;
		Column10.InputMask = (get_mask(14,0)), ;
		Column10.Name = "cNrFact", ;
		Column10.ReadOnly = .T.
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdcomenzi.cDatai.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cDatai.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cDataoravalid.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data si ora validarii", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cDataoravalid.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cFacturat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Inchisa", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cFacturat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cManopera.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Manopera", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cManopera.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cMateriale.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Materiale", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cMateriale.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNrFact.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr.act", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNrFact.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNrord.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr.comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNrord.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNume.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nume client", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNume.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cUtil_valid.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Validata de catre", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cUtil_valid.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cValidat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Validat", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cValidat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'opt_inchis' AS _optiongrup WITH ;
		Anchor = 8, ;
		AutoSize = .F., ;
		ButtonCount = 3, ;
		Height = 65, ;
		Left = 696, ;
		Name = "opt_inchis", ;
		TabIndex = 7, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 188, ;
		Width = 77, ;
		OPTION1.AutoSize = .T., ;
		OPTION1.Caption = "Toate", ;
		OPTION1.FontName = "Arial Narrow", ;
		OPTION1.Left = 5, ;
		OPTION1.Name = "OPTION1", ;
		OPTION1.Top = 5, ;
		OPTION1.Value = 1, ;
		OPTION2.AutoSize = .T., ;
		OPTION2.Caption = "Închise", ;
		OPTION2.FontCharSet = 238, ;
		OPTION2.FontName = "Arial Narrow", ;
		OPTION2.Left = 5, ;
		OPTION2.Name = "OPTION2", ;
		OPTION2.Top = 24, ;
		Option3.AutoSize = .T., ;
		Option3.BackStyle = 0, ;
		Option3.Caption = "Deschise", ;
		Option3.FontName = "Arial Narrow", ;
		Option3.Height = 18, ;
		Option3.Left = 5, ;
		Option3.Name = "Option3", ;
		Option3.Top = 43, ;
		Option3.Value = 0, ;
		Option3.Width = 57
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT 'opt_validat' AS _optiongrup WITH ;
		Anchor = 8, ;
		AutoSize = .F., ;
		ButtonCount = 3, ;
		Height = 65, ;
		Left = 696, ;
		Name = "opt_validat", ;
		TabIndex = 6, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 120, ;
		Width = 77, ;
		OPTION1.AutoSize = .T., ;
		OPTION1.Caption = "Toate", ;
		OPTION1.FontName = "Arial Narrow", ;
		OPTION1.Left = 5, ;
		OPTION1.Name = "OPTION1", ;
		OPTION1.Top = 5, ;
		OPTION1.Value = 1, ;
		OPTION2.AutoSize = .T., ;
		OPTION2.Caption = "Validate", ;
		OPTION2.FontName = "Arial Narrow", ;
		OPTION2.Left = 5, ;
		OPTION2.Name = "OPTION2", ;
		OPTION2.Top = 24, ;
		Option3.AutoSize = .T., ;
		Option3.BackStyle = 0, ;
		Option3.Caption = "Nevalidate", ;
		Option3.FontName = "Arial Narrow", ;
		Option3.Height = 18, ;
		Option3.Left = 5, ;
		Option3.Name = "Option3", ;
		Option3.Top = 43, ;
		Option3.Value = 0, ;
		Option3.Width = 63
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />
	
	PROCEDURE actualizeaza_grid1
		Parameters tcFiltru
		Local lcFiltru
		If Empty(tcFiltru)
			lcFiltru = pocomenzi.ca_baza1.cfiltru
		Else
			lcFiltru = tcFiltru
		Endif
		
		Thisform.LockScreen = .T.
		Thisform.MousePointer = 11
		
		save_grid_comment(Thisform.grdcomenzi)
		pocomenzi.ca_baza1.cfiltru = lcFiltru
		pocomenzi.ca_baza1.afisare()
		restore_grid_comment(Thisform.grdcomenzi)
		Thisform.grdcomenzi.SetAll("DynamicForeColor","IIF(facturat=1,RGB(128,128,128),RGB(0,0,0))","Column")
		If Reccount('crscomenzi')>0
			Thisform.cmd_vizualizare.Enabled=.T.
			Thisform.grdcomenzi.SetFocus()
		Else
			Thisform.cmd_inchidere.Enabled = .F.
			Thisform.cmd_vizualizare.Enabled=.F.
		Endif
		
		Thisform.MousePointer = 0
		Thisform.LockScreen = .F.
		
	ENDPROC

	PROCEDURE do_aratanote
		If Reccount('crscomenzi')>0
			Local lnid_ordl
			Select crscomenzi
			lnid_ordl=id_ordl
			lcnrord=nrord
			If Used('crsfacturi')
				Use In crsfacturi
			Endif
			lcSql=[select a.datai,b.serie_act,b.nract,a.nume,b.dataact,b.explicatia,b.suma,b.scd,b.scc ] + ;
				[from ] + gcS + [.auto_vordl a ] + ;
				[left join ] + gcS + [.vact b on a.id_lucrare=b.id_lucrare ] + ;
				[where a.id_ordl = ] + Alltrim(Str(lnid_ordl)) + ;
				[order by b.dataact,b.nract]
		
			Thisform.MousePointer=11
			Thisform.LockScreen=.T.
			lnSucces=goExecutor.oExecute(lcSql,'crsfacturi')
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,0+16,'Eroare')
			Endif
			Thisform.LockScreen=.F.
			Thisform.MousePointer= 0
		
			If Reccount('crsfacturi')>0
				ofrmfacturi=Createobject('frm_factact')
				ofrmfacturi.lb_titlu_alb_b121.Caption = [Note contabile comanda ]+Alltrim(lcnrord)
				ofrmfacturi.Show(1)
			Else
				amessagebox("Nu exista note pentru aceasta comanda!",0+48,"Atentie")
			Endif
			Use In crsfacturi
		Else
			amessagebox("Nu ati selectat comanda!",0+48,"Atentie")
		Endif
		
	ENDPROC

	PROCEDURE do_cauta
		Local lcFiltru
		lcFiltru = gcCondLuna  + [ and a.id_tip=3 ]
		If Thisform.ck_datai.Value=1
			lcFiltru = lcFiltru + Thisform.ck_datai.filtru
		Endif
		
		If Thisform.ck_nrinmat.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nrinmat.filtru
		Endif
		
		If Thisform.ck_nrord.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nrord.filtru
		Endif
		
		If Thisform.ck_nume.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nume.filtru
		Endif
		
		With Thisform.opt_inchis
			Do Case
			Case .Value=2
				lcFiltru = lcFiltru + [ and a.facturat=1]
			Case .Value=3
				lcFiltru = lcFiltru + [ and a.facturat=0]
			Endcase
		Endwith
		
		With Thisform.opt_validat
			Do Case
			Case .Value=2
				lcFiltru = lcFiltru + [ and a.validat=1]
			Case .Value=3
				lcFiltru = lcFiltru + [ and a.validat=0]
			Endcase
		Endwith
		
		Thisform.actualizeaza_grid1(lcFiltru)
		
		If Reccount('crscomenzi')=0
			amessagebox('Cautarea nu a intors rezultate!',0+48,'Info cautare')
			Thisform.ck_nrord.SetFocus()
		Endif
	ENDPROC

	PROCEDURE do_executa
		If Used('crscomenzi') And Reccount('crscomenzi')>0
			Private pniesire
			Local lnPozitieCursor
			Select crscomenzi
			lnPozitieCursor=Recno()
			Scatter Name ocomanda
		&& optiuni cu analitice
		&& optiuni tip analitic
			lnLungime=4
			Dimension taValori[lnLungime,3]
			taValori[1,1]="poAct.v482"
			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_vv482"
			taValori[4,2]=Alltrim(Str(ocomanda.id_partener))
			taValori[4,3]=.T.
		
			If !Isnull(gnid_fdoc_inchreg)
				Dimension taValori[lnLungime+2,3]
				taValori[lnLungime+1,1]="poAct.id_fdoc"
				taValori[lnLungime+1,2]=Alltrim(Str(gnid_fdoc_inchreg))
				taValori[lnLungime+1,3]=.T.
				taValori[lnLungime+2,1]="poAct.fdoc"
				taValori[lnLungime+2,2]='<DOC. INCHIDERE COM.REGIE>'
				taValori[lnLungime+2,3]=.T.
				lnLungime=lnLungime+2
			Endif
		
			Thisform.AlwaysOnTop=.F.
			lans(31006,.F.,.T.,@taValori)	&&  id_set,daca se executa procedura de mai multe ori,
		&& 	daca verifica analiticele,array de valori
			Thisform.AlwaysOnTop=.T.
		
			If buton=2
				Do deschid_actc
				Return
			Endif
			
			If Used('crsTotaluri')
				Use In crsTotaluri
			Endif
		**********************************************
		*!*		lcSql=[select a.tip, a.acont, a.pret, a.id_sectie, b.sectie from ] + ;
		*!*			[(select 1 as tip, acont, NVL(sum(ROUND(pretv * cante, ?gnPc)), 0) as pret,id_sectie ] + ;
		*!*			[from rul where id_lucrare = ] + Alltrim(Str(ocomanda.id_lucrare)) + [ and sters = 0 ] + ;
		*!*			[group by acont, id_sectie ] + ;
		*!*			[union all ] + ;
		*!*			[select 2 as tip, '' as acont, NVL(sum(ROUND(timpn * pret, ?gnPc)), 0) as pret, id_sectie ] + ;
		*!*			[from dev_oper where id_ordl = ] + Alltrim(Str(ocomanda.id_ordl)) + [ and sters = 0 ] + ;
		*!*			[group by id_sectie) a ] + ;
		*!*			[left join nom_sectii b on a.id_sectie = b.id_sectie order by tip]
		*!*		lnSucces=goExecutor.oExecute(lcSql,'crsTotaluri')
		*!*		If lnSucces < 0
		*!*			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		*!*		Endif
		
		*!*		Select actactan
		*!*		Locate For nr_nota = 1
		*!*		Scatter Name loNota1
		*!*		Locate For nr_nota = 3
		*!*		Scatter Name loNota3
		*!*		Delete For Inlist(nr_nota,1,3)
		
		*!*		Select crsTotaluri
		*!*		Scan For tip = 1
		*!*			Scatter Name loMateriale
		*!*			With loMateriale
		*!*				Select actactan
		*!*				Append Blank
		*!*				Gather Name loNota1
		*!*				Replace ascd With .acont,id_sectie With .id_sectie,sectie With .sectie
		*!*				Append Blank
		*!*				Gather Name loNota3
		*!*				Replace ascd With .acont,suma With .Pret,id_sectie With .id_sectie,sectie With .sectie
		*!*			Endwith
		*!*		Endscan
		*!*		Calculate Sum(Pret) For tip = 1 To ocomanda.materiale
		*!*		Calculate Sum(Pret) For tip = 2 To ocomanda.manopera
		*!*		Select actactan
		*!*		Replace suma With ocomanda.materiale + ocomanda.manopera For nr_nota = 2
		*!*		Replace All id_fact With -1
		*!*		Use In crsTotaluri
		*!*		Use In crsTotaluri2
		**********************************************
			lcSql=[select sum(case when a.tip = 1 then a.pret else 0 end) as materiale,] + ;
				[a.id_sectie,b.sectie,sum(a.pret) as total from ] + ;
				[(select 1 as tip, NVL(sum(ROUND((case when an * 12 + luna < 2005 * 12 + 7 then ROUND(pretv / 10000,?gnPc) ] + ;
				[else pretv end) * cante, ?gnPc)), 0) as pret,id_sectie ] + ;
				[from rul where id_lucrare = ] + Alltrim(Str(ocomanda.id_lucrare)) + [ and sters = 0 ] + ;
				[group by id_sectie ] + ;
				[union all ] + ;
				[select 2 as tip, NVL(sum(ROUND(timpn * (case when nou = 0 then ROUND(pret/10000,?gnPc) else pret end), ?gnPc)), 0) as pret, id_sectie ] + ;
				[from dev_oper where id_ordl = ] + Alltrim(Str(ocomanda.id_ordl)) + [ and sters = 0 ] + ;
				[group by id_sectie) a ] + ;
				[left join nom_sectii b on a.id_sectie = b.id_sectie ] + ;
				[group by a.id_sectie,b.sectie order by 4]
				
			lnSucces=goExecutor.oExecute(lcSql,'crsTotaluri')
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,0+16,'Eroare')
			Endif
		
			Select actactan
			Locate For nr_nota = 1
			Scatter Name loNota1
			Locate For nr_nota = 3
			Scatter Name loNota3
			Delete For Inlist(nr_nota,1,3)
		
			Select crsTotaluri
			Scan
				Scatter Name loMateriale
				With loMateriale
					Select actactan
					Append Blank
					Gather Name loNota1
					Replace suma WITH (-1) * .total,id_sectie With .id_sectie,sectie With .sectie,id_partc WITH 0,partc WITH ''
					If .materiale <> 0
						Append Blank
						Gather Name loNota3
						Replace suma With .materiale,id_sectie With .id_sectie,sectie With .sectie
					Endif
				Endwith
			Endscan
			Calculate Sum(total) TO lnTotal
			Select actactan
			Replace suma With lnTotal For nr_nota = 2
			*!*	modificare	v 2.1.0
			*!*	Replace All id_fact With -1
			Replace id_fact With -1 for id_fact <> -5
			*!*	modificare	v 2.1.0	^
			Use In crsTotaluri
		**********************************************
		
			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
		
			Private buton
			buton=1
			Select actactan
			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
				Use In actactan
				Return
			Endif
		
			lnSucces = oscrie_in_fisiere()
		
			If lnSucces>0
		*!*	modificare	v 2.0.35
		*!*			lcSql = [begin pack_devize.dev_completeaza_rul(?gcS,?ocomanda.id_lucrare); end;]
		*!*	modificare	v 2.0.47 : am adaugat poAct.id_set
		*!*	modificare	v 2.0.50 : am pus 31006 in loc de poAct.id_set ( dadea eroare pentru ca nu gasea poAct )
				lcSql = [begin pack_auto.actualizeaza_deviz(pack_contafin.getCotaTVAStandard(?gnLuna,?gnAn),'] + ALLTRIM(STR(ocomanda.id_lucrare)) + [',31006); end;]
		*!*	modificare	v 2.0.35	^
				lnSucces = goExecutor.oExecute(lcSql)
				If lnSucces < 0
					amessagebox(goExecutor.cEroare,0+16,'Eroare')
					Return
				Endif
		
				Thisform.actualizeaza_grid1()
				If Reccount('crscomenzi')>=lnPozitieCursor
					Go lnPozitieCursor
				Endif
			Endif
		
		Endif
	ENDPROC

	PROCEDURE do_executa2
	ENDPROC

	PROCEDURE do_listare
		If Reccount('crscomenzi')>0
			Private porul,pooper,pcschema1,pcselect1
			Store '' To porul,pooper
		
			Select crscomenzi
			Scatter Name ocomanda
		
			If ocomanda.Validat=1
				*!*	modificare	v 2.0.35
				listare_comanda_deviz(Thisform,ocomanda,2)
		*!*			lcSql = [select row_number() over (order by datai,id_oper) as nrcrt,id_ordl,codop,timpn,pret,denop,] + ;
		*!*				[datai from ] + gcS + [.dev_voper where id_ordl = ?ocomanda.id_ordl and ] + ;
		*!*				[extract(month from datai)+extract(year from datai)*12<=?gnLuna+?gnAn*12 ] + ;
		*!*				[order by 1]
		*!*			lnSucces = goExecutor.oExecute(lcSql,'oper')
		*!*			If lnSucces < 0
		*!*				amessagebox(goExecutor.cEroare,16,'Eroare')
		*!*				Return
		*!*			Endif
		
		*!*			lcSql = [select row_number() over (order by a.dataact,a.id_rul) as nrcrt,a.*,b.denumire,b.codmat from (] + ;
		*!*				[select id_articol,pretv,SUM(cante) as cante,MIN(dataact) as dataact,MIN(id_rul) as id_rul ] + ;
		*!*				[from ] + gcS + [.rul where sters = 0 and id_lucrare = ?ocomanda.id_lucrare ] + ;
		*!*				[group by id_articol,pretv) a ] + ;
		*!*				[left join nom_articole b on a.id_articol = b.id_articol where a.cante <> 0]
		*!*			lnSucces = goExecutor.oExecute(lcSql,'rul')
		*!*			If lnSucces < 0
		*!*				amessagebox(goExecutor.cEroare,16,'Eroare')
		*!*				Return
		*!*			Endif
		
		*!*			If Reccount('oper')>0 Or Reccount('rul')>0
		*!*				Private pdDataora,pcdataora,pntotaltn,pntotalval,pofirma,pcschema,pcselect,pcorder,pcfiltru
		*!*				Store '' To pofirma,pcschema,pcselect,pcorder,pcfiltru
		
		*!*				If Used('crsFirma')
		*!*					Use In crsfirma
		*!*				Endif
		*!*				lcSql = [select localitate,strada,numar,cod_fiscal,reg_comert from syn_nom_firme where ] + ;
		*!*					[id_firma = ?gnIdFirma]		&&	modificare	v 2.0.29 : am inlocuit gnId_Firma
		*!*				lnSucces=goExecutor.oExecute(lcSql,[crsfirma])
		*!*				If lnSucces<0
		*!*					amessagebox(goExecutor.cEroare,0+16,'Eroare')
		*!*					Return
		*!*				Endif
		*!*				Sele crsfirma
		*!*				Scatter Name firma
		*!*				Use In crsfirma
		
		*!*				If Used('crslistare')
		*!*					Use In crslistare
		*!*				Endif
		
		*!*				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,b.kmint,b.marca,b.masina ] + ;
		*!*					[from ] + gcS + [.dev_vordl a ] + ;
		*!*					[left join ] + gcS + [.dev_vmasiniclienti b on a.id_masiniclient=b.id_masiniclient ] + ;
		*!*					[where a.id_ordl = ?ocomanda.id_ordl]
		*!*				lnSucces=goExecutor.oExecute(lcSql,'crslistare')
		*!*				If lnSucces<0
		*!*					amessagebox(goExecutor.cEroare,0+16,'Eroare')
		*!*					Return
		*!*				Endif
		*!*				Select crslistare
		*!*				Scatter Name olistare Memo
		*!*				Use In crslistare
		
		*!*				pcdataora=get_ora(2)
		*!*				pdDataora=Ttod(Ctot(pcdataora))
		
		*!*				*!* modificare 27.07
		*!*				Select rul
		*!*				Calculate Sum(Round(cante*pretv,gnPc)) To pnTotalMatDeviz
		
		*!*				Select oper
		*!*				Calculate Sum(Round(timpn*Pret,gnPc)) To pnTotalManDeviz
		*!*				*!*
		
		*!*				Select nrcrt,olistare.nrord As nrord,'A' As semn,codmat,denumire,cante,pretv As Pret From rul Where cante <> 0 ;
		*!*					UNION All ;
		*!*					SELECT nrcrt,olistare.nrord As nrord,'B' As semn,codop As codmat,denop As denumire,timpn As cante,Pret ;
		*!*					From oper Order By 3,1 Into Cursor crslistare
		
		*!*				Thisform.AlwaysOnTop=.F.
		*!*				Select crslistare
		*!*				*!*	modificare MIX 07.09.2007
		*!*				*!*	*!*	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
		*!*				*!*				Select crslistare
		*!*				*!*				Go Top
		*!*				*!*	*!*	modificare 09.08.2006
		*!*				*!*	modificare MIX 07.09.2007	^
		*!*				*!*	modificare v 2.0.5
		*!*				*!*				Do LISTAREUSERREPORT With "crsListare", "FRX", "RAP_DEVIZ_REGIE" In PROCEDURI_RAPOARTE.PRG
		*!*				goExport.export2frx([crslistare],[rap_deviz_regie])
		*!*				*!*	modificare	v 2.0.5	^
		*!*				*!* 26.06.2006
		
		*!*				Thisform.AlwaysOnTop=.T.
		*!*				Use In crslistare
		*!*			Else
		*!*				amessagebox("Nu exista manopera si materiale pe aceasta comanda!",0+48,"Atentie")
		*!*				Thisform.ck_nrord.SetFocus()
		*!*			Endif
		*!*					*!*	modificare	v 2.0.5
		*!*					If Used('oper')
		*!*						Use In oper
		*!*					Endif
		*!*					If Used('rul')
		*!*						Use In rul
		*!*					Endif
		*!*					*!*	modificare	v 2.0.5	^
		*!*	modificare	v 2.0.35	^
			Else
				amessagebox("Nu puteti lista deviz pentru aceasta comanda, deoarece nu este validata!",0+48,"Atentie")
				Thisform.grdcomenzi.SetFocus()
			Endif
		Else
			amessagebox("Nu ati selectat comanda!",0+48,"Atentie")
			Thisform.grdcomenzi.SetFocus()
		Endif
	ENDPROC

	PROCEDURE do_reset
		With Thisform
			For i=1 To .Objects.Count
				If Upper(.Objects(i).BaseClass)='CHECKBOX'
					.Objects(i).Value=0
				Endif
			Endfor
		Endwith
		Thisform.opt_inchis.Value=Thisform.opt_inchis.ndefault
		Thisform.opt_validat.Value=Thisform.opt_validat.ndefault
		Thisform.ck_nrord.SetFocus()
		
	ENDPROC

	PROCEDURE Init
		DoDefault()
		Thisform.grdcomenzi.SetAll("DynamicForeColor","IIF(facturat=1,RGB(128,128,128),RGB(0,0,0))","Column")
		
	ENDPROC

	PROCEDURE grdcomenzi.AfterRowColChange
		Lparameters nColIndex
		If This.RowColChange!=2
			Select crscomenzi
			DoDefault()
			Do Case
			Case Validat=0
				Thisform.cmd_inchidere.Enabled=.F.
		*!*			Thisform.cmd_vizualizare.Enabled=.F.
			Case Facturat = 1
				Thisform.cmd_inchidere.Enabled=.F.
			Otherwise
				Thisform.cmd_inchidere.Enabled=.T.
				Thisform.cmd_vizualizare.Enabled=.T.
			Endcase
		Endif
		
	ENDPROC

	PROCEDURE opt_validat.Click
		If This.Value=3
			Thisform.opt_inchis.Value=3
			Thisform.opt_inchis.Enabled=.F.
		Else
			Thisform.opt_inchis.Enabled=.T.
		Endif
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_istoric_comenzi AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="grdcomenzi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrord.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrord.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatai.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatai.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNume.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNume.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValidat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValidat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cAsigurator.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cAsigurator.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cFacturat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cFacturat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cMarca.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cMarca.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cMasina.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cMasina.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cTip_comanda.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cTip_comanda.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDataFact.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDataFact.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrFact.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrFact.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cInspector.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cInspector.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNr_dosar.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNr_dosar.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cArhivat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cArhivat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cPartRef.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cPartRef.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cSeries.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cSeries.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cKmint.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cKmint.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cOreFunctionare.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cOreFunctionare.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValcTVAFactura.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValcTVAFactura.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValManoperaFactura.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValManoperaFactura.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValMaterialeFactura.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValMaterialeFactura.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValMaterialeAch.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValMaterialeAch.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValMaterialeVz.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValMaterialeVz.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cOreManopera.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cOreManopera.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValManopera.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValManopera.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_cauta1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_reset1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_series" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_referinta" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nr_dosar" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_inspector" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_asigurator" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nume" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_datai" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_vizualizare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrinmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_facturat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrord" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lbValidat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lbArhivat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_sterge1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cbtip_deviz" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Xresize1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_excel1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridextra1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cbArhivat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cbValidat" UniqueID="" Timestamp="" />

	*<PropValue>
		BorderStyle = 3
		cgridsortlist = grdcomenzi
		DoCreate = .T.
		Height = 489
		lactiv1 = .T.
		lactiv2 = .T.
		Name = "frm_istoric_comenzi"
		Width = 793
		WindowState = 2
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Tag = "RESIZABLE,NOVERTICAL_RESIZE"
		_shape1.Top = 0
		_shape1.Width = 792
		_shape1.ZOrderSet = 1
		_shape2.Height = 29
		_shape2.Left = 730
		_shape2.Name = "_shape2"
		_shape2.Tag = "MOVABLE,NOVERTICAL_MOVE"
		_shape2.Top = 0
		_shape2.Width = 65
		_shape2.ZOrderSet = 9
		Lb_titlu_alb_b121.Caption = "ISTORIC COMENZI"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 15
		Lb_titlu_alb_b121.ZOrderSet = 2
		BUT_TERMIN1.Left = 762
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 14
		BUT_TERMIN1.Tag = "MOVABLE,NOVERTICAL_MOVE"
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 10
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'But_excel1' AS but_excel WITH ;
		Anchor = 9, ;
		Left = 703, ;
		Name = "But_excel1", ;
		TabIndex = 16, ;
		Top = 1, ;
		Visible = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_listare1' AS but_listare WITH ;
		Anchor = 8, ;
		Left = 733, ;
		Name = "But_listare1", ;
		Top = 1, ;
		Visible = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'cbArhivat' AS ctip_deviz WITH ;
		Anchor = 8, ;
		Left = 691, ;
		Name = "cbArhivat", ;
		TabIndex = 6, ;
		Top = 327, ;
		_combobox1.Name = "_combobox1"
		*< END OBJECT: ClassLib="oviz_devize.vcx" BaseClass="container" />

	ADD OBJECT 'cbtip_deviz' AS ctip_deviz WITH ;
		Left = 692, ;
		Name = "cbtip_deviz", ;
		TabIndex = 10, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 240, ;
		_combobox1.Name = "_combobox1"
		*< END OBJECT: ClassLib="oviz_devize.vcx" BaseClass="container" />

	ADD OBJECT 'cbValidat' AS ctip_deviz WITH ;
		Anchor = 8, ;
		Left = 692, ;
		Name = "cbValidat", ;
		TabIndex = 6, ;
		Top = 283, ;
		_combobox1.Name = "_combobox1"
		*< END OBJECT: ClassLib="oviz_devize.vcx" BaseClass="container" />

	ADD OBJECT 'Ck_asigurator' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.asigurator, ;
		Caption = "Asigurator", ;
		FontName = "Arial Narrow", ;
		Left = 692, ;
		Name = "Ck_asigurator", ;
		TabIndex = 6, ;
		Top = 125, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_datai' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.datai, ;
		Caption = "Data comenzii", ;
		FontName = "Arial Narrow", ;
		Left = 692, ;
		Name = "Ck_datai", ;
		TabIndex = 3, ;
		tip = D, ;
		Top = 69, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_facturat' AS ck_simplu WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		Caption = "Facturate", ;
		FontName = "Arial Narrow", ;
		Left = 692, ;
		Name = "Ck_facturat", ;
		TabIndex = 5, ;
		Top = 111, ;
		ZOrderSet = 11
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_inspector' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.inspector, ;
		Caption = "Inspector", ;
		FontName = "Arial Narrow", ;
		Left = 692, ;
		Name = "Ck_inspector", ;
		TabIndex = 7, ;
		Top = 139, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nr_dosar' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nr_dosar, ;
		Caption = "Nr.dosar", ;
		FontName = "Arial Narrow", ;
		Left = 692, ;
		Name = "Ck_nr_dosar", ;
		TabIndex = 8, ;
		Top = 154, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrinmat' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nrinmat, ;
		Caption = "Nr. înmatriculare", ;
		FontName = "Arial Narrow", ;
		Left = 692, ;
		Name = "Ck_nrinmat", ;
		TabIndex = 4, ;
		Top = 83, ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrord' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nrord, ;
		Caption = "Nr. comanda", ;
		FontName = "Arial Narrow", ;
		Left = 692, ;
		Name = "Ck_nrord", ;
		TabIndex = 1, ;
		Top = 41, ;
		ZOrderSet = 12
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nume' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nume, ;
		Caption = "Nume client", ;
		FontName = "Arial Narrow", ;
		Left = 692, ;
		Name = "Ck_nume", ;
		TabIndex = 2, ;
		Top = 55, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_referinta' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.part_ref, ;
		Caption = "Referinta", ;
		FontName = "Arial Narrow", ;
		Left = 692, ;
		Name = "Ck_referinta", ;
		TabIndex = 2, ;
		Top = 169, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'ck_series' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.series, ;
		Caption = "Serie sasiu", ;
		FontName = "Arial Narrow", ;
		Left = 692, ;
		Name = "ck_series", ;
		TabIndex = 2, ;
		Top = 97, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Cmd_cauta1' AS cmd_cauta WITH ;
		Left = 696, ;
		Name = "Cmd_cauta1", ;
		TabIndex = 11, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 363, ;
		ZOrderSet = 4
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_reset1' AS cmd_reset WITH ;
		Left = 696, ;
		Name = "Cmd_reset1", ;
		TabIndex = 16, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 392, ;
		Width = 84, ;
		ZOrderSet = 5
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_sterge1' AS cmd_sterge WITH ;
		Left = 696, ;
		Name = "Cmd_sterge1", ;
		TabIndex = 17, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 424, ;
		Visible = .F., ;
		Width = 84
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_vizualizare' AS cmd_executa WITH ;
		Caption = "Vi\<zualizare", ;
		Height = 27, ;
		Left = 696, ;
		Name = "Cmd_vizualizare", ;
		TabIndex = 12, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 454, ;
		Width = 84, ;
		WordWrap = .T., ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grdcomenzi' AS _grdrow WITH ;
		ColumnCount = 25, ;
		DeleteMark = .F., ;
		FontSize = 10, ;
		Height = 444, ;
		Left = 17, ;
		Name = "grdcomenzi", ;
		Panel = 1, ;
		ReadOnly = .T., ;
		RecordSource = "crscomenzi", ;
		RowHeight = 19, ;
		TabIndex = 13, ;
		Tag = "RESIZABLE", ;
		Top = 36, ;
		Width = 663, ;
		ZOrderSet = 3, ;
		Column1.ControlSource = "nrord", ;
		Column1.FontName = "Arial", ;
		Column1.FontSize = 10, ;
		Column1.Name = "cNrord", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 90, ;
		Column2.ColumnOrder = 8, ;
		Column2.ControlSource = "IIF(TYPE('datai')=='D',datai,TTOD(datai))", ;
		Column2.FontName = "Arial", ;
		Column2.FontSize = 10, ;
		Column2.Name = "cDatai", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 87, ;
		Column3.ColumnOrder = 2, ;
		Column3.ControlSource = "nume", ;
		Column3.FontName = "Arial", ;
		Column3.FontSize = 10, ;
		Column3.Name = "cNume", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 160, ;
		Column4.ColumnOrder = 9, ;
		Column4.ControlSource = "IIF(validat=1,'Da','Nu')", ;
		Column4.FontName = "Arial", ;
		Column4.FontSize = 10, ;
		Column4.Name = "cValidat", ;
		Column4.ReadOnly = .T., ;
		Column4.Width = 44, ;
		Column5.ColumnOrder = 5, ;
		Column5.ControlSource = "asigurator", ;
		Column5.FontName = "Arial", ;
		Column5.FontSize = 10, ;
		Column5.Name = "cAsigurator", ;
		Column5.ReadOnly = .T., ;
		Column6.ColumnOrder = 10, ;
		Column6.ControlSource = "IIF(facturat=1,'Da','Nu')", ;
		Column6.FontName = "Arial", ;
		Column6.FontSize = 10, ;
		Column6.Name = "cFacturat", ;
		Column6.ReadOnly = .T., ;
		Column6.Width = 52, ;
		Column7.ColumnOrder = 3, ;
		Column7.ControlSource = "marca", ;
		Column7.FontName = "Arial", ;
		Column7.FontSize = 10, ;
		Column7.Name = "cMarca", ;
		Column7.ReadOnly = .T., ;
		Column7.Width = 85, ;
		Column8.ColumnOrder = 4, ;
		Column8.ControlSource = "masina", ;
		Column8.FontName = "Arial", ;
		Column8.FontSize = 10, ;
		Column8.Name = "cMasina", ;
		Column8.ReadOnly = .T., ;
		Column9.ColumnOrder = 13, ;
		Column9.ControlSource = "tip_comanda", ;
		Column9.FontName = "Arial", ;
		Column9.FontSize = 10, ;
		Column9.Name = "cTip_comanda", ;
		Column9.ReadOnly = .T., ;
		Column9.Width = 78, ;
		Column10.ColumnOrder = 11, ;
		Column10.ControlSource = "IIF(TYPE('datafact')=='D',datafact,TTOD(datafact))", ;
		Column10.FontName = "Arial", ;
		Column10.FontSize = 10, ;
		Column10.Name = "cDataFact", ;
		Column10.ReadOnly = .T., ;
		Column10.Width = 82, ;
		Column11.ColumnOrder = 12, ;
		Column11.ControlSource = "nrfact", ;
		Column11.FontName = "Arial", ;
		Column11.FontSize = 10, ;
		Column11.InputMask = (get_mask(14,0)), ;
		Column11.Name = "cNrFact", ;
		Column11.ReadOnly = .T., ;
		Column11.Width = 80, ;
		Column12.ColumnOrder = 6, ;
		Column12.ControlSource = "inspector", ;
		Column12.FontName = "Arial", ;
		Column12.FontSize = 10, ;
		Column12.Name = "cInspector", ;
		Column12.ReadOnly = .T., ;
		Column12.Width = 61, ;
		Column13.ColumnOrder = 7, ;
		Column13.ControlSource = "nr_dosar", ;
		Column13.FontName = "Arial", ;
		Column13.FontSize = 10, ;
		Column13.Name = "cNr_dosar", ;
		Column13.ReadOnly = .T., ;
		Column13.Width = 69, ;
		Column14.ControlSource = "IIF(inchis_fortat=1,'Da','Nu')", ;
		Column14.FontName = "Arial", ;
		Column14.FontSize = 10, ;
		Column14.Name = "cArhivat", ;
		Column14.ReadOnly = .T., ;
		Column14.Width = 42, ;
		Column15.ControlSource = "part_ref", ;
		Column15.FontName = "Arial", ;
		Column15.FontSize = 10, ;
		Column15.Name = "cPartRef", ;
		Column15.ReadOnly = .T., ;
		Column15.Width = 112, ;
		Column16.ControlSource = "series", ;
		Column16.FontSize = 10, ;
		Column16.Name = "cSeries", ;
		Column16.ReadOnly = .T., ;
		Column16.Width = 181, ;
		Column17.ControlSource = "kmint", ;
		Column17.FontSize = 10, ;
		Column17.Name = "cKmint", ;
		Column17.ReadOnly = .T., ;
		Column18.ControlSource = "ore_functionare", ;
		Column18.FontSize = 10, ;
		Column18.Name = "cOreFunctionare", ;
		Column18.ReadOnly = .T., ;
		Column19.ControlSource = "valctva_factura", ;
		Column19.FontSize = 10, ;
		Column19.Format = "R", ;
		Column19.InputMask = (get_mask(16,gnPc)), ;
		Column19.Name = "cValcTVAFactura", ;
		Column19.ReadOnly = .T., ;
		Column19.Width = 138, ;
		Column20.ControlSource = "val_manopera_factura", ;
		Column20.FontSize = 10, ;
		Column20.Format = "R", ;
		Column20.InputMask = (get_mask(16,gnPc)), ;
		Column20.Name = "cValManoperaFactura", ;
		Column20.ReadOnly = .T., ;
		Column20.Width = 152, ;
		Column21.ControlSource = "val_materiale_factura", ;
		Column21.FontSize = 10, ;
		Column21.Format = "R", ;
		Column21.InputMask = (get_mask(16,gnPc)), ;
		Column21.Name = "cValMaterialeFactura", ;
		Column21.ReadOnly = .T., ;
		Column21.Width = 148, ;
		Column22.ControlSource = "val_materiale_ach", ;
		Column22.FontSize = 10, ;
		Column22.Format = "R", ;
		Column22.InputMask = (get_mask(16,gnPc)), ;
		Column22.Name = "cValMaterialeAch", ;
		Column22.ReadOnly = .T., ;
		Column22.Width = 157, ;
		Column23.ControlSource = "val_materiale_vz", ;
		Column23.CurrentControl = "Text1", ;
		Column23.FontSize = 10, ;
		Column23.Format = "R", ;
		Column23.InputMask = (get_mask(16,gnPc)), ;
		Column23.Name = "cValMaterialeVz", ;
		Column23.ReadOnly = .T., ;
		Column23.Width = 153, ;
		Column24.ControlSource = "ore_manopera", ;
		Column24.FontSize = 10, ;
		Column24.Format = "R", ;
		Column24.InputMask = (get_mask(16,gnPc)), ;
		Column24.Name = "cOreManopera", ;
		Column24.ReadOnly = .T., ;
		Column24.Width = 86, ;
		Column25.ControlSource = "val_manopera", ;
		Column25.FontSize = 10, ;
		Column25.Format = "R", ;
		Column25.InputMask = (get_mask(16,gnPc)), ;
		Column25.Name = "cValManopera", ;
		Column25.ReadOnly = .T., ;
		Column25.Width = 109
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdcomenzi.cArhivat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Arhivat", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cArhivat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cAsigurator.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Asigurator", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cAsigurator.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cDataFact.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data factura", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cDataFact.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cDatai.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data comanda", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cDatai.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cFacturat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Facturat", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cFacturat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cInspector.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Inspector", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cInspector.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cKmint.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Km la bord", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cKmint.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cMarca.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Marca masina", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cMarca.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cMasina.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Tip masina", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cMasina.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNr_dosar.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. dosar", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNr_dosar.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNrFact.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. factura", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNrFact.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNrord.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr.comanda", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNrord.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNume.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nume client", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNume.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cOreFunctionare.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Ore motor", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cOreFunctionare.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cOreManopera.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Ore manopera", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cOreManopera.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cPartRef.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Referinta", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cPartRef.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cSeries.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Serie sasiu", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cSeries.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cTip_comanda.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Tip comanda", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cTip_comanda.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cValcTVAFactura.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare factura cu TVA", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cValcTVAFactura.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cValidat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Validat", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cValidat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cValManopera.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare manopera", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cValManopera.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cValManoperaFactura.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare manopera factura", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cValManoperaFactura.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cValMaterialeAch.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare materiale achizitie", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cValMaterialeAch.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cValMaterialeFactura.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare materiale factura", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cValMaterialeFactura.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cValMaterialeVz.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare materiale vanzare", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cValMaterialeVz.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Gridextra1' AS gridextra WITH ;
		gridexpression = Thisform.grdComenzi, ;
		Left = 624, ;
		Name = "Gridextra1", ;
		productname = ROA, ;
		Top = 384
		*< END OBJECT: ClassLib="..\comun\utile\gridextras\gridextras.vcx" BaseClass="custom" />

	ADD OBJECT 'Lb_simplu1' AS lb_simplu WITH ;
		BackColor = 255,255,255, ;
		BackStyle = 0, ;
		Caption = "Tip comanda", ;
		FontName = "Arial Narrow", ;
		Left = 692, ;
		Name = "Lb_simplu1", ;
		TabIndex = 9, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 222, ;
		ZOrderSet = 14
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'lbArhivat' AS lb_simplu WITH ;
		Anchor = 8, ;
		BackColor = 255,255,255, ;
		BackStyle = 0, ;
		Caption = "Arhivate", ;
		FontName = "Arial Narrow", ;
		Left = 692, ;
		Name = "lbArhivat", ;
		TabIndex = 5, ;
		Top = 311, ;
		ZOrderSet = 15
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'lbValidat' AS lb_simplu WITH ;
		Anchor = 8, ;
		BackColor = 255,255,255, ;
		BackStyle = 0, ;
		Caption = "Validate", ;
		FontName = "Arial Narrow", ;
		Left = 692, ;
		Name = "lbValidat", ;
		TabIndex = 5, ;
		Top = 267, ;
		ZOrderSet = 15
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Xresize1' AS xresize WITH ;
		Left = 780, ;
		Name = "Xresize1", ;
		Top = 480
		*< END OBJECT: ClassLib="..\comun\clase\xresize.vcx" BaseClass="custom" />
	
	PROCEDURE actualizeaza_grid1
		Parameters tcFiltru
		Local lcFiltru
		If Empty(tcFiltru)
			lcFiltru = pocomenzi.ca_baza1.cfiltru
		Else
			lcFiltru = tcFiltru
		Endif
		
		Thisform.LockScreen = .T.
		Thisform.MousePointer = 11
		
		save_grid(Thisform.grdcomenzi)
		pocomenzi.ca_baza1.cfiltru = lcFiltru
		pocomenzi.ca_baza1.afisare()
		restore_grid(Thisform.grdcomenzi)
		
		If Reccount('crscomenzi')>0
			Thisform.grdcomenzi.SetFocus()
		Endif
		
		Thisform.MousePointer = 0
		Thisform.LockScreen = .F.
		
	ENDPROC

	PROCEDURE do_cauta
		Local lcFiltru
		Local lnOptiune, lnOptiuneArhivat
		lcFiltru = [2=2]
		
		lnOptiune = Iif(Thisform.cbValidat._combobox1.Value = '<Toate>', 1, Iif(Thisform.cbValidat._combobox1.Value = 'Validate', 2, 3))
		lnOptiuneArhivat = Iif(Thisform.cbArhivat._combobox1.Value = '<Toate>', 1, Iif(Thisform.cbArhivat._combobox1.Value = 'Active', 2, 3))
		
		If Thisform.ck_datai.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_datai.filtru
		Endif
		
		If Thisform.ck_nrinmat.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_nrinmat.filtru
		Endif
		
		If Thisform.ck_nrord.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_nrord.filtru
		Endif
		
		If Thisform.ck_nume.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_nume.filtru
		Endif
		
		If Thisform.ck_asigurator.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_asigurator.filtru
		ENDIF
		
		If Thisform.ck_inspector.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_inspector.filtru
		ENDIF
		
		If Thisform.ck_nr_dosar.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_nr_dosar.filtru
		Endif
		
		If Thisform.ck_facturat.Value = 1
			lcFiltru = lcFiltru + [ and a.facturat=1 ]
		Endif
		
		If Thisform.ck_series.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_series.filtru
		ENDIF
		
		If Thisform.cbtip_deviz._combobox1.Value!= "<Toate tipurile>"
			lcFiltru = lcFiltru + [ and a.id_tip = ] + Alltrim(Str(lista_tipuri.id_tip))
		Endif
		
		Do Case
			Case lnOptiune = 2
				lcFiltru = lcFiltru + [ and a.validat = 1]
			Case lnOptiune = 3
				lcFiltru = lcFiltru + [ and a.validat = 0]
		Endcase
		
		Do Case
			Case lnOptiuneArhivat = 2 && Active (nearhivate)
				lcFiltru = lcFiltru + [ and a.inchis_fortat = 0]
			Case lnOptiuneArhivat = 3 && arhivate
				lcFiltru = lcFiltru + [ and a.inchis_fortat = 1]
		ENDCASE
		
		If Thisform.ck_referinta.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_referinta.filtru
		ENDIF
		
		
		Thisform.actualizeaza_grid1(lcFiltru)
		
		If Reccount('crscomenzi') = 0
			amessagebox('Cautarea nu a intors rezultate!', 0 + 48, 'Info cautare')
			Thisform.ck_nrord.SetFocus()
		Endif
	ENDPROC

	PROCEDURE do_excel
		If Reccount('crscomenzi')=0
			amessagebox("Nu exista date pentru export!",0+48,"Atentie")
			Return
		Endif
		
		DO ExportExcelXml WITH this.grdcomenzi IN excelxml.prg
	ENDPROC

	PROCEDURE do_executa
		If Reccount('crscomenzi')>0
		*!*	modificare	v 2.0.35
			Select crscomenzi
			Scatter Name ocomanda
			vizualizeaza_detalii_comanda(Thisform,ocomanda,.T.)
		*!*		Private porul,pooper,podevest
		*!*		Store '' To porul,pooper,podevest
		*!*		Do ccsectii in update_devize.prg
		*!*		Select crscomenzi
		*!*		Scatter Name ocomanda
		*!*		pcschema=['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)']
		*!*		pcselect=['select id_ordl,codop,timpn,pret,validat,denop,sectie,datai,id_oper from ] + gcS + [.dev_voper where 1=2']
		*!*	*!*	modificare 09.06
		*!*	*!*	pcorder=[validat desc,dataora,datai,denop,sectie]
		*!*		pcorder=[datai,id_oper]
		*!*	*!*	^
		*!*	*!*	modificare 27.01
		*!*	*!*	pcschema=['ID_ORDL n(10),CODOP c(10),TIMPN n(9,3),PRET n(20,4),VALIDAT n(1),DENOP c(100),SECTIE c(30),DATAORA D']
		*!*	*!*	pcselect=['select id_ordl,codop,timpn,pret,validat,denop,sectie,dataora from ] + gcS + [.dev_voper where 1=2']
		*!*	*!*	pcorder=[dataora,sectie,denop]
		*!*		pcfiltru=[1=2]
		*!*		llAfiseaza=.F.
		*!*		gencursor('pooper','oper',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
		*!*		pooper.ca_baza1.afisare()
		*!*		pooper.ca_baza1.cfiltru = [id_ordl = ]+Alltrim(Str(ocomanda.id_ordl))+[ and ] + ;
		*!*			[extract(month from datai)+extract (year from datai)*12<=?gnLuna+?gnAn*12]
		*!*	*!*	modificare 27.01
		*!*	*!*			[extract(month from dataora)+extract (year from dataora)*12<=?gnLuna+?gnAn*12]
		*!*		pcschema=['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)']
		*!*		pcselect=['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 + [.dev_vestimari_rep where 1=2']
		*!*		pcorder=[id_dev_estimare_rep]
		*!*		pcfiltru=[1=2]
		*!*		llAfiseaza=.F.
		*!*		gencursor('podevest','v_devizest',pcselect,pcfiltru,pcschema,pcorder)
		*!*		podevest.ca_baza1.afisare()
		*!*		podevest.ca_baza1.cfiltru = [id_lucrare = ] + ALLTRIM(STR(ocomanda.id_lucrare))	
		*!*	*!*	modificare	v 2.0.22 : am adaugat tva
		*!*		pcschema=['CODMAT c(50),DENUMIRE c(100),PRETV n(20,4),CANTE n(18,3),DATAACT D,ID_RUL n(20),COTA_DIFERITA n(1),TVA n(20,4)']
		*!*		pcselect=[select codmat,denumire,pretv,cante,dataact,id_rul,decode(proc_tvav,pack_contafin.getCotaTVAStandard(?gnLuna,?gnAn),0,1) as cota_diferita,] + ;
		*!*				[pack_sesiune.calculeaza_pret_tva(pretv,1,pack_def.GetIdMonedaNationala(),pack_contafin.getCotaTVAStandard(?gnLuna,?gnAn),0) as tva ] + ;
		*!*				[from ] + gcS + [.vrul where 1=2']
		*!*		pcorder=[dataact,id_rul]
		*!*		pcfiltru=[1=2]
		*!*		llAfiseaza=.F.
		*!*		gencursor('porul','rul',pcselect,pcfiltru,pcschema,pcorder)
		*!*		porul.ca_baza1.afisare()
		*!*		porul.ca_baza1.cfiltru = [id_lucrare = ]+Alltrim(Str(ocomanda.id_lucrare))+[ and ]+;
		*!*			[luna+an*12<=?gnLuna+?gnAn*12]
		*!*		
		*!*		
		*!*		
		*!*		Thisform.AlwaysOnTop=.F.
		*!*		ofrmvizualizare = Createobject('frm_vizcomanda',2,ocomanda.Validat) && 2 = vizualizare
		*!*		ofrmvizualizare.Show(1)
		*!*		Thisform.AlwaysOnTop=.T.
		*!*	*!*	modificare	v 2.0.5
		*!*		If Used('oper')
		*!*			Use In oper
		*!*		Endif
		*!*		If Used('rul')
		*!*			Use In rul
		*!*		Endif
		*!*	*!*	modificare	v 2.0.5	^
		*!*	modificare	v 2.0.35	^
		Else
			amessagebox("Nu exista inregistrari pentru care sa vizualizati manopera si materialele!",48,"Atentie")
		Endif
	ENDPROC

	PROCEDURE do_listare
		Local lnIdOrdl, lnOptiune, lnRecno
		PRIVATE ocomanda
		lnOptiune = xmenu('Listare deviz;Listare raport comanda')
		If Empty(m.lnOptiune)
			Return
		Endif
		
		If m.lnOptiune = 1
			If Reccount('crscomenzi') > 0
				Private porul, pooper, pcschema1, pcselect1, poFirma
				Store '' To porul, pooper, poFirma
		
				Select crscomenzi
				lnRecno = Recno()
				Use In (Select('crsdevize'))
				*!*		Calculate Sum(ales) To lnAlese
				*!*		If lnAlese = 0
				Select * From crscomenzi Where Recno() = lnRecno Into Cursor crsdevize
				*!*		Else
				*!*			Select * From crscomenzi With (Buffering = .T.) Where ales = 1 Into Cursor crsdevize
				*!*		Endif
		
				Select crsdevize
				Scan
					Scatter Name ocomanda
					*!*			If ocomanda.Validat=1
					listare_comanda_deviz(Thisform, ocomanda)
					*!*			Else
					*!*				amessagebox("Nu puteti lista deviz pentru comanda " + Alltrim(ocomanda.nrord)+ ", deoarece nu este validata!",0+48,"Atentie")
					*!*			Endif
				Endscan
				Use In (Select('crsdevize'))
				*!*		Use In (Select('crsFirma'))		&&	modificare	v 2.0.35
				Select crscomenzi
				Go lnRecno
				Thisform.grdcomenzi.SetFocus()
			Else
				amessagebox("Nu ati selectat nici o comanda!", 0 + 48, "Atentie")
				Thisform.grdcomenzi.SetFocus()
			Endif
		Else
			If Reccount('crscomenzi') > 0
				Thisform.AlwaysOnTop = .F.
				lnIdOrdl = crscomenzi.id_ordl
				Do listare_precomanda With m.lnIdOrdl
				Thisform.AlwaysOnTop = .T.
			Endif
		Endif
	ENDPROC

	PROCEDURE do_reset
		With Thisform
			For i=1 To .Objects.Count
				If Upper(.Objects(i).BaseClass)='CHECKBOX'
					.Objects(i).Value=0
				Endif
			Endfor
		Endwith
		Thisform.cbtip_deviz.do_reset()
		thisform.cbvalidat.do_reset()
		thisform.cbarhivat.do_reset()
		Thisform.ck_nrord.SetFocus()
	ENDPROC

	PROCEDURE do_sterge
		SELECT crsComenzi
		SCATTER NAME ocom
		
		lcSql = [update ] + gcS + [.dev_ordl set sters = 1, dataoras = sysdate , id_utils = ] + ALLTRIM(STR(gnIdUtil)) + [where id_ordl = ]+ALLTRIM(STR(ocom.id_ordl))
		lnSucces = goExecutor.oExecute(lcSql)
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,"Eroare")
			Return
		ENDIF
		
		lcSql = [update ] + gcS + [.dev_oper set sters = 1, dataoras = sysdate , id_utils = ] + ALLTRIM(STR(gnIdUtil)) + [where id_ordl = ]+ALLTRIM(STR(ocom.id_ordl))
		lnSucces = goExecutor.oExecute(lcSql)
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,"Eroare")
			Return
		ENDIF
		
		lcSql = [select * from ] + gcS + [.dev_oper where id_ordl = ]+ALLTRIM(STR(ocom.id_ordl))
		lcCursor = 'crsOper'
		lnSucces = goExecutor.oExecute(lcSql,lcCursor)
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,"Eroare")
			Return
		ENDIF
		
		SELECT &lcCursor
		
		IF _tally <= 0
			RETURN
		ENDIF 
		
		SCAN 
		SCATTER NAME oop
			lcSql = [update ] + gcS + [.dev_oper_mecanici set sters = 1 where id_oper = ]+ALLTRIM(STR(oop.id_oper))
			lnSucces = goExecutor.oExecute(lcSql)
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,0+16,"Eroare")
				Return
			ENDIF
			RELEASE oop
		ENDSCAN 
		SELECT &lcCursor
		USE 
		thisform.do_cauta
		
	ENDPROC

	PROCEDURE Init
		DODEFAULT()
		this.gridextra1.setup()
	ENDPROC

	PROCEDURE cbArhivat._combobox1.Destroy
		Use In (SELECT('lista_arhivat'))
	ENDPROC

	PROCEDURE cbArhivat._combobox1.Init
		Create Cursor lista_arhivat (denumire C(50),id N(5))
		Select lista_arhivat
		INSERT INTO lista_arhivat (denumire, id) VALUES ('<Toate>', 0)
		INSERT INTO lista_arhivat (denumire, id) VALUES ('Active', 1)
		INSERT INTO lista_arhivat (denumire, id) VALUES ('Arhivate', 2)
		
		
		This.RowSourceType= 2
		This.RowSource="lista_arhivat"
		This.Value="Active"
		this.Parent.cdefault="Active"
	ENDPROC

	PROCEDURE cbValidat._combobox1.Destroy
		Use In (SELECT('lista_validat'))
	ENDPROC

	PROCEDURE cbValidat._combobox1.Init
		Create Cursor lista_validat(denumire C(50),id N(5))
		Select lista_validat
		INSERT INTO lista_validat(denumire, id) VALUES ('<Toate>', 0)
		INSERT INTO lista_validat(denumire, id) VALUES ('Validate', 1)
		INSERT INTO lista_validat(denumire, id) VALUES ('Nevalidate', 2)
		
		
		This.RowSourceType= 2
		This.RowSource="lista_validat"
		This.Value="<Toate>"
		this.Parent.cdefault="<Toate>"
	ENDPROC

	PROCEDURE grdcomenzi.AfterRowColChange
		Lparameters nColIndex
		If This.RowColChange!=2
			DoDefault()
		Endif
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_modificare_mc AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="grdclienti" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cPartener.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cPartener.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cCod_fiscal.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cCod_fiscal.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cAdresa.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cAdresa.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cMarca.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cMarca.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cMasina.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cMasina.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cCuloare.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cCuloare.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cKmint.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cKmint.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cSeries.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cSeries.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cSeriem.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdclienti.cSeriem.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_nrord" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_mesaj" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_client" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />

	*<PropValue>
		cgridsortlist = grdclienti
		DoCreate = .T.
		Height = 421
		Name = "frm_modificare_mc"
		Width = 684
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 684
		_shape2.Height = 29
		_shape2.Left = 620
		_shape2.Name = "_shape2"
		_shape2.Top = -1
		_shape2.Width = 73
		Lb_titlu_alb_b121.Caption = "MODIFICARE CLIENT COMANDĂ"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 3
		BUT_TERMIN1.Left = 654
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 4
		BUT_TERMIN1.Top = 1
		Gridsort1.Left = 0
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 324
	*</PropValue>

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Left = 624, ;
		Name = "But_renunt1", ;
		Top = 1
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grdclienti' AS _grdrow WITH ;
		ColumnCount = 9, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		Height = 276, ;
		Left = 36, ;
		Name = "grdclienti", ;
		Panel = 1, ;
		RecordSource = "crsclienti", ;
		TabIndex = 5, ;
		Top = 120, ;
		Width = 612, ;
		Column1.ControlSource = "partener", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cPartener", ;
		Column1.Width = 127, ;
		Column2.ColumnOrder = 2, ;
		Column2.ControlSource = "cod_fiscal", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cCod_fiscal", ;
		Column3.ColumnOrder = 3, ;
		Column3.ControlSource = "adresa", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.Name = "cAdresa", ;
		Column3.Width = 139, ;
		Column4.ControlSource = "marca", ;
		Column4.FontName = "Arial Narrow", ;
		Column4.Name = "cMarca", ;
		Column5.ControlSource = "masina", ;
		Column5.FontName = "Arial Narrow", ;
		Column5.Name = "cMasina", ;
		Column6.ControlSource = "culoare", ;
		Column6.FontName = "Arial Narrow", ;
		Column6.Name = "cCuloare", ;
		Column7.ControlSource = "kmint", ;
		Column7.FontName = "Arial Narrow", ;
		Column7.Name = "cKmint", ;
		Column7.Width = 88, ;
		Column8.ControlSource = "series", ;
		Column8.FontName = "Arial Narrow", ;
		Column8.Name = "cSeries", ;
		Column8.Width = 137, ;
		Column9.ControlSource = "seriem", ;
		Column9.FontName = "Arial Narrow", ;
		Column9.Name = "cSeriem", ;
		Column9.Width = 164
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdclienti.cAdresa.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Adresa", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdclienti.cAdresa.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdclienti.cCod_fiscal.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cod fiscal", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdclienti.cCod_fiscal.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdclienti.cCuloare.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Culoare", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdclienti.cCuloare.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdclienti.cKmint.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Km int.", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdclienti.cKmint.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdclienti.cMarca.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Marca", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdclienti.cMarca.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdclienti.cMasina.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Model", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdclienti.cMasina.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdclienti.cPartener.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Client", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdclienti.cPartener.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdclienti.cSeriem.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Serie motor", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdclienti.cSeriem.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdclienti.cSeries.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Serie sasiu", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdclienti.cSeries.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Lb_client' AS lb_simplu WITH ;
		Caption = "Client", ;
		FontBold = .T., ;
		FontSize = 12, ;
		Height = 22, ;
		Left = 29, ;
		Name = "Lb_client", ;
		TabIndex = 6, ;
		Top = 63, ;
		Width = 46
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_mesaj' AS lb_simplu WITH ;
		Caption = "Alegeți clientul pe care doriți să mutați comanda:", ;
		Left = 22, ;
		Name = "Lb_mesaj", ;
		TabIndex = 7, ;
		Top = 95
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_nrord' AS lb_simplu WITH ;
		Caption = "Comandă", ;
		FontBold = .T., ;
		FontSize = 12, ;
		Height = 22, ;
		Left = 29, ;
		Name = "Lb_nrord", ;
		TabIndex = 6, ;
		Top = 39, ;
		Width = 76
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />
	
	PROCEDURE inainte_de_do_termin
		Local llReturn
		Store .T. To llReturn
		Select crsclienti
		pnIdMasiniClient=id_masiniclient
		lcNumeNou=Alltrim(Nvl(partener,[---]))
		lcNumeVechi=Alltrim(Substr(Thisform.lb_client.Caption,8))
		If Empty(pnIdMasiniClient)
			amessagebox("Nu ati ales clientul pe care doriti sa mutati comanda!",0+48,"Atentie")
			llReturn=.F.
		Else
			If amessagebox("Doriti sa treceti comanda de pe clientul "+lcNumeVechi+;
					" pe clientul "+lcNumeNou+" ?",4+32+256,"Confirmare")==6
				llReturn=.T.
			Else
				llReturn=.F.
			Endif
		Endif
		Return llReturn
		
	ENDPROC

	PROCEDURE Init
		Lparameters tcComanda,tcClient
		DoDefault()
		Thisform.lb_nrord.Caption=[Comandă: ]+Alltrim(Nvl(tcComanda,[---]))
		Thisform.lb_client.Caption=[Client: ]+Alltrim(Nvl(tcClient,[---]))
		Select crsclienti
		Go Top
		Thisform.AutoCenter=.T.
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_normare_salarii AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_shape3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cNrord.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cNrord.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cDatai.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cDatai.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cDenumire.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cDenumire.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cTimpN.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cTimpN.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cPret.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cPret.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cValoare.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cValoare.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cFacturat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cFacturat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cUtil.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cUtil.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cDataora.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cDataora.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cIncasat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cIncasat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cDatafactura.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cDatafactura.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cSectie.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cSectie.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cTip_comanda.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cTip_comanda.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_cauta1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_reset1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_datafact" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_sectie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_mecanic" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_denumire" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrord" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_totalore" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_totalvaloare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_nrinreg" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_nrord" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_totalore" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmecanici" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmecanici.cMecanic.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmecanici.cMecanic._cbbase1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmecanici.cMecanic._textbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmecanici.cOre.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmecanici.cOre.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_timpn" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="tx_timpn" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="tx_nrord" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_nou1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_sterge1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_normare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="tx_totalore" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cbtip_deviz" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="clb_ore_mecanic" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*p: lsalvat		&& Arata daca modificarile facute asupra datelor din grid au fost salvate in baza de date.
		*p: lvalidat		&& Arata daca inregistrarea modificata a fost validata sau nu inainte de iesirea din forma.
		*p: norainitiala		&& Ora initiala.
		*p: noramodificata		&& Ora modificata.
		*p: ntimpnedistribuit		&& Specifica cat timp a ramas nedistribuit pentru operatia selectata.
	*</DefinedPropArrayMethod>

	*<PropValue>
		cgridsortlist = grdmanopera,grdmecanici
		DoCreate = .T.
		Height = 566
		lactiv4 = .T.
		lsalvat = .T.
		lvalidat = .T.
		Name = "frm_normare_salarii"
		ntimpnedistribuit = 0.000
		Width = 793
		WindowState = 2
		_shape1.Anchor = 10
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Tag = "RESIZABLE,NOVERTICAL_RESIZE"
		_shape1.Top = 0
		_shape1.Width = 792
		_shape1.ZOrderSet = 1
		_shape2.Anchor = 8
		_shape2.Height = 29
		_shape2.Left = 756
		_shape2.Name = "_shape2"
		_shape2.Tag = "MOVABLE,NOVERTICAL_MOVE"
		_shape2.Top = -1
		_shape2.Width = 38
		_shape2.ZOrderSet = 9
		Lb_titlu_alb_b121.Caption = "MANOPERĂ - SALARIZARE"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 15
		Lb_titlu_alb_b121.ZOrderSet = 2
		BUT_TERMIN1.Anchor = 8
		BUT_TERMIN1.Comment = "MOVABLE,NOVERTICAL_MOVE"
		BUT_TERMIN1.Left = 762
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 14
		BUT_TERMIN1.Tag = "MOVABLE,NOVERTICAL_MOVE"
		BUT_TERMIN1.Top = 0
		BUT_TERMIN1.ZOrderSet = 14
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT '_shape3' AS _shape WITH ;
		Anchor = 13, ;
		BackColor = 255,255,255, ;
		BackStyle = 0, ;
		BorderColor = 128,128,128, ;
		Height = 240, ;
		Left = 428, ;
		Name = "_shape3", ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 167, ;
		Width = 345, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="shape" />

	ADD OBJECT 'But_nou1' AS but_nou WITH ;
		Anchor = 8, ;
		Left = 723, ;
		Name = "But_nou1", ;
		TabIndex = 11, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 152, ;
		ZOrderSet = 22
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_sterge1' AS but_sterge WITH ;
		Anchor = 8, ;
		Left = 753, ;
		Name = "But_sterge1", ;
		TabIndex = 12, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 152, ;
		Visible = .T., ;
		ZOrderSet = 23
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'cbtip_deviz' AS ctip_deviz WITH ;
		Anchor = 8, ;
		Left = 511, ;
		Name = "cbtip_deviz", ;
		TabIndex = 8, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 111, ;
		ZOrderSet = 26, ;
		_combobox1.Name = "_combobox1"
		*< END OBJECT: ClassLib="oviz_devize.vcx" BaseClass="container" />

	ADD OBJECT 'Ck_datafact' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.datafact, ;
		Caption = "Dată factură", ;
		FontName = "Arial Narrow", ;
		Left = 432, ;
		Name = "Ck_datafact", ;
		TabIndex = 6, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		tip = D, ;
		Top = 123, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_denumire' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = b.denop, ;
		Caption = "Denumire", ;
		FontName = "Arial Narrow", ;
		Left = 432, ;
		Name = "Ck_denumire", ;
		TabIndex = 3, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 61, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_mecanic' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = nume||CHR(32)||prenume, ;
		Caption = "Mecanic", ;
		FontName = "Arial Narrow", ;
		Left = 432, ;
		Name = "Ck_mecanic", ;
		TabIndex = 5, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 103, ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrord' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nrord, ;
		Caption = "Nr. comandă", ;
		FontName = "Arial Narrow", ;
		Left = 432, ;
		Name = "Ck_nrord", ;
		TabIndex = 2, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 42, ;
		ZOrderSet = 10
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_sectie' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = b.sectie, ;
		Caption = "Secție", ;
		FontName = "Arial Narrow", ;
		Left = 432, ;
		Name = "Ck_sectie", ;
		TabIndex = 4, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 82, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Clb_nrinreg' AS clb_tx_simplu WITH ;
		Anchor = 12, ;
		Left = 490, ;
		Name = "Clb_nrinreg", ;
		TabIndex = 18, ;
		TabStop = .F., ;
		Tag = "MOVABLE", ;
		Top = 524, ;
		ZOrderSet = 13, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.InputMask = "999 999 999 999", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Nr. înregistrări", ;
		Lb_simplu1.Left = 3, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'clb_ore_mecanic' AS clb_tx_simplu WITH ;
		Anchor = 12, ;
		Left = 489, ;
		Name = "clb_ore_mecanic", ;
		TabIndex = 26, ;
		Tag = "MOVABLE", ;
		Top = 421, ;
		Visible = .F., ;
		Text_simplu1.Alignment = 1, ;
		Text_simplu1.InputMask = "999 999 999.999", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Lb_simplu1.Caption = "Ore mecanic", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_totalore' AS clb_tx_simplu WITH ;
		Anchor = 12, ;
		Left = 490, ;
		Name = "Clb_totalore", ;
		TabIndex = 17, ;
		TabStop = .F., ;
		Tag = "MOVABLE", ;
		Top = 453, ;
		ZOrderSet = 11, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.InputMask = "999 999 999.999", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Value = 0.00, ;
		Lb_simplu1.Caption = "Total timp normat", ;
		Lb_simplu1.Left = 3, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_totalvaloare' AS clb_tx_simplu WITH ;
		Anchor = 12, ;
		Left = 490, ;
		Name = "Clb_totalvaloare", ;
		TabIndex = 19, ;
		TabStop = .F., ;
		Tag = "MOVABLE", ;
		Top = 481, ;
		ZOrderSet = 12, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Total valoare lei", ;
		Lb_simplu1.Left = 3, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cmd_cauta1' AS cmd_cauta WITH ;
		Anchor = 8, ;
		Left = 610, ;
		Name = "Cmd_cauta1", ;
		TabIndex = 9, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 42, ;
		ZOrderSet = 4
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_normare' AS cmd_executa WITH ;
		Anchor = 8, ;
		Caption = "\<Distribuire egală timp normat", ;
		Enabled = .F., ;
		Height = 53, ;
		Left = 700, ;
		Name = "Cmd_normare", ;
		TabIndex = 13, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 47, ;
		Width = 84, ;
		WordWrap = .T., ;
		ZOrderSet = 24
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_reset1' AS cmd_reset WITH ;
		Anchor = 8, ;
		Left = 610, ;
		Name = "Cmd_reset1", ;
		TabIndex = 16, ;
		TabStop = .F., ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 78, ;
		ZOrderSet = 5
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grdmanopera' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 13, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		Height = 516, ;
		Left = 20, ;
		Name = "grdmanopera", ;
		Panel = 1, ;
		RecordSource = "crsmanopera", ;
		RowHeight = 23, ;
		TabIndex = 1, ;
		Tag = "RESIZABLE", ;
		Top = 36, ;
		Width = 388, ;
		ZOrderSet = 3, ;
		Column1.ControlSource = "nrord", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cNrord", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 90, ;
		Column2.ControlSource = "datai", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cDatai", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 65, ;
		Column3.ControlSource = "denop", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.Name = "cDenumire", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 160, ;
		Column4.ControlSource = "timpn", ;
		Column4.FontName = "Arial Narrow", ;
		Column4.Format = "R", ;
		Column4.InputMask = "99 999.999", ;
		Column4.Name = "cTimpN", ;
		Column4.ReadOnly = .T., ;
		Column4.Width = 58, ;
		Column5.ControlSource = "pret", ;
		Column5.FontName = "Arial Narrow", ;
		Column5.Format = "R", ;
		Column5.InputMask = (get_mask(12,gnPPretV)), ;
		Column5.Name = "cPret", ;
		Column5.ReadOnly = .T., ;
		Column5.Width = 85, ;
		Column6.ControlSource = "ROUND(pret*timpn,gnPc)", ;
		Column6.FontName = "Arial Narrow", ;
		Column6.Format = "R", ;
		Column6.InputMask = (get_mask(12,gnPc)), ;
		Column6.Name = "cValoare", ;
		Column6.ReadOnly = .T., ;
		Column6.Width = 108, ;
		Column7.Alignment = 2, ;
		Column7.ColumnOrder = 8, ;
		Column7.ControlSource = "IIF(facturat=1,'Da','Nu')", ;
		Column7.FontName = "Arial Narrow", ;
		Column7.Name = "cFacturat", ;
		Column7.ReadOnly = .T., ;
		Column7.Width = 43, ;
		Column8.ColumnOrder = 11, ;
		Column8.ControlSource = "util", ;
		Column8.FontName = "Arial Narrow", ;
		Column8.Name = "cUtil", ;
		Column8.ReadOnly = .T., ;
		Column8.Width = 115, ;
		Column9.ColumnOrder = 12, ;
		Column9.ControlSource = "dataora", ;
		Column9.FontName = "Arial Narrow", ;
		Column9.Name = "cDataora", ;
		Column9.ReadOnly = .T., ;
		Column9.Width = 93, ;
		Column10.ColumnOrder = 9, ;
		Column10.ControlSource = "incasat", ;
		Column10.FontName = "Arial Narrow", ;
		Column10.Name = "cIncasat", ;
		Column10.ReadOnly = .T., ;
		Column10.Width = 38, ;
		Column11.ColumnOrder = 10, ;
		Column11.ControlSource = "datafact", ;
		Column11.FontName = "Arial Narrow", ;
		Column11.Name = "cDatafactura", ;
		Column11.ReadOnly = .T., ;
		Column11.Width = 58, ;
		Column12.ColumnOrder = 7, ;
		Column12.ControlSource = "sectie", ;
		Column12.FontName = "Arial Narrow", ;
		Column12.Name = "cSectie", ;
		Column12.Width = 132, ;
		Column13.ControlSource = "tip_comanda", ;
		Column13.FontName = "Arial Narrow", ;
		Column13.Name = "cTip_comanda"
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdmanopera.cDatafactura.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data factura", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cDatafactura.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cDatai.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cDatai.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cDataora.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data si ora validarii", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cDataora.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cDenumire.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Denumire", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cDenumire.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cFacturat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Facturat", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cFacturat.Text1' AS textbox WITH ;
		Alignment = 2, ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cIncasat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Incasat", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cIncasat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cNrord.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr.comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cNrord.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cPret.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cPret.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cSectie.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Sectie", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cSectie.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cTimpN.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Timp normat", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cTimpN.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cTip_comanda.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Tip comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cTip_comanda.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cUtil.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Validata de catre", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cUtil.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cValoare.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cValoare.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmecanici' AS _grdrow WITH ;
		Anchor = 13, ;
		ColumnCount = 2, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		Height = 208, ;
		Left = 439, ;
		Name = "grdmecanici", ;
		Panel = 1, ;
		RecordSource = "crsmecanici", ;
		RowHeight = 27, ;
		TabIndex = 10, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 183, ;
		Width = 324, ;
		ZOrderSet = 18, ;
		Column1.ControlSource = "nume", ;
		Column1.DynamicCurrentControl = "IIF(glLunaInchisa,'_textbox1','_cbbase1')", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cMecanic", ;
		Column1.Sparse = .F., ;
		Column1.Width = 227, ;
		Column2.ControlSource = "ore", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Format = "R", ;
		Column2.InputMask = "99 999.999", ;
		Column2.Name = "cOre", ;
		Column2.Width = 65
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdmecanici.cMecanic._cbbase1' AS _cbbase WITH ;
		FontName = "Arial Narrow", ;
		Left = 35, ;
		Name = "_cbbase1", ;
		RowSource = "v_mecanici.nume,id_mecanic", ;
		RowSourceType = 6, ;
		Top = 27
		*< END OBJECT: ClassLib="..\comun\clase\_cb_base.vcx" BaseClass="combobox" />

	ADD OBJECT 'grdmecanici.cMecanic._textbox1' AS _textbox WITH ;
		Left = 114, ;
		Name = "_textbox1", ;
		Top = 32
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'grdmecanici.cMecanic.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Mecanic", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmecanici.cOre.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. ore", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmecanici.cOre.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'lb_nrord' AS lb_simplu WITH ;
		Anchor = 8, ;
		BackColor = 255,255,255, ;
		BackStyle = 1, ;
		Caption = "Nr. comandă : ", ;
		FontName = "Arial Narrow", ;
		Left = 441, ;
		Name = "lb_nrord", ;
		TabIndex = 20, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 160, ;
		ZOrderSet = 16
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu1' AS lb_simplu WITH ;
		Anchor = 8, ;
		BackColor = 255,255,255, ;
		BackStyle = 1, ;
		Caption = "Tip comandă", ;
		FontName = "Arial Narrow", ;
		Left = 507, ;
		Name = "Lb_simplu1", ;
		TabIndex = 7, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 94, ;
		ZOrderSet = 15
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_timpn' AS lb_simplu WITH ;
		Anchor = 8, ;
		BackColor = 255,255,255, ;
		BackStyle = 1, ;
		Caption = "Timp normat :", ;
		FontName = "Arial Narrow", ;
		Height = 18, ;
		Left = 596, ;
		Name = "Lb_timpn", ;
		TabIndex = 21, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 160, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_totalore' AS lb_simplu WITH ;
		Anchor = 12, ;
		BackColor = 255,255,255, ;
		BackStyle = 1, ;
		Caption = "Total ore:", ;
		FontName = "Arial Narrow", ;
		Height = 18, ;
		Left = 665, ;
		Name = "Lb_totalore", ;
		TabIndex = 22, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 397, ;
		ZOrderSet = 17
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'tx_nrord' AS _textbox WITH ;
		Anchor = 8, ;
		FontName = "Arial Narrow", ;
		Height = 23, ;
		Left = 506, ;
		Name = "tx_nrord", ;
		ReadOnly = .T., ;
		TabIndex = 25, ;
		TabStop = .F., ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 156, ;
		Width = 86, ;
		ZOrderSet = 21
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'tx_timpn' AS _textbox WITH ;
		Alignment = 3, ;
		Anchor = 8, ;
		FontBold = .T., ;
		Format = "R", ;
		Height = 23, ;
		InputMask = "99 999.999", ;
		Left = 657, ;
		Name = "tx_timpn", ;
		ReadOnly = .T., ;
		TabIndex = 24, ;
		TabStop = .F., ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 156, ;
		Value = 0.000, ;
		Width = 60, ;
		ZOrderSet = 20
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'tx_totalore' AS _textbox WITH ;
		Alignment = 3, ;
		Anchor = 12, ;
		FontBold = .T., ;
		Format = "R", ;
		Height = 23, ;
		InputMask = "99 999.999", ;
		Left = 708, ;
		Name = "tx_totalore", ;
		ReadOnly = .T., ;
		TabIndex = 23, ;
		TabStop = .F., ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 393, ;
		Value = 0.000, ;
		Width = 60, ;
		ZOrderSet = 25
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />
	
	PROCEDURE Activate
		If Reccount('crsmanopera')>0
			Select Sum(ROUND(Pret*timpn,gnPc)) As totalval,Sum(timpn) As totalore From crsmanopera Into Cursor crstotal
			Select crstotal
			Thisform.clb_totalvaloare.text_simplu1.Value=totalval
			Thisform.clb_totalore.text_simplu1.Value=totalore
			Use In crstotal
		
			Thisform.cmd_normare.Enabled=IIF(!glLunaInchisa,.T.,.F.)
			Thisform.grdmanopera.SetFocus()
		Else
			Thisform.cmd_normare.Enabled=.F.
		Endif
		*!*	If This.WindowState= 2 And Type('this.xresize1')='O'
		*!*		This.xresize1.rearrange()
		*!*	Endif
	ENDPROC

	PROCEDURE actualizeaza_grid1
		Parameters tcFiltru
		Local lcFiltru
		If Empty(tcFiltru)
			lcFiltru = pomanopera.ca_baza1.cfiltru
		Else
			lcFiltru = tcFiltru
		Endif
		
		Thisform.LockScreen = .T.
		Thisform.MousePointer = 11
		
		save_grid_comment(Thisform.grdmanopera)
		pomanopera.ca_baza1.cfiltru = lcFiltru
		pomanopera.ca_baza1.afisare()
		restore_grid_comment(Thisform.grdmanopera)
		
		If Reccount('crsmanopera')>0
			Select Sum(ROUND(Pret*timpn,gnPc)) As totalval,Sum(timpn) As totalore From crsmanopera Into Cursor crstotal
			Select crstotal
			Thisform.clb_totalvaloare.text_simplu1.Value=totalval
			Thisform.clb_totalore.text_simplu1.Value=totalore
			Thisform.clb_totalvaloare.refresh
			Thisform.clb_totalore.refresh
			Use In crstotal
		
			Thisform.cmd_normare.Enabled=IIF(!glLunaInchisa,.T.,.F.)
			Thisform.grdmanopera.SetFocus()
		Else
			Thisform.clb_totalvaloare.text_simplu1.Value=0
			Thisform.clb_totalore.text_simplu1.Value=0
			Thisform.clb_totalvaloare.refresh
			Thisform.clb_totalore.refresh
		
			Thisform.cmd_normare.Enabled=.F.
		Endif
		
		IF thisform.ck_mecanic.Value=1
			IF USED('crssumamec')
				USE IN crssumamec
			ENDIF
		*!*	modificare 27.01
		*!*		[join ] + gcS + [.dev_voper b on a.id_ordl=b.id_ordl ]+
			lcSql=[select SUM(c.ore) as total ]+;
				[from ] + gcS + [.auto_normare_comenzi a ]+;
				[join ] + gcS + [.auto_voper_simplu b on a.id_ordl=b.id_ordl ]+;
				[join ] + gcS + [.auto_voper_mecanici c on b.id_oper=c.id_oper ]+;
				[where ] + lcFiltru + [ and c.nume||CHR(32)||c.prenume like '] + thisform.ck_mecanic.cvaloare1 +[%' ]
			
			lnSucces = goExecutor.oExecute(lcSql,'crssumamec')
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,0+16,'Eroare')
				Return
			ENDIF
			SELECT crssumamec
			thisform.clb_ore_mecanic.text_simplu1.Value=crssumamec.total
			thisform.clb_ore_mecanic.Visible=.T.
		ELSE
			thisform.clb_ore_mecanic.Visible=.F.	
		ENDIF
		
		
		Thisform.clb_nrinreg.text_simplu1.Value=Reccount('crsmanopera')
		Thisform.MousePointer = 0
		Thisform.LockScreen = .F.
		
	ENDPROC

	PROCEDURE actualizeaza_grid2
		Parameters tcFiltru
		Local lcFiltru,lnTimpn
		If Empty(tcFiltru)
			lcFiltru = pomecanici.ca_baza1.cfiltru
		Else
			lcFiltru = tcFiltru
		Endif
		
		Thisform.LockScreen = .T.
		Thisform.MousePointer = 11
		
		Select crsmanopera
		lnTimpn=timpn
		
		save_grid_comment(Thisform.grdmecanici)
		pomecanici.ca_baza1.cfiltru = lcFiltru
		pomecanici.ca_baza1.afisare()
		restore_grid_comment(Thisform.grdmecanici)
		
		If Used('crstotalore')
			Use In crstotalore
		Endif
		Select Nvl(Sum(ore),0) As Total From crsmecanici Into Cursor crstotalore
		Select crstotalore
		Thisform.tx_totalore.Value=Total
		Thisform.ntimpnedistribuit=lnTimpn-Total
		Use In crstotalore
		Thisform.grdmecanici.nrecno=1
		
		Thisform.MousePointer = 0
		Thisform.LockScreen = .F.
	ENDPROC

	PROCEDURE do_adauga
		If Reccount('crsmanopera')>0 AND !glLunaInchisa
			Private pnIesire,pcselect,pcfiltru,pcorder,pnid_mecanic,pnid_sectie,pnid_oper,oCautare
			Local lnTimpn,lnSumaOre
			Store "" To oCautare
			pnIesire=0
			pnid_mecanic=0
			Select crsmanopera
			pnid_oper=id_oper
		
			If Thisform.nTimpnedistribuit=0.000
				lcMesaj=Space(6)+"Nu mai puteti adauga inca un mecanic"+Space(6)+Chr(10)+Chr(13)+"deoarece nu mai exista timp normat nedistribuit!"
				amessagebox(lcMesaj,0+48,"Atentie")
				Return
			Endif
		
			pcselect=['select id_mecanic,nume||CHR(32)||prenume as nume,sectie from ] + gcS + [.auto_vmecanici where inactiv=0']
		*!*		pcfiltru = [2=2]
			pcfiltru = [inactiv=0]
			pcordine = [nume]
			oCautare=cauta_alfa(pcselect,pcfiltru,[''],pcordine,'nume,sectie','Alegeti mecanicul','Mecanic,Sectie')
			pnid_mecanic=oCautare.id_mecanic
			If pnIesire != 1 Or Empty(pnid_mecanic)
				Return
			Endif
		
			lcSql=[INSERT INTO ] + gcS + [.DEV_OPER_MECANICI(ID_OPER,ID_MECANIC,ORE) VALUES(]+Alltrim(Str(pnid_oper))+[,]+Alltrim(Str(pnid_mecanic))+[,]+Alltrim(Str(Thisform.nTimpnedistribuit,9,3))+[)]
			lnSucces=goExecutor.oExecute(lcSql)
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,0+16,'Eroare')
				Return
			Endif
		
			Thisform.actualizeaza_grid2()
			Select crsmecanici
			Locate For id_mecanic=pnid_mecanic
			Thisform.grdmecanici.SetFocus()
			Release oCautare
		Endif
	ENDPROC

	PROCEDURE do_cauta
		Local lcFiltru
		*!*	lcFiltru = [(extract(month from a.datafact) = ] + Alltrim(Str(gnLuna)) + [ and extract(year from a.datafact) = ]+Alltrim(Str(gnAn))+[ and a.facturat=1)]
		*!*	lcFiltru = gcCondLuna && + [and a.facturat = 1]
		lcFiltru = ''
		If Thisform.ck_datafact.Value=1
			lcFiltru = lcFiltru + Thisform.ck_datafact.filtru
		Endif
		
		If Thisform.ck_denumire.Value=1
			lcFiltru = lcFiltru + Thisform.ck_denumire.filtru
		Endif
		
		If Thisform.ck_nrord.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nrord.filtru
		Endif
		
		If Thisform.ck_sectie.Value=1
			lcFiltru = lcFiltru + Thisform.ck_sectie.filtru
		Endif
		
		If Thisform.ck_mecanic.Value=1
			lcFiltru = lcFiltru + [ and (b.id_oper in (select id_oper from ]+Alltrim(gcS)+[.auto_voper_detalii_m where ]+Substr(Thisform.ck_mecanic.filtru,5)+[))]
		Endif
		
		If Thisform.cbtip_deviz._combobox1.Value!="<Toate tipurile>"
			lcFiltru = lcFiltru + [ and a.id_tip = ] + Alltrim(Str(lista_tipuri.id_tip))
		Endif
		
		If !Empty(lcFiltru)
			lcFiltru = Substr(lcFiltru,5) + [ and ]
		Endif
		
		*!*	lcFiltru = lcFiltru + [((a.id_tip=1 and (a.facturat=1 and (extract(month from a.datafact)=?gnLuna ] + ;
		*!*		[and extract(year from a.datafact) =?gnAn ))) or ] + ;
		*!*		[(a.id_tip>1 and (a.validat=1 and (extract (month from a.dataoravalid)= ?gnLuna ] + ;
		*!*		[and extract(year from a.dataoravalid)=?gnAn)))) ]+;
		*!*		[and (extract(month from b.dataora)+extract(year from b.dataora)*12<=?gnLuna+?gnAn*12)]
		lcFiltru = lcFiltru + [((a.inch_validare = 0 and (a.facturat=1 and (extract(month from a.datafact)=?gnLuna ] + ;
			[and extract(year from a.datafact) =?gnAn ))) or ] + ;
			[(a.inch_validare = 1 and (a.validat=1 and (extract (month from a.dataoravalid)= ?gnLuna ] + ;
			[and extract(year from a.dataoravalid)=?gnAn)))) ]+;
			[and (extract(month from b.dataora)+extract(year from b.dataora)*12<=?gnLuna+?gnAn*12)]
		
		Thisform.grdmanopera.nrecno=0
		Thisform.actualizeaza_grid1(lcFiltru)
		
		If Reccount('crsmanopera')=0
			Thisform.tx_nrord.Value=""
			Thisform.tx_timpn.Value=0.000
			lcFiltru=[1=2]
			Thisform.actualizeaza_grid2(lcFiltru)
			amessagebox('Cautarea nu a intors rezultate!',0+48,'Info cautare')
			Thisform.ck_nrord.SetFocus()
		Endif
	ENDPROC

	PROCEDURE do_executa
		If Reccount('crsmanopera')>0 AND thisform.cmd_normare.enabled
			lcMesaj=format_msg('Doriti sa distribuiti in mod egal timpul normat'+CHR(13)+CHR(10)+;
				'pentru comenzile din selectie care nu il au distribuit in totalitate?')
			If amessagebox(lcMesaj,4+32+256,'Distribuire timp normat')==6
				Local lcFiltru,lcSql,lnSucces
		*!*	*!*			lcFiltru=Strtran(pomanopera.ca_baza1.cfiltru,Chr(39),Chr(63))
		*!*			lcFiltru = STRTRAN(gcCondLuna,CHR(39),CHR(63))
		*!*			lcSql=[begin pack_devize.dev_distribuie_timp_n('] + Alltrim(gcS) + [',']+Alltrim(lcFiltru)+['); end;]
		*!*			lnSucces=goExecutor.oExecute(lcSql)
		*!*			If lnSucces < 0
		*!*				amessagebox(goExecutor.cEroare,0+16,'Eroare')
		*!*				Return
		*!*			Endif
				distribuire_timp_normat()
				Thisform.grdmanopera.nrecno=0
				Thisform.actualizeaza_grid1()
				Thisform.grdmanopera.SetFocus()
			Endif
		Endif
	ENDPROC

	PROCEDURE do_modifica
		Lparameters tnTip	&& daca nu exista,atunci procedura a fost apelata din KeyPress
		Local lnTimpN,lnOraI
		If glLunaInchisa OR Empty(tnTip)
			Return
		Endif
		Thisform.lsalvat=.T.
		lnOraI=Thisform.norainitiala
		lnTimpN=Thisform.ntimpnedistribuit+lnOraI
		Select crsmecanici
		pnid_opermecanic=id_opermecanic
		Do Case
		Case Thisform.noramodificata<=0
			amessagebox("Numarul de ore introdus trebuie sa fie mai mare decat 0!",0+48,"Atentie")
			Update crsmecanici Set ore=lnOraI Where id_opermecanic=pnid_opermecanic
			Thisform.grdmecanici.cOre.text1.Refresh()
			Thisform.lvalidat=.F.
			Return
		Case Thisform.noramodificata>lnTimpN
			amessagebox("Numarul maxim de ore pe care il puteti introduce este "+Alltrim(Str(lnTimpN,9,3))+"!",0+48,"Atentie")
			Update crsmecanici Set ore=lnOraI Where id_opermecanic=pnid_opermecanic
			Thisform.grdmecanici.cOre.text1.Refresh()
			Thisform.lvalidat=.F.
			Return
		Endcase
		lcSql=[UPDATE ] + gcS + [.DEV_OPER_MECANICI SET ORE=]+Alltrim(Str(Thisform.noramodificata,9,3))+[ WHERE ID_OPERMECANIC=]+Alltrim(Str(pnid_opermecanic))
		lnSucces=goExecutor.oExecute(lcSql)
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
			Update crsmecanici Set ore=lnOraI Where id_opermecanic=pnid_opermecanic
			Thisform.grdmecanici.cOre.text1.Refresh()
			Thisform.lvalidat=.F.
			Return
		Endif
		Thisform.ntimpnedistribuit=lnTimpN-Thisform.noramodificata
		Thisform.tx_totalore.Value=Thisform.tx_timpn.Value-Thisform.ntimpnedistribuit
		Thisform.lvalidat=.T.
		
	ENDPROC

	PROCEDURE do_reset
		With Thisform
			For i=1 To .Objects.Count
				If Upper(.Objects(i).BaseClass)='CHECKBOX'
					.Objects(i).Value=0
				Endif
			Endfor
		Endwith
		Thisform.cbtip_deviz.do_reset()
		Thisform.ck_nrord.SetFocus()
		
	ENDPROC

	PROCEDURE do_sterge
		If Used('crsmecanici') And Reccount('crsmecanici')>0 AND !glLunaInchisa
			Private pnid_opermecanic,pcnume
			Select crsmecanici
			pnid_opermecanic=id_opermecanic
			pcnume=nume
			If AMessagebox('Doriti sa stergeti mecanicul '+Alltrim(pcnume)+' ?',4+32+256,'Stergere')==6
				lcSql=[UPDATE ] + gcS + [.DEV_OPER_MECANICI SET STERS=1 WHERE ID_OPERMECANIC=]+Alltrim(Str(pnid_opermecanic))
				lnSucces=goExecutor.oExecute(lcSql)
				If lnSucces < 0
					amessagebox(goExecutor.cEroare,0+16,'Eroare')
					Return
				Endif
				Thisform.actualizeaza_grid2()
				Thisform.grdmanopera.SetFocus()
			Endif
		Endif
		
	ENDPROC

	PROCEDURE inainte_de_do_renunt
		Local llReturn
		Thisform.lvalidat=.T.
		If Thisform.lsalvat=.F.
			If amessagebox("Doriti sa salvati ultima modificare facuta?",4+32+256,"Modificare ore")==6
				Thisform.do_modifica(3)
			Endif
		Endif
		Return Thisform.lvalidat
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local llReturn
		Thisform.lvalidat=.T.
		If Thisform.lsalvat=.F.
			If amessagebox("Doriti sa salvati ultima modificare facuta?",4+32+256,"Modificare ore")==6
				Thisform.do_modifica(2)
			Endif
		Endif
		Return Thisform.lvalidat
		
	ENDPROC

	PROCEDURE Init
		DODEFAULT()
		If glLunaInchisa
			Thisform.RemoveObject([but_nou1])
			Thisform.RemoveObject([but_sterge1])
			Thisform.cmd_normare.Enabled=.F.
			Thisform.grdmecanici.ReadOnly=.T.
		Endif
	ENDPROC

	PROCEDURE grdmanopera.AfterRowColChange
		Lparameters nColIndex
		If This.RowColChange != 2 And This.nrecno!=Recno()
			DoDefault()
			Local lnid_oper
			Select crsmanopera
			lnid_oper=id_oper
			Thisform.tx_nrord.Value=Alltrim(nrord)
			Thisform.tx_timpn.Value=timpn
			lcFiltru=[id_oper=]+Alltrim(Str(lnid_oper))
			Thisform.actualizeaza_grid2(lcFiltru)
		Endif
		
	ENDPROC

	PROCEDURE grdmecanici.cMecanic._cbbase1.GotFocus
		This.Tag=Alltrim(Str(v_mecanici.id_mecanic))
		
	ENDPROC

	PROCEDURE grdmecanici.cMecanic._cbbase1.Valid
		pnid_mecanic=v_mecanici.id_mecanic
		If Int(Val(This.Tag))!=pnid_mecanic
			pnid_opermecanic=crsmecanici.id_opermecanic
			lcSql=[UPDATE ] + gcS + [.DEV_OPER_MECANICI SET ID_MECANIC=]+Alltrim(Str(pnid_mecanic))+[ WHERE ID_OPERMECANIC=]+Alltrim(Str(pnid_opermecanic))
			lnSucces=goExecutor.oExecute(lcSql)
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,0+16,'Eroare')
				Return
			Endif
		Endif
		
	ENDPROC

	PROCEDURE grdmecanici.cOre.Text1.GotFocus
		Thisform.norainitiala=This.Value
		Thisform.noramodificata=This.Value
		Thisform.lvalidat=.T.
	ENDPROC

	PROCEDURE grdmecanici.cOre.Text1.InteractiveChange
		Thisform.noramodificata=This.Value
		Thisform.lsalvat=.F.
	ENDPROC

	PROCEDURE grdmecanici.cOre.Text1.Valid
		If Thisform.norainitiala!=Thisform.noramodificata And Thisform.lsalvat=.F.
			Thisform.do_modifica(1)
		Endif
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_norme_sectii AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Cb_operatie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cb_sectie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />

	*<PropValue>
		DoCreate = .T.
		Height = 134
		Name = "frm_norme_sectii"
		Width = 375
		_SHAPE1.Name = "_SHAPE1"
		_SHAPE2.Height = 29
		_SHAPE2.Left = 312
		_SHAPE2.Name = "_SHAPE2"
		_SHAPE2.Top = 0
		_SHAPE2.Width = 64
		LB_TITLU_ALB_B121.Caption = "ALEGEȚI OPERAȚIA"
		LB_TITLU_ALB_B121.FontBold = .T.
		LB_TITLU_ALB_B121.Name = "LB_TITLU_ALB_B121"
		BUT_TERMIN1.Left = 345
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Left = 315, ;
		Name = "But_renunt1", ;
		Top = 1
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cb_operatie' AS cb_tx_simplu WITH ;
		Left = 41, ;
		Name = "Cb_operatie", ;
		Top = 49, ;
		_CBBASE1.Name = "_CBBASE1", ;
		_CBBASE1.RowSource = "v_denop.denop,id_norme", ;
		_CBBASE1.RowSourceType = 6, ;
		_LBBASE1.Caption = "Operație", ;
		_LBBASE1.Name = "_LBBASE1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cb_sectie' AS cb_tx_simplu WITH ;
		Left = 41, ;
		Name = "Cb_sectie", ;
		Top = 77, ;
		_CBBASE1.Name = "_CBBASE1", ;
		_CBBASE1.RowSource = "v_nom_sectii.sectie,id_sectie", ;
		_CBBASE1.RowSourceType = 6, ;
		_LBBASE1.Caption = "Secție", ;
		_LBBASE1.Name = "_LBBASE1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />
	
	PROCEDURE inainte_de_do_termin
		pnid_sectie=v_nom_sectii.id_sectie
		pnid_norma=v_denop.id_norme
		pcsectie=v_nom_sectii.sectie
		If Empty(thisform.cb_operatie._CBBASE1.value)
			amessagebox("Nu ati ales operatia!",0+48,"Atentie")
			Thisform.cb_operatie.SetFocus()
			Return .F.
		Endif
		If Empty(thisform.cb_sectie._CBBASE1.value)
			amessagebox("Nu ati ales sectia!",0+48,"Atentie")
			Thisform.cb_sectie.SetFocus()
			Return .F.
		Endif
		Return .T.
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_raport_salarizare AS _frmbase OF "..\..\roacomenzi\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="grdsalarii" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cNume.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cNume.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cOreLucrate.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cOreLucrate.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cOreRegie.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cOreRegie.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cManopera.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cManopera.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cManoperaRegie.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cManoperaRegie.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cBrutManopera.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cBrutManopera.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cBrutRegie.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cBrutRegie.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cTotalBrut.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cTotalBrut.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cTarifar.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cTarifar.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cTarifarOrar.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cTarifarOrar.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cTotalManopera.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdsalarii.cTotalManopera.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_tx_simplu5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_coef_man" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_coef_man_reg" UniqueID="" Timestamp="" />

	*<PropValue>
		cgridsortlist = grdsalarii
		DoCreate = .T.
		Height = 535
		lactiv2 = .T.
		Name = "frm_raport_salarizare"
		Width = 793
		WindowState = 2
		_shape1.Anchor = 10
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Tag = "RESIZABLE,NOVERTICAL_RESIZE"
		_shape1.Top = 0
		_shape1.Width = 792
		_shape1.ZOrderSet = 0
		_shape2.Anchor = 8
		_shape2.Height = 29
		_shape2.Left = 731
		_shape2.Name = "_shape2"
		_shape2.Tag = "MOVABLE,NOVERTICAL_MOVE"
		_shape2.Top = 0
		_shape2.Width = 67
		_shape2.ZOrderSet = 4
		Lb_titlu_alb_b121.Caption = "RAPORT DE SALARIZARE"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 11
		Lb_titlu_alb_b121.ZOrderSet = 1
		BUT_TERMIN1.Anchor = 8
		BUT_TERMIN1.Left = 763
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 10
		BUT_TERMIN1.Tag = "MOVABLE,NOVERTICAL_MOVE"
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 7
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'But_listare1' AS but_listare WITH ;
		Anchor = 8, ;
		Left = 733, ;
		Name = "But_listare1", ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 1, ;
		Visible = .T.
		*< END OBJECT: ClassLib="..\..\roacomenzi\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Clb_coef_man' AS clb_tx_simplu WITH ;
		Anchor = 4, ;
		Height = 48, ;
		Left = 13, ;
		Name = "Clb_coef_man", ;
		TabIndex = 1, ;
		TabStop = .F., ;
		Top = 432, ;
		Width = 132, ;
		Text_simplu1.ControlSource = "gnCoefMan", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = "99.999", ;
		Text_simplu1.Left = 72, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 22, ;
		Text_simplu1.Width = 56, ;
		Lb_simplu1.Caption = "Coeficient manoperă", ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 5
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_coef_man_reg' AS clb_tx_simplu WITH ;
		Anchor = 4, ;
		Height = 48, ;
		Left = 13, ;
		Name = "Clb_coef_man_reg", ;
		TabIndex = 1, ;
		TabStop = .F., ;
		Top = 479, ;
		Width = 132, ;
		Text_simplu1.ControlSource = "gnCoefManReg", ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = "99.999", ;
		Text_simplu1.Left = 72, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 22, ;
		Text_simplu1.Width = 56, ;
		Lb_simplu1.Caption = "Coeficient regie", ;
		Lb_simplu1.Height = 17, ;
		Lb_simplu1.Left = 8, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 5, ;
		Lb_simplu1.Width = 86, ;
		Lb_simplu1.WordWrap = .T.
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu1' AS clb_tx_simplu WITH ;
		Anchor = 12, ;
		Left = 144, ;
		Name = "Clb_tx_simplu1", ;
		Tag = "MOVABLE", ;
		Top = 432, ;
		ZOrderSet = 3, ;
		Text_simplu1.InputMask = "99 999.999", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Lb_simplu1.Caption = "Total ore post gr.", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\..\roacomenzi\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu2' AS clb_tx_simplu WITH ;
		Anchor = 12, ;
		Height = 29, ;
		Left = 433, ;
		Name = "Clb_tx_simplu2", ;
		Tag = "MOVABLE", ;
		Top = 432, ;
		Width = 347, ;
		ZOrderSet = 5, ;
		Text_simplu1.InputMask = (get_mask(14,gnPc)), ;
		Text_simplu1.Left = 158, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 3, ;
		Lb_simplu1.Caption = "Total manoperă post gr.", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\..\roacomenzi\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu3' AS clb_tx_simplu WITH ;
		Anchor = 12, ;
		Left = 144, ;
		Name = "Clb_tx_simplu3", ;
		Tag = "MOVABLE", ;
		Top = 488, ;
		ZOrderSet = 3, ;
		Text_simplu1.InputMask = "99 999.999", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Lb_simplu1.Caption = "Total ore", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\..\roacomenzi\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu4' AS clb_tx_simplu WITH ;
		Anchor = 12, ;
		Height = 29, ;
		Left = 433, ;
		Name = "Clb_tx_simplu4", ;
		Tag = "MOVABLE", ;
		Top = 460, ;
		Width = 347, ;
		ZOrderSet = 8, ;
		Text_simplu1.InputMask = (get_mask(14,gnPc)), ;
		Text_simplu1.Left = 158, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 3, ;
		Lb_simplu1.Caption = "Total manoperă regie", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\..\roacomenzi\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu5' AS clb_tx_simplu WITH ;
		Anchor = 12, ;
		Height = 29, ;
		Left = 433, ;
		Name = "Clb_tx_simplu5", ;
		Tag = "MOVABLE", ;
		Top = 488, ;
		Width = 347, ;
		ZOrderSet = 9, ;
		Text_simplu1.InputMask = (get_mask(14,gnPc)), ;
		Text_simplu1.Left = 158, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 3, ;
		Lb_simplu1.Caption = "Total manoperă", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\..\roacomenzi\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_tx_simplu6' AS clb_tx_simplu WITH ;
		Anchor = 12, ;
		Left = 144, ;
		Name = "Clb_tx_simplu6", ;
		Tag = "MOVABLE", ;
		Top = 460, ;
		ZOrderSet = 3, ;
		Text_simplu1.InputMask = "99 999.999", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Lb_simplu1.Caption = "Total ore regie", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\..\roacomenzi\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'grdsalarii' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 11, ;
		DeleteMark = .F., ;
		Height = 384, ;
		Left = 15, ;
		Name = "grdsalarii", ;
		Panel = 1, ;
		RecordSource = "crssalarii", ;
		Tag = "RESIZABLE", ;
		Top = 42, ;
		Width = 763, ;
		ZOrderSet = 2, ;
		Column1.ControlSource = "nume", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cNume", ;
		Column1.Width = 175, ;
		Column2.ColumnOrder = 2, ;
		Column2.ControlSource = "ore", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.InputMask = "9 999.999", ;
		Column2.Name = "cOreLucrate", ;
		Column3.ColumnOrder = 3, ;
		Column3.ControlSource = "ore_reg", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.InputMask = "9 999.999", ;
		Column3.Name = "cOreRegie", ;
		Column4.ControlSource = "manopera", ;
		Column4.FontName = "Arial Narrow", ;
		Column4.InputMask = (get_mask(14,gnPc)), ;
		Column4.Name = "cManopera", ;
		Column4.Width = 90, ;
		Column5.ControlSource = "manopera_reg", ;
		Column5.FontName = "Arial Narrow", ;
		Column5.InputMask = (get_mask(14,gnPc)), ;
		Column5.Name = "cManoperaRegie", ;
		Column5.Width = 96, ;
		Column6.ColumnOrder = 7, ;
		Column6.ControlSource = "ROUND(manopera*gnCoefMan,gnPc)", ;
		Column6.FontName = "Arial Narrow", ;
		Column6.InputMask = (get_mask(14,gnPc)), ;
		Column6.Name = "cBrutManopera", ;
		Column6.Width = 91, ;
		Column7.ColumnOrder = 8, ;
		Column7.ControlSource = "ROUND(manopera_reg*gnCoefManReg,gnPc)", ;
		Column7.FontName = "Arial Narrow", ;
		Column7.InputMask = (get_mask(14,gnPc)), ;
		Column7.Name = "cBrutRegie", ;
		Column7.Width = 90, ;
		Column8.ColumnOrder = 10, ;
		Column8.ControlSource = "ROUND(manopera*gnCoefMan,gnPC)+ROUND(manopera_reg*gnCoefManReg,gnPc)", ;
		Column8.FontName = "Arial Narrow", ;
		Column8.InputMask = (get_mask(14,gnPc)), ;
		Column8.Name = "cTotalBrut", ;
		Column8.Width = 98, ;
		Column9.ControlSource = "tarifar", ;
		Column9.FontName = "Arial Narrow", ;
		Column9.InputMask = (get_mask(14,gnPa)), ;
		Column9.Name = "cTarifar", ;
		Column9.Visible = .F., ;
		Column9.Width = 92, ;
		Column10.ColumnOrder = 11, ;
		Column10.ControlSource = "tarifarorar", ;
		Column10.FontName = "Arial Narrow", ;
		Column10.InputMask = (get_mask(14,gnPa)), ;
		Column10.Name = "cTarifarOrar", ;
		Column10.Visible = .F., ;
		Column10.Width = 93, ;
		Column11.ColumnOrder = 6, ;
		Column11.ControlSource = "manopera+manopera_reg", ;
		Column11.FontName = "Arial Narrow", ;
		Column11.InputMask = (get_mask(14,gnPc)), ;
		Column11.Name = "cTotalManopera", ;
		Column11.Width = 92
		*< END OBJECT: ClassLib="..\..\roacomenzi\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdsalarii.cBrutManopera.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Brut manopera", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdsalarii.cBrutManopera.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		Visible = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdsalarii.cBrutRegie.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Brut regie", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdsalarii.cBrutRegie.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		Visible = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdsalarii.cManopera.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Manopera post gr.", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdsalarii.cManopera.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdsalarii.cManoperaRegie.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Manopera regie", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdsalarii.cManoperaRegie.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdsalarii.cNume.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nume", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdsalarii.cNume.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdsalarii.cOreLucrate.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Ore lucrate", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdsalarii.cOreLucrate.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdsalarii.cOreRegie.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Ore regie", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdsalarii.cOreRegie.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdsalarii.cTarifar.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Tarifar", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdsalarii.cTarifar.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		Visible = .F.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdsalarii.cTarifarOrar.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Tarifar orar", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdsalarii.cTarifarOrar.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		Visible = .F.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdsalarii.cTotalBrut.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Total brut", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdsalarii.cTotalBrut.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		Visible = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdsalarii.cTotalManopera.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Total manopera", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdsalarii.cTotalManopera.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />
	
	PROCEDURE do_listare
		Private pcDataOra, pcTitlu
		*!*	gofundal.AlwaysOnTop=.F.
		If Reccount('crssalarii')>0
			Thisform.AlwaysOnTop=.F.
			pcTitlu = [RAPORT DE SALARIZARE - ]
		*!*	modificare	v 2.1.9
		*!*		pcDataOra=Ttoc(get_ora())
		*!*		Select crssalarii
		*!*		Report Form salarii To Printer Prompt Preview
			goExport.export2frx([crssalarii],[salarii],.F., , , , , .T.)
		*!*	modificare	v 2.1.9	^
		*!*	gofundal.AlwaysOnTop=.T.
			Thisform.AlwaysOnTop=.T.
		Else
			amessagebox("Nu exista inregistrari pentru listare!",0+48,"Atentie")
		Endif
		Release pcDataOra,pcTitlu
	ENDPROC

	PROCEDURE Init
		DoDefault()
		Thisform.lb_titlu_alb_b121.Caption = Thisform.lb_titlu_alb_b121.Caption + Iif(!Empty(pcPerioada),[ - ] + pcPerioada,[])
		Select crssalarii
		Calculate Sum(ore+ore_reg) To lnSuma1
		Calculate Sum(ore) To lnSuma2
		Calculate Sum(ore_reg) To lnSuma6
		*!*	CALCULATE sum(manopera*gnCoefMan+manopera_reg*gnCoefManReg) TO lnSuma2
		Calculate Sum(manopera) To lnSuma3
		Calculate Sum(manopera_reg) To lnSuma4
		Go Top
		lnSuma5=lnSuma3+lnSuma4
		Thisform.clb_tx_simplu1.text_simplu1.Value=lnSuma2
		Thisform.clb_tx_simplu2.text_simplu1.Value=lnSuma3
		*!*	thisform.clb_tx_simplu3.text_SIMPLU1.Value=lnSuma3
		Thisform.clb_tx_simplu4.text_simplu1.Value=lnSuma4
		Thisform.clb_tx_simplu5.text_simplu1.Value=lnSuma5
		Thisform.clb_tx_simplu6.text_simplu1.Value=lnSuma6
		Thisform.clb_tx_simplu3.text_simplu1.Value=lnSuma1
		Thisform.Refresh()
	ENDPROC

	PROCEDURE grdsalarii.AfterRowColChange
		LPARAMETERS nColIndex
		If This.RowColChange!=2
			DoDefault()
		Endif
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_rezultate_verificari AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_shape3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_titlu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_titlu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_avans" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrord.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrord.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatai.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatai.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_comanda" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_client" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_incasat" UniqueID="" Timestamp="" />

	*<PropValue>
		DoCreate = .T.
		Height = 350
		Name = "frm_rezultate_verificari"
		Width = 432
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 432
		_shape2.Height = 29
		_shape2.Left = 370
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 69
		Lb_titlu_alb_b121.Caption = "VERIFICĂRI"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		BUT_TERMIN1.Left = 402
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT '_shape3' AS _shape WITH ;
		Height = 0, ;
		Left = 12, ;
		Name = "_shape3", ;
		Top = 204, ;
		Width = 408
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="shape" />

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Left = 372, ;
		Name = "But_renunt1", ;
		Top = 1
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grdcomenzi' AS _grdrow WITH ;
		AllowHeaderSizing = .F., ;
		ColumnCount = 2, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		GridLines = 0, ;
		Height = 102, ;
		Left = 48, ;
		Name = "grdcomenzi", ;
		Panel = 1, ;
		RecordMark = .F., ;
		RecordSource = "crsverificari", ;
		ScrollBars = 2, ;
		Top = 83, ;
		Width = 336, ;
		Column1.ControlSource = "nrord", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cNrord", ;
		Column1.Width = 142, ;
		Column2.Alignment = 2, ;
		Column2.ControlSource = "datai", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cDatai", ;
		Column2.Width = 173
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdcomenzi.cDatai.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Din data de", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cDatai.Text1' AS textbox WITH ;
		Alignment = 2, ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNrord.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNrord.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Lb_avans' AS lb_simplu WITH ;
		Alignment = 2, ;
		Caption = "Suma avans", ;
		FontBold = .T., ;
		FontSize = 12, ;
		Height = 22, ;
		Left = 144, ;
		Name = "Lb_avans", ;
		Top = 261, ;
		Width = 96
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_client' AS lb_simplu WITH ;
		Caption = "Client", ;
		FontBold = .T., ;
		FontSize = 12, ;
		Height = 22, ;
		Left = 12, ;
		Name = "Lb_client", ;
		Top = 38, ;
		Width = 46
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_comanda' AS lb_simplu WITH ;
		Caption = "Comandă", ;
		FontBold = .T., ;
		FontSize = 12, ;
		Height = 22, ;
		Left = 10, ;
		Name = "Lb_comanda", ;
		Top = 213, ;
		Width = 76
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_incasat' AS lb_simplu WITH ;
		Alignment = 2, ;
		Caption = "Suma avans", ;
		FontBold = .T., ;
		FontSize = 12, ;
		Height = 22, ;
		Left = 144, ;
		Name = "lb_incasat", ;
		Top = 310, ;
		Width = 96
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu1' AS lb_simplu WITH ;
		Caption = "Din care s-a încasat suma de ", ;
		Left = 12, ;
		Name = "Lb_simplu1", ;
		Top = 286
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_titlu1' AS lb_simplu WITH ;
		Caption = "Comenzi deschise și nefacturate pentru mașina", ;
		Left = 12, ;
		Name = "lb_titlu1", ;
		Top = 60
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_titlu2' AS lb_simplu WITH ;
		Caption = "Pe aceasta comandă s-a facturat avans suma de", ;
		Left = 12, ;
		Name = "Lb_titlu2", ;
		Top = 237
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />
	
	PROCEDURE Init
		Lparameters tnAvans,tnIncasat
		Local lnCropH,lnDif,lnDif1
		DoDefault()
		lnCropH=0
		If Reccount('crsverificari')=0
			Thisform.lb_titlu1.Caption="Nu există comenzi deschise și nefacturate pentru mașina "
			Thisform.grdcomenzi.Visible=.F.
			lnDif=Thisform._shape3.Top-Thisform.grdcomenzi.Top
			lnCropH=lnCropH+lnDif
			Thisform._shape3.Top=Thisform.grdcomenzi.Top
			Thisform.lb_comanda.Top=Thisform.lb_comanda.Top-lnDif
			Thisform.lb_titlu2.Top=Thisform.lb_titlu2.Top-lnDif
			Thisform.lb_avans.Top=Thisform.lb_avans.Top-lnDif
			*!*	modificare v 2.0.21
			Thisform.lb_simplu1.Top = Thisform.lb_simplu1.Top-lnDif
			Thisform.lb_incasat.Top = Thisform.lb_incasat.Top-lnDif		
			*!*	modificare v 2.0.21	^
			*!*		lnDif=Thisform.lb_comanda.Top-Thisform._shape3.Top
			*!*		Thisform._shape3.Top=Thisform.grdcomenzi.Top
			*!*		lnDif1=Thisform.lb_titlu2.Top-Thisform.lb_comanda.Top
			*!*		Thisform.lb_comanda.Top=Thisform._shape3.Top+lnDif
			*amessageboxThisform.lb_avans.Top-Thisform.lb_titlu2.Top
			*!*		Thisform.lb_titlu2.Top=Thisform.lb_comanda.Top+lnDif1
			*!*		Thisform.lb_avans.Top=Thisform.lb_titlu2.Top+lnDif
		Endif
		If tnAvans>0.000
			*!*	modificare v 2.0.21
			*!*		Thisform.lb_avans.Caption=Alltrim(transform(tnavans,get_mask(12,gnPA)))+" lei"
			Thisform.lb_avans.Caption = formateaza(tnAvans,12,gnPc)+" lei"
			Thisform.lb_incasat.Caption = formateaza(tnIncasat,12,gnPc) + " lei"
			Thisform.lb_avans.Visible=.T.
			Thisform.lb_simplu1.Visible = .T.
			Thisform.lb_incasat.Visible = .T.
			*!*	modificare v 2.0.21	^
			*!*		Thisform.lb_avans.Caption=Alltrim(Str(tnavans,18,2))+" lei"
		Else
			Thisform.lb_titlu2.Caption="Pe această comandă nu s-a facturat avans."
			*!*	modificare v 2.0.21
			Thisform.lb_avans.Visible=.F.
			Thisform.lb_simplu1.Visible = .F.
			Thisform.lb_incasat.Visible = .F.
			*!*	modificare v 2.0.21	^
			lnCropH=lnCropH+40
		Endif
		Thisform.Height=Thisform.Height-lnCropH
		Thisform.AutoCenter=.T.
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_rezultate_verificari_part AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_shape4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_shape3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_titlu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_titlu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrord.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrord.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatai.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatai.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_client" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdavansuri" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdavansuri.cNrord.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdavansuri.cNrord.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdavansuri.cAvans.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdavansuri.cAvans.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdavansuri.cIncasat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdavansuri.cIncasat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="tx_total_avans" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="tx_total_incasat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_total" UniqueID="" Timestamp="" />

	*<PropValue>
		DoCreate = .T.
		Height = 370
		Name = "frm_rezultate_verificari_part"
		Width = 430
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 432
		_shape1.ZOrderSet = 1
		_shape2.Height = 29
		_shape2.Left = 368
		_shape2.Name = "_shape2"
		_shape2.Top = -1
		_shape2.Width = 69
		_shape2.ZOrderSet = 2
		Lb_titlu_alb_b121.Caption = "VERIFICĂRI"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.ZOrderSet = 3
		BUT_TERMIN1.Left = 400
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 4
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT '_shape3' AS _shape WITH ;
		Height = 0, ;
		Left = 12, ;
		Name = "_shape3", ;
		Top = 195, ;
		Width = 408, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="shape" />

	ADD OBJECT '_shape4' AS _shape WITH ;
		BackStyle = 0, ;
		Height = 32, ;
		Left = 120, ;
		Name = "_shape4", ;
		Top = 328, ;
		Width = 252, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="shape" />

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Left = 370, ;
		Name = "But_renunt1", ;
		Top = 1, ;
		ZOrderSet = 11
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grdavansuri' AS _grdrow WITH ;
		AllowHeaderSizing = .F., ;
		ColumnCount = 3, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		GridLines = 0, ;
		Height = 102, ;
		Left = 48, ;
		Name = "grdavansuri", ;
		Panel = 1, ;
		RecordMark = .F., ;
		RecordSource = "crsavansuri", ;
		ScrollBars = 2, ;
		Top = 222, ;
		Width = 336, ;
		ZOrderSet = 12, ;
		Column1.ControlSource = "nrord", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cNrord", ;
		Column1.Width = 142, ;
		Column2.Alignment = 2, ;
		Column2.ControlSource = "avans", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.InputMask = (get_mask(14,gnPc)), ;
		Column2.Name = "cAvans", ;
		Column2.Width = 92, ;
		Column3.Alignment = 2, ;
		Column3.ControlSource = "incasat", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.InputMask = (get_mask(14,gnPc)), ;
		Column3.Name = "cIncasat", ;
		Column3.Width = 79
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdavansuri.cAvans.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Suma avans", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdavansuri.cAvans.Text1' AS textbox WITH ;
		Alignment = 2, ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdavansuri.cIncasat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Incasat", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdavansuri.cIncasat.Text1' AS textbox WITH ;
		Alignment = 2, ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdavansuri.cNrord.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdavansuri.cNrord.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi' AS _grdrow WITH ;
		AllowHeaderSizing = .F., ;
		ColumnCount = 2, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		GridLines = 0, ;
		Height = 102, ;
		Left = 48, ;
		Name = "grdcomenzi", ;
		Panel = 1, ;
		RecordMark = .F., ;
		RecordSource = "crsverificari", ;
		ScrollBars = 2, ;
		Top = 83, ;
		Width = 336, ;
		ZOrderSet = 9, ;
		Column1.ControlSource = "nrord", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cNrord", ;
		Column1.Width = 142, ;
		Column2.Alignment = 2, ;
		Column2.ControlSource = "datai", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cDatai", ;
		Column2.Width = 173
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdcomenzi.cDatai.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Din data de", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cDatai.Text1' AS textbox WITH ;
		Alignment = 2, ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNrord.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNrord.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Lb_client' AS lb_simplu WITH ;
		Caption = "Client", ;
		FontBold = .T., ;
		FontSize = 12, ;
		Height = 22, ;
		Left = 12, ;
		Name = "Lb_client", ;
		Top = 38, ;
		Width = 46, ;
		ZOrderSet = 10
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_titlu1' AS lb_simplu WITH ;
		Caption = "Comenzi deschise și nefacturate pentru acest client", ;
		Left = 12, ;
		Name = "lb_titlu1", ;
		Top = 60, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_titlu2' AS lb_simplu WITH ;
		Caption = "Pentru comenzile selectate s-au facturat în avans sumele:", ;
		Left = 12, ;
		Name = "Lb_titlu2", ;
		Top = 201, ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'lb_total' AS _lbbase WITH ;
		Caption = "Total", ;
		Left = 127, ;
		Name = "lb_total", ;
		Top = 335, ;
		ZOrderSet = 15
		*< END OBJECT: ClassLib="..\comun\clase\_lb_base.vcx" BaseClass="label" />

	ADD OBJECT 'tx_total_avans' AS _txbase WITH ;
		Height = 23, ;
		InputMask = (get_mask(10,gnPc)), ;
		Left = 200, ;
		Name = "tx_total_avans", ;
		ReadOnly = .T., ;
		Top = 332, ;
		Width = 79, ;
		ZOrderSet = 13
		*< END OBJECT: ClassLib="..\comun\clase\_tx_base.vcx" BaseClass="textbox" />

	ADD OBJECT 'tx_total_incasat' AS _txbase WITH ;
		Height = 23, ;
		InputMask = (get_mask(10,gnPc)), ;
		Left = 287, ;
		Name = "tx_total_incasat", ;
		ReadOnly = .T., ;
		Top = 332, ;
		Width = 79, ;
		ZOrderSet = 14
		*< END OBJECT: ClassLib="..\comun\clase\_tx_base.vcx" BaseClass="textbox" />
	
	PROCEDURE Init
		Local lnAvans
		Local lnCropH,lnDif,lnDif1
		DoDefault()
		lnCropH = 0
		If Reccount('crsverificari')=0
			Thisform.lb_titlu1.Caption = "Nu există comenzi deschise și nefacturate pentru acest client!"
			Thisform.grdcomenzi.Visible = .F.
			lnDif = Thisform._shape3.Top - Thisform.grdcomenzi.Top
			lnCropH = lnCropH + lnDif
			Thisform._shape3.Top = Thisform.grdcomenzi.Top
			Thisform.lb_titlu2.Top = Thisform.lb_titlu2.Top - lnDif
			Thisform.grdavansuri.Top = Thisform.grdavansuri.Top - lnDif
			Thisform._shape4.Top = Thisform._shape4.Top - lnDif
			Thisform.lb_total.Top = Thisform.lb_total.Top - lnDif
			Thisform.tx_total_incasat.Top = Thisform.tx_total_incasat.Top - lnDif
			Thisform.tx_total_avans.Top = Thisform.tx_total_avans.Top - lnDif
		Endif
		
		If Reccount('crsavansuri') > 0
			Select crsavansuri
			Calculate Sum(Nvl(avans,0)),SUM(NVL(incasat,0)) To lnAvans,lnIncasat
			Go Top
			Thisform.tx_total_avans.Value = lnAvans
			Thisform.tx_total_incasat.Value = lnIncasat
		Else
			Thisform.lb_titlu2.Caption = "Nu au fost facturate avansuri pe comenzile selectate!"
			Thisform.grdavansuri.Visible=.F.
			lnCropH = lnCropH + Thisform.grdavansuri.Height
		Endif
		Thisform.Height = Thisform.Height - lnCropH
		Thisform.AutoCenter = .T.
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_val_comenzi AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="grdcomenzi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrord.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrord.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatai.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatai.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNume.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNume.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cAsigurator.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cAsigurator.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cInspector.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cInspector.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValidat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValidat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cManopera.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cManopera.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cMateriale.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cMateriale.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cUtil_valid.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cUtil_valid.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDataoravalid.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDataoravalid.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cTip_comanda.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cTip_comanda.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNr_dosar.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNr_dosar.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cArhivat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cArhivat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cSeries.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cSeries.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cKmint.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cKmint.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cOreFunctionare.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cOreFunctionare.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_cauta1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_reset1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nume" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_datai" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrinmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_vizualizare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cmd_arhivare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_validare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_anulare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrord" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lbValidat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lbArhivat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cbtip_deviz" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_excel1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cbValidat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cbArhivat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridextra1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_series" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_anuleaza
		*m: do_inchide_fortat
		*p: ntiplistare		&& 1 - toate comenzile; 2 -  comenzile validate;3 - comenzile nevalidate;
	*</DefinedPropArrayMethod>

	*<PropValue>
		cgridsortlist = grdcomenzi
		DoCreate = .T.
		Height = 445
		lactiv1 = .T.
		lactiv2 = .T.
		Name = "frm_val_comenzi"
		ntiplistare = 1
		Width = 793
		WindowState = 2
		_shape1.Anchor = 10
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 795
		_shape1.ZOrderSet = 0
		_shape2.Anchor = 8
		_shape2.Height = 29
		_shape2.Left = 703
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 104
		_shape2.ZOrderSet = 12
		Lb_titlu_alb_b121.Caption = "VALIDARE COMENZI"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 14
		Lb_titlu_alb_b121.ZOrderSet = 1
		BUT_TERMIN1.Anchor = 8
		BUT_TERMIN1.Left = 763
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 13
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 13
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'But_excel1' AS but_excel WITH ;
		Anchor = 9, ;
		Left = 704, ;
		Name = "But_excel1", ;
		TabIndex = 16, ;
		Top = 1, ;
		Visible = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_listare1' AS but_listare WITH ;
		Anchor = 9, ;
		Left = 734, ;
		Name = "But_listare1", ;
		TabIndex = 17, ;
		Top = 1, ;
		Visible = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'cbArhivat' AS ctip_deviz WITH ;
		Anchor = 8, ;
		Height = 27, ;
		Left = 674, ;
		Name = "cbArhivat", ;
		TabIndex = 6, ;
		Top = 221, ;
		Width = 115, ;
		_combobox1.Name = "_combobox1", ;
		_combobox1.Width = 111
		*< END OBJECT: ClassLib="oviz_devize.vcx" BaseClass="container" />

	ADD OBJECT 'cbtip_deviz' AS ctip_deviz WITH ;
		Anchor = 8, ;
		Height = 27, ;
		Left = 675, ;
		Name = "cbtip_deviz", ;
		TabIndex = 6, ;
		Top = 129, ;
		Width = 115, ;
		_combobox1.Height = 24, ;
		_combobox1.Left = 1, ;
		_combobox1.Name = "_combobox1", ;
		_combobox1.Top = 2, ;
		_combobox1.Width = 111
		*< END OBJECT: ClassLib="oviz_devize.vcx" BaseClass="container" />

	ADD OBJECT 'cbValidat' AS ctip_deviz WITH ;
		Anchor = 8, ;
		Height = 27, ;
		Left = 675, ;
		Name = "cbValidat", ;
		TabIndex = 6, ;
		Top = 176, ;
		Width = 115, ;
		_combobox1.Name = "_combobox1", ;
		_combobox1.Width = 111
		*< END OBJECT: ClassLib="oviz_devize.vcx" BaseClass="container" />

	ADD OBJECT 'Ck_datai' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.datai, ;
		Caption = "Data comenzii", ;
		Height = 18, ;
		Left = 675, ;
		Name = "Ck_datai", ;
		TabIndex = 3, ;
		tip = D, ;
		Top = 63, ;
		Width = 102, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrinmat' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nrinmat, ;
		Caption = "Nr. înmatriculare", ;
		Height = 18, ;
		Left = 675, ;
		Name = "Ck_nrinmat", ;
		TabIndex = 4, ;
		Top = 78, ;
		Width = 114, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrord' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nrord, ;
		Caption = "Nr. comanda", ;
		Height = 18, ;
		Left = 675, ;
		Name = "Ck_nrord", ;
		TabIndex = 1, ;
		Top = 35, ;
		Width = 93, ;
		ZOrderSet = 11
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nume' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nume, ;
		Caption = "Nume client", ;
		Height = 18, ;
		Left = 675, ;
		Name = "Ck_nume", ;
		TabIndex = 2, ;
		Top = 49, ;
		Width = 88, ;
		ZOrderSet = 5
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'ck_series' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.series, ;
		Caption = "Serie sasiu", ;
		Height = 18, ;
		Left = 675, ;
		Name = "ck_series", ;
		TabIndex = 4, ;
		Top = 93, ;
		Width = 84, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Cmd_anulare' AS cmd_sterge WITH ;
		Anchor = 12, ;
		caction = do_anuleaza, ;
		Caption = "\<Anulare validare", ;
		cpicturedown = d:\roa\roaauto\comun\grafice\cancel.bmp, ;
		cpictureup = d:\roa\roaauto\comun\grafice\cancel.bmp, ;
		Enabled = .F., ;
		Height = 34, ;
		Left = 674, ;
		Name = "Cmd_anulare", ;
		Picture = ..\comun\grafice\cancel.bmp, ;
		PicturePosition = 1, ;
		TabIndex = 12, ;
		Top = 365, ;
		Width = 116, ;
		WordWrap = .T., ;
		ZOrderSet = 10
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'cmd_arhivare' AS cmd_adauga WITH ;
		Anchor = 8, ;
		BackColor = 0,128,192, ;
		caction = do_inchide_fortat, ;
		Caption = "A\<rhivare", ;
		cpicturedown = d:\roa\roaauto\comun\grafice\closed_blue.bmp, ;
		cpictureup = d:\roa\roaauto\comun\grafice\closed_blue.bmp, ;
		Enabled = .T., ;
		FontBold = .F., ;
		Height = 27, ;
		Left = 674, ;
		Name = "cmd_arhivare", ;
		Picture = ..\comun\grafice\closed_blue.bmp, ;
		PicturePosition = 1, ;
		TabIndex = 11, ;
		Top = 307, ;
		Width = 116, ;
		ZOrderSet = 9
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_cauta1' AS cmd_cauta WITH ;
		Anchor = 8, ;
		Height = 27, ;
		Left = 674, ;
		Name = "Cmd_cauta1", ;
		TabIndex = 9, ;
		Top = 249, ;
		Width = 116, ;
		ZOrderSet = 3
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_reset1' AS cmd_reset WITH ;
		Anchor = 8, ;
		Height = 27, ;
		Left = 674, ;
		Name = "Cmd_reset1", ;
		TabIndex = 15, ;
		Top = 277, ;
		Width = 116, ;
		ZOrderSet = 4
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_validare' AS cmd_adauga WITH ;
		Anchor = 12, ;
		Caption = "\<Validare", ;
		cpicturedown = d:\roa\roaauto\comun\grafice\check.bmp, ;
		cpictureup = d:\roa\roaauto\comun\grafice\check.bmp, ;
		Enabled = .F., ;
		Height = 27, ;
		Left = 674, ;
		Name = "Cmd_validare", ;
		Picture = ..\comun\grafice\check.bmp, ;
		PicturePosition = 1, ;
		TabIndex = 11, ;
		Top = 338, ;
		Width = 116, ;
		ZOrderSet = 9
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_vizualizare' AS cmd_executa WITH ;
		Anchor = 12, ;
		Caption = "Vi\<zualizare", ;
		cpicturedown = d:\roa\roaauto\comun\grafice\leaf_blue.bmp, ;
		cpictureup = d:\roa\roaauto\comun\grafice\leaf_blue.bmp, ;
		FontBold = .F., ;
		Height = 27, ;
		Left = 674, ;
		Name = "Cmd_vizualizare", ;
		Picture = ..\comun\grafice\leaf_blue.bmp, ;
		PicturePosition = 1, ;
		TabIndex = 10, ;
		Top = 406, ;
		Width = 116, ;
		WordWrap = .T., ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grdcomenzi' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 16, ;
		DeleteMark = .F., ;
		FontSize = 10, ;
		Height = 396, ;
		Left = 17, ;
		Name = "grdcomenzi", ;
		Panel = 1, ;
		Partition = 0, ;
		RecordSource = "crscomenzi", ;
		RowHeight = 19, ;
		TabIndex = 8, ;
		Top = 36, ;
		Width = 649, ;
		ZOrderSet = 2, ;
		Column1.ControlSource = "nrord", ;
		Column1.FontName = "Arial", ;
		Column1.FontSize = 10, ;
		Column1.Name = "cNrord", ;
		Column1.Width = 108, ;
		Column2.ColumnOrder = 2, ;
		Column2.ControlSource = "datai", ;
		Column2.FontName = "Arial", ;
		Column2.FontSize = 10, ;
		Column2.Name = "cDatai", ;
		Column2.Width = 88, ;
		Column3.ColumnOrder = 3, ;
		Column3.ControlSource = "nume", ;
		Column3.FontName = "Arial", ;
		Column3.FontSize = 10, ;
		Column3.Name = "cNume", ;
		Column3.Width = 224, ;
		Column4.ColumnOrder = 4, ;
		Column4.ControlSource = "asigurator", ;
		Column4.FontName = "Arial", ;
		Column4.FontSize = 10, ;
		Column4.Name = "cAsigurator", ;
		Column4.Width = 85, ;
		Column5.ColumnOrder = 5, ;
		Column5.ControlSource = "inspector", ;
		Column5.FontName = "Arial", ;
		Column5.FontSize = 10, ;
		Column5.Name = "cInspector", ;
		Column5.Width = 85, ;
		Column6.ColumnOrder = 7, ;
		Column6.ControlSource = "IIF(validat=1,'Da','Nu')", ;
		Column6.FontName = "Arial", ;
		Column6.FontSize = 10, ;
		Column6.Name = "cValidat", ;
		Column6.Width = 43, ;
		Column7.ColumnOrder = 8, ;
		Column7.ControlSource = "manopera", ;
		Column7.FontName = "Arial", ;
		Column7.FontSize = 10, ;
		Column7.Format = "R", ;
		Column7.InputMask = (get_mask(12,gnPc)), ;
		Column7.Name = "cManopera", ;
		Column8.ColumnOrder = 9, ;
		Column8.ControlSource = "materiale", ;
		Column8.FontName = "Arial", ;
		Column8.FontSize = 10, ;
		Column8.Format = "R", ;
		Column8.InputMask = (get_mask(12,gnPc)), ;
		Column8.Name = "cMateriale", ;
		Column9.ColumnOrder = 10, ;
		Column9.ControlSource = "util_valid", ;
		Column9.FontName = "Arial", ;
		Column9.FontSize = 10, ;
		Column9.Name = "cUtil_valid", ;
		Column9.Width = 115, ;
		Column10.ColumnOrder = 11, ;
		Column10.ControlSource = "dataoravalid", ;
		Column10.FontName = "Arial", ;
		Column10.FontSize = 10, ;
		Column10.Name = "cDataoravalid", ;
		Column10.Width = 113, ;
		Column11.ColumnOrder = 12, ;
		Column11.ControlSource = "tip_comanda", ;
		Column11.FontName = "Arial", ;
		Column11.FontSize = 10, ;
		Column11.Name = "cTip_comanda", ;
		Column11.Width = 78, ;
		Column12.ColumnOrder = 6, ;
		Column12.ControlSource = "nr_dosar", ;
		Column12.FontName = "Arial", ;
		Column12.FontSize = 10, ;
		Column12.Name = "cNr_dosar", ;
		Column12.Width = 90, ;
		Column13.ColumnOrder = 16, ;
		Column13.ControlSource = "IIF(inchis_fortat=1,'Da','Nu')", ;
		Column13.FontName = "Arial", ;
		Column13.FontSize = 10, ;
		Column13.Name = "cArhivat", ;
		Column13.Width = 43, ;
		Column14.ColumnOrder = 13, ;
		Column14.ControlSource = "series", ;
		Column14.FontSize = 10, ;
		Column14.Name = "cSeries", ;
		Column14.Width = 151, ;
		Column15.ColumnOrder = 14, ;
		Column15.ControlSource = "kmint", ;
		Column15.FontSize = 10, ;
		Column15.Name = "cKmint", ;
		Column16.ColumnOrder = 15, ;
		Column16.ControlSource = "ore_functionare", ;
		Column16.FontSize = 10, ;
		Column16.Name = "cOreFunctionare"
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdcomenzi.cArhivat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Arhivat", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cArhivat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cAsigurator.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Asigurator", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cAsigurator.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cDatai.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data comanda", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cDatai.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cDataoravalid.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data si ora validarii", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cDataoravalid.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cInspector.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Inspector", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cInspector.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cKmint.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Km. la bord", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cKmint.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cManopera.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Manopera", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cManopera.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cMateriale.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Materiale", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cMateriale.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNr_dosar.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. dosar", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNr_dosar.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNrord.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr.comanda", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNrord.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNume.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nume client", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNume.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cOreFunctionare.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Ore motor", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cOreFunctionare.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cSeries.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Serie sasiu", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cSeries.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cTip_comanda.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Tip comanda", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cTip_comanda.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cUtil_valid.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Validata de catre", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cUtil_valid.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cValidat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Validat", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cValidat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Gridextra1' AS gridextra WITH ;
		gridexpression = Thisform.grdcomenzi, ;
		Left = 648, ;
		Name = "Gridextra1", ;
		productname = ROA, ;
		Top = 420
		*< END OBJECT: ClassLib="..\comun\utile\gridextras\gridextras.vcx" BaseClass="custom" />

	ADD OBJECT 'Lb_simplu1' AS lb_simplu WITH ;
		Anchor = 8, ;
		BackColor = 255,255,255, ;
		BackStyle = 0, ;
		Caption = "Tip comanda", ;
		Height = 18, ;
		Left = 672, ;
		Name = "Lb_simplu1", ;
		TabIndex = 5, ;
		Top = 109, ;
		Width = 76, ;
		ZOrderSet = 15
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'lbArhivat' AS lb_simplu WITH ;
		Anchor = 8, ;
		BackColor = 255,255,255, ;
		BackStyle = 0, ;
		Caption = "Arhivate", ;
		Height = 18, ;
		Left = 675, ;
		Name = "lbArhivat", ;
		TabIndex = 5, ;
		Top = 205, ;
		Width = 48, ;
		ZOrderSet = 15
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'lbValidat' AS lb_simplu WITH ;
		Anchor = 8, ;
		BackColor = 255,255,255, ;
		BackStyle = 0, ;
		Caption = "Validate", ;
		Height = 18, ;
		Left = 676, ;
		Name = "lbValidat", ;
		TabIndex = 5, ;
		Top = 160, ;
		Width = 49, ;
		ZOrderSet = 15
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />
	
	PROCEDURE actualizeaza_grid1
		Parameters tcFiltru
		Local lcFiltru
		If Empty(tcFiltru)
			lcFiltru = pocomenzi.ca_baza1.cfiltru
		Else
			lcFiltru = tcFiltru
		Endif
		
		Thisform.LockScreen = .T.
		Thisform.MousePointer = 11
		
		save_grid_tag(Thisform.grdcomenzi)
		pocomenzi.ca_baza1.cfiltru = lcFiltru
		pocomenzi.ca_baza1.afisare()
		restore_grid_tag(Thisform.grdcomenzi)
		
		If Reccount('crscomenzi')>0
			Thisform.cmd_vizualizare.Enabled=.T.
			Thisform.grdcomenzi.SetFocus()
		Else
			Thisform.cmd_anulare.Enabled=.F.
			Thisform.cmd_validare.Enabled=.F.
			Thisform.cmd_vizualizare.Enabled=.F.
		Endif
		
		Thisform.MousePointer = 0
		Thisform.LockScreen = .F.
		
	ENDPROC

	PROCEDURE do_adauga
		Private pnvalidat,pnid_ordl,pnid_lucrare,pnrecno,pnfacturat
		Local lnProcTvav, lcMesaj
		Select crscomenzi
		pcnrord=nrord
		pnvalidat=Validat
		pnid_ordl=id_ordl
		pnfacturat=facturat
		pnid_lucrare=id_lucrare
		pnrecno=Recno()
		*!*	modificare	v 2.0.35
		lnProcTvav = proc_tvav
		lcMesaj = []
		*!*	modificare	v 2.0.35	^
		If pnvalidat=0 And pnfacturat=0
			*!*	modificare	v 2.0.35
			lnRaspuns = 6
			If !INLIST(lnProcTvav,1,gnCotaTVAStandard)
				lcMesaj = "Cota TVA de la crearea comenzii difera de cea standard din luna curenta!" + CRLF
			Endif
			lcMesaj = lcMesaj + "Sunteti sigur ca doriti sa validati comanda "+Alltrim(pcnrord)+" ?"
			If amessagebox(lcMesaj,4+32+256,"Confirmare validare") =6
				*!*	modificare	v 2.0.35	^
				Thisform.LockScreen=.T.
				Thisform.MousePointer= 11
				lcSql=[begin pack_auto.dev_valideaza_comanda('] + Alltrim(gcS) + [',] + Alltrim(Str(pnid_ordl)) + ;
					[,] + Alltrim(Str(gnIdutil)) + [,] + ALLTRIM(STR(m.gnAn)) + [,] + ALLTRIM(STR(gnLuna)) + [); end;]
				lnSucces=goExecutor.oExecute(lcSql)
				Thisform.MousePointer= 0
				Thisform.LockScreen=.F.
		
				If lnSucces < 0
					amessagebox(goExecutor.oPrelucrareEroare(),0+16,'Eroare')
					Return
				Endif
				Thisform.actualizeaza_grid1()
				If pnrecno > Reccount('crscomenzi')
					Go Top
				Else
					Go pnrecno
				Endif
			Endif
		Else
			amessagebox("Aceasta comanda este deja validata!",0+48,"Atentie")
		Endif
	ENDPROC

	PROCEDURE do_anuleaza
		Private pnvalidat,pnid_ordl,pcnrord,pnrecno,pnfacturat
		Select crscomenzi
		pnvalidat=Validat
		pnid_ordl=id_ordl
		pnfacturat=facturat
		pcnrord=nrord
		pnrecno=Recno()
		If pnvalidat>0 And pnfacturat=0
			If amessagebox("Sunteti sigur ca doriti sa anulati validarea comenzii "+Alltrim(pcnrord)+" ?",4+32+256,"Confirmare")==6
				Thisform.LockScreen=.T.
				Thisform.MousePointer= 11
				lcSql=[begin pack_auto.dev_invalideaza_comanda('] + Alltrim(gcS) + [',] + Alltrim(Str(pnid_ordl)) + [,] + Alltrim(Str(gnIdutil)) + [); end;]
				lnSucces=goExecutor.oExecute(lcSql)
				Thisform.MousePointer= 0
				Thisform.LockScreen=.F.
				If lnSucces < 0
					amessagebox(goExecutor.cEroare,0+16,'Eroare')
					Return
				Endif
				Thisform.actualizeaza_grid1()
				If pnrecno > Reccount('crscomenzi')
					Go Top
				Else
					Go pnrecno
				Endif
			Endif
		Else
			amessagebox("Aceasta comanda nu este validata!",0+48,"Atentie")
		Endif
		
	ENDPROC

	PROCEDURE do_cauta
		Local lcFiltru
		Local lnOptiune, lnOptiuneArhivat
		*!*	lcFiltru=[luna=]+Alltrim(Str(gnLuna))+[ and an=]+Alltrim(Str(gnAn))
		*!*	lcfiltru=[((extract(month from datafact) =]+Alltrim(Str(gnLuna))+[ and extract(year from datafact) =]+Alltrim(Str(gnAn))+pcFiltruOra +[) or (datafact is null ))]
		lcFiltru = gcCondLuna
		
		lnOptiune = Iif(Thisform.cbValidat._combobox1.Value = '<Toate>', 1, Iif(Thisform.cbValidat._combobox1.Value = 'Validate', 2, 3))
		lnOptiuneArhivat = Iif(Thisform.cbArhivat._combobox1.Value = '<Toate>', 1, Iif(Thisform.cbArhivat._combobox1.Value = 'Active', 2, 3))
		If Thisform.ck_datai.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_datai.filtru
		Endif
		
		If Thisform.ck_nrinmat.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_nrinmat.filtru
		Endif
		
		If Thisform.ck_nrord.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_nrord.filtru
		Endif
		
		If Thisform.ck_nume.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_nume.filtru
		Endif
		
		If Thisform.ck_series.Value = 1
			lcFiltru = lcFiltru + Thisform.ck_series.filtru
		Endif
		
		If Thisform.cbtip_deviz._combobox1.Value!= "<Toate tipurile>"
			lcFiltru = lcFiltru + [ and a.id_tip = ] + Alltrim(Str(lista_tipuri.id_tip))
		Endif
		
		
		Do Case
			Case lnOptiune = 2
				lcFiltru = lcFiltru + [ and a.validat = 1]
			Case lnOptiune = 3
				lcFiltru = lcFiltru + [ and a.validat = 0]
		Endcase
		Thisform.ntiplistare = lnOptiune
		
		Do Case
			Case lnOptiuneArhivat = 2 && Active (nearhivate)
				lcFiltru = lcFiltru + [ and a.inchis_fortat = 0]
			Case lnOptiuneArhivat = 3 && arhivate
				lcFiltru = lcFiltru + [ and a.inchis_fortat = 1]
		ENDCASE
		
		Thisform.actualizeaza_grid1(lcFiltru)
		
		If Reccount('crscomenzi') = 0
			amessagebox('Cautarea nu a intors rezultate!', 0 + 48, 'Info cautare')
			Thisform.ck_nrord.SetFocus()
		Endif
		
	ENDPROC

	PROCEDURE do_excel
		If Reccount('crscomenzi')=0
			amessagebox("Nu exista date pentru export!",0+48,"Atentie")
			Return
		Endif
		
		Try
			poExcel = Createobject("Excel.Application")
		Catch
			export_xls('crscomenzi')
			amessagebox("Fisierul XLS a fost creat!",0+48,"Atentie")
		*!*		Return
		Endtry
		
		If Type('poExcel') <> 'U'
			Thisform.MousePointer = 11
			Thisform.LockScreen = .T.
		
			Local llIntrerupt
			llIntrerupt = .F.
			loTherm = Newobject("_thermometer","_therm","","Export date in Excel...")
			loTherm.AlwaysOnTop=.T.
			loTherm.Show()
		
			lnPercent = 0
			lcTask= Thisform.lb_titlu_alb_b121.Caption
			loTherm.Update(lnPercent, lcTask)
		
			poExcel.WorkBooks.Add
			poExcel.Sheets(1).Select
			poExcel.Sheets(1).Name=[Comenzi]
			poExcel.Cells(2,2).Font.Bold=.T.
			poExcel.Cells(2,2).Font.Size = 16
			poExcel.Cells(2,2) = Thisform.lb_titlu_alb_b121.Caption
		
			lnRandStart=5
			lnColoanaI=2
		
			lnRow=lnRandStart
			Set Cursor Off
			With Thisform.grdcomenzi
				lcCursor=.RecordSource
				lnNrRanduri=Reccount(lcCursor)
				lnPercent = (lnRow - lnRandStart + 1) * 100 / (lnNrRanduri + 1)
				lcTask = [Completare cap de tabel...]
				loTherm.Update(lnPercent, lcTask)
		
				For nCol=1 To .ColumnCount
					nColumn = .Columns(nCol).ColumnOrder+lnColoanaI
					poExcel.Columns(nColumn).ColumnWidth = .Columns(nCol).Width/7.5
					poExcel.Cells(lnRow,nColumn) = .Columns(nCol).header1.Caption
					lcColoana=Alltrim(.Columns(nCol).ControlSource)
					Do Case
					Case Type(lcColoana)='C'
						poExcel.Columns(nColumn).NumberFormat=[@]
					Case Type(lcColoana)='D'
						poExcel.Columns(nColumn).NumberFormat=[dd/mm/yyyy;@]
					Endcase
					poExcel.Cells(lnRow,nColumn).Font.Bold = .T.
					poExcel.Cells(lnRow,nColumn).Interior.ColorIndex = 16
				Endfor
		
				lcTask = [Completare randuri...]
				Select (lcCursor)
				Scan
					lnRow = lnRow + 1
					lnPercent = (lnRow - lnRandStart + 1) * 100 / (lnNrRanduri + 1)
					loTherm.Update(lnPercent, lcTask)
					If Inkey()=27
						amessagebox("Exportul a fost intrerupt!",0+48,"Atentie")
						llIntrerupt = .T.
						Exit
					Endif
					For nCol = 1 To .ColumnCount
						nColumn = .Columns(nCol).ColumnOrder+lnColoanaI
						poExcel.Cells(lnRow,nColumn) = Eval(.Columns(nCol).ControlSource)
					Endfor
				Endscan
		
				loTherm.Complete()
				loTherm.AlwaysOnTop=.F.
				Release loTherm
			Endwith
			Set Cursor On
			If llIntrerupt
				poExcel.DisplayAlerts = .F.
				poExcel.Quit
			Else
				poExcel.Visible=.T.
			Endif
			Release poExcel
			Thisform.LockScreen=.F.
			Thisform.MousePointer=0
		Endif
	ENDPROC

	PROCEDURE do_executa
		If Reccount('crscomenzi')>0
		*!*	modificare	v 2.0.35
			Select crscomenzi
			Scatter Name ocomanda
			vizualizeaza_detalii_comanda(Thisform,ocomanda,.T.)
		*!*		Private porul,pooper,podevest
		*!*		Store '' To porul,pooper,podevest
		*!*		Do ccsectii in update_devize.prg
		*!*		Select crscomenzi
		*!*		Scatter Name ocomanda
		*!*		pcschema=['ID_ORDL n(10),CODOP c(10),TIMPN n(9,3),PRET n(20,4),VALIDAT n(1),DENOP c(100),DATAI D,ID_OPER N(20),SECTIE c(100)']
		*!*		pcselect=['select id_ordl,codop,timpn,pret,validat,denop,datai,id_oper,sectie from ] + gcS + [.dev_voper where 1=2']
		*!*	*!*	modificat
		*!*	*!*	pcorder=[validat desc,dataora,datai,sectie,denop]
		*!*		pcorder=[datai,id_oper]
		*!*	*!*	^
		*!*		pcfiltru=[1=2]
		*!*		llAfiseaza=.F.
		*!*		gencursor('pooper','oper',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
		*!*		pooper.ca_baza1.afisare()
		*!*		pooper.ca_baza1.cfiltru = [id_ordl = ]+Alltrim(Str(ocomanda.id_ordl))+[ and ]+;
		*!*			[extract(month from datai)+extract(year from datai)*12<=?gnLuna+?gnAn*12]
		*!*	*!*	modificare 09.06
		*!*	*!*			[extract(month from dataora)+extract(year from dataora)*12<=?gnLuna+?gnAn*12]
		*!*	*!*	^
		*!*		pcschema=['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)']
		*!*		pcselect=['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 + [.dev_vestimari_rep where 1=2']
		*!*		pcorder=[id_dev_estimare_rep]
		*!*		pcfiltru=[1=2]
		*!*		llAfiseaza=.F.
		*!*		gencursor('podevest','v_devizest',pcselect,pcfiltru,pcschema,pcorder)
		*!*		podevest.ca_baza1.afisare()
		*!*		podevest.ca_baza1.cfiltru = [id_lucrare = ] + ALLTRIM(STR(ocomanda.id_lucrare))	
		*!*	*!*	modificare	v 2.0.22 : am adaugat tva
		*!*		pcschema=['CODMAT c(50),DENUMIRE c(100),PRETV n(20,4),CANTE n(18,3),DATAACT D,ID_RUL n(20),COTA_DIFERITA n(1),TVA n(20,4)']
		*!*		pcselect=[select codmat,denumire,pretv,cante,dataact,id_rul,decode(proc_tvav,pack_contafin.getCotaTVAStandard(?gnLuna,?gnAn),0,1) as cota_diferita,] + ;
		*!*			[pack_sesiune.calculeaza_pret_tva(pretv,1,pack_def.GetIdMonedaNationala(),pack_contafin.getCotaTVAStandard(?gnLuna,?gnAn),0) as tva ] + ;
		*!*			[from ] + gcS + [.vrul where 1=2]
		*!*		pcorder=[dataact,id_rul]
		*!*		pcfiltru=[1=2]
		*!*		llAfiseaza=.F.
		*!*		gencursor('porul','rul',pcselect,pcfiltru,pcschema,pcorder)
		*!*		porul.ca_baza1.afisare()
		*!*		porul.ca_baza1.cfiltru = [id_lucrare = ]+Alltrim(Str(ocomanda.id_lucrare))+[ and ]+;
		*!*			[luna+an*12<=?gnLuna+?gnAn*12]
		*!*		Thisform.AlwaysOnTop=.F.
		*!*		ofrmvizualizare = Createobject('frm_vizcomanda',2,ocomanda.Validat) && 2 = vizualizare
		*!*		ofrmvizualizare.Show(1)
		*!*		Thisform.AlwaysOnTop=.T.
		*!*	*!*	modificare	v 2.0.5
		*!*		If Used('oper')
		*!*			Use In oper
		*!*		Endif
		*!*		If Used('rul')
		*!*			Use In rul
		*!*		Endif
		*!*	*!*	modificare	v 2.0.5	^
		*!*	modificare	v 2.0.35	^
		Else
			amessagebox("Nu exista inregistrari pentru care sa vizualizati manopera si materialele!",48,"Atentie")
		Endif
	ENDPROC

	PROCEDURE do_inchide_fortat
		Local lcMesaj, lcSql, llSucces
		PRIVATE pcnrord, pnArhivat, pnid_ordl, pnrecno
		Select crscomenzi
		pcnrord = nrord
		pnid_ordl = id_ordl
		pnrecno = Recno()
		pnArhivat = inchis_fortat
		lcMesaj = []
		
		If pnArhivat = 0
			lcMesaj = lcMesaj + "Sunteti sigur ca doriti sa arhivati comanda " + Alltrim(pcnrord) + " ?"
			If amessagebox(lcMesaj, 4 + 32 + 256, "Confirmare arhivare") = 6
		
				Thisform.LockScreen = .T.
				Thisform.MousePointer = 11
				lcSql = [begin pack_auto.dev_arhiveaza_comanda(] + Alltrim(Str(pnid_ordl)) + ;
					[,] + Alltrim(Str(gnIdutil)) + [); end;]
				llSucces = goExecutor.oExecuta(lcSql)
				Thisform.MousePointer = 0
				Thisform.LockScreen = .F.
		
				If !m.llSucces
					Return
				Endif
				Thisform.actualizeaza_grid1()
				If pnrecno > Reccount('crscomenzi')
					Go Top
				Else
					Go pnrecno
				Endif
			Endif
		Else
			lcMesaj = lcMesaj + "Sunteti sigur ca doriti sa dezarhivati comanda " + Alltrim(pcnrord) + " ?"
			If amessagebox(lcMesaj, 4 + 32 + 256, "Confirmare dezarhivare") = 6
		
				Thisform.LockScreen = .T.
				Thisform.MousePointer = 11
				lcSql = [begin pack_auto.dev_dezarhiveaza_comanda(] + Alltrim(Str(pnid_ordl)) + [); end;]
				llSucces = goExecutor.oExecuta(lcSql)
				Thisform.MousePointer = 0
				Thisform.LockScreen = .F.
		
				If !m.llSucces
					Return
				Endif
				Thisform.actualizeaza_grid1()
				If pnrecno > Reccount('crscomenzi')
					Go Top
				Else
					Go pnrecno
				Endif
			Endif
		Endif
	ENDPROC

	PROCEDURE do_listare
		If Reccount('crscomenzi')>0
			Private pcTitlu,pcDataOra
			pcDataOra=get_ora(2)
			pcTitlu=[CENTRALIZATOR COMENZI]
			Do Case
			Case Thisform.ntiplistare=2
				pcTitlu = pcTitlu +[ VALIDATE]
			Case Thisform.ntiplistare=3
				pcTitlu = pcTitlu + [ NEVALIDATE]
			Endcase
			Thisform.AlwaysOnTop= .F.
			Select crscomenzi
			Report Form centralizator_devize To Printer Prompt Preview
			Thisform.AlwaysOnTop=.T.
		Else
			amessagebox("Nu exista inregistrari pentru listare!",0+48,"Atentie")
		Endif
	ENDPROC

	PROCEDURE do_reset
		With Thisform
			For i=1 To .Objects.Count
				If Upper(.Objects(i).BaseClass)='CHECKBOX'
					.Objects(i).Value=0
				Endif
			Endfor
		Endwith
		Thisform.cbtip_deviz.do_reset()
		thisform.cbArhivat.do_reset()
		thisform.cbValidat.do_reset()
		Thisform.ck_nrord.SetFocus()
		
	ENDPROC

	PROCEDURE Init
		DODEFAULT()
		 
		this.cmd_validare.Visible= this.lActiv5
		this.cmd_anulare.Visible = this.lActiv5
		this.cmd_arhivare.Visible = this.lActiv6
		
		this.gridextra1.setup()
	ENDPROC

	PROCEDURE cbArhivat._combobox1.Destroy
		Use In (SELECT('lista_arhivat'))
	ENDPROC

	PROCEDURE cbArhivat._combobox1.Init
		Create Cursor lista_arhivat (denumire C(50),id N(5))
		Select lista_arhivat
		INSERT INTO lista_arhivat (denumire, id) VALUES ('<Toate>', 0)
		INSERT INTO lista_arhivat (denumire, id) VALUES ('Active', 1)
		INSERT INTO lista_arhivat (denumire, id) VALUES ('Arhivate', 2)
		
		
		This.RowSourceType= 2
		This.RowSource="lista_arhivat"
		This.Value="Active"
		this.Parent.cdefault="Active"
	ENDPROC

	PROCEDURE cbValidat._combobox1.Destroy
		Use In (SELECT('lista_validat'))
	ENDPROC

	PROCEDURE cbValidat._combobox1.Init
		Create Cursor lista_validat(denumire C(50),id N(5))
		Select lista_validat
		INSERT INTO lista_validat(denumire, id) VALUES ('<Toate>', 0)
		INSERT INTO lista_validat(denumire, id) VALUES ('Validate', 1)
		INSERT INTO lista_validat(denumire, id) VALUES ('Nevalidate', 2)
		
		
		This.RowSourceType= 2
		This.RowSource="lista_validat"
		This.Value="<Toate>"
		this.Parent.cdefault="<Toate>"
	ENDPROC

	PROCEDURE grdcomenzi.AfterRowColChange
		Lparameters nColIndex
		If This.RowColChange!=2
			Select crscomenzi
			DoDefault()
			Do Case
				Case facturat=1
					Thisform.cmd_anulare.Enabled=.F.
					Thisform.cmd_validare.Enabled=.F.
				Case Validat=0
					Thisform.cmd_anulare.Enabled=.F.
					Thisform.cmd_validare.Enabled=.T.
				Case Validat=1
					Thisform.cmd_anulare.Enabled=.T.
					Thisform.cmd_validare.Enabled=.F.
			ENDCASE
			
			IF inchis_fortat = 0
				thisform.cmd_arhivare.Caption ='A\<rhivare'
			ELSE 
				thisform.cmd_arhivare.Caption ='Dezar\<hivare'		
			ENDIF 
		Endif
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_viz_comenzi AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="grdcomenzi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrord.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrord.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatai.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatai.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNume.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNume.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cTip_comanda.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cTip_comanda.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValidat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cValidat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDataoravalid.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDataoravalid.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cFacturat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cFacturat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatafact.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cDatafact.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrFact.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cNrFact.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cPartRef.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cPartRef.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cSeries.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cSeries.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cKmint.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cKmint.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cOreFunctionare.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdcomenzi.cOreFunctionare.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_cauta1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_reset1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nume" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_datai" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="ck_series" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrinmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_vizualizare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrord" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cbtip_deviz" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lbValidat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lbArhivat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_nr_inreg" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Xresize1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridextra1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_excel1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cbValidat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cbArhivat" UniqueID="" Timestamp="" />

	*<PropValue>
		cgridsortlist = grdcomenzi
		DoCreate = .T.
		Height = 551
		lactiv1 = .T.
		lactiv2 = .T.
		Name = "frm_viz_comenzi"
		Width = 792
		WindowState = 2
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Tag = "RESIZABLE,NOVERTICAL_RESIZE"
		_shape1.Top = 0
		_shape1.Width = 792
		_shape1.ZOrderSet = 0
		_shape2.Height = 29
		_shape2.Left = 755
		_shape2.Name = "_shape2"
		_shape2.Tag = "MOVABLE,NOVERTICAL_MOVE"
		_shape2.Top = -1
		_shape2.Width = 38
		_shape2.ZOrderSet = 9
		Lb_titlu_alb_b121.Caption = "VIZUALIZARE COMENZI"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 11
		Lb_titlu_alb_b121.ZOrderSet = 1
		BUT_TERMIN1.Anchor = 8
		BUT_TERMIN1.Left = 760
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 10
		BUT_TERMIN1.Tag = "MOVABLE,NOVERTICAL_MOVE"
		BUT_TERMIN1.Top = 0
		BUT_TERMIN1.ZOrderSet = 11
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'But_excel1' AS but_excel WITH ;
		Anchor = 8, ;
		Left = 699, ;
		Name = "But_excel1", ;
		Top = 0, ;
		Visible = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_listare1' AS but_listare WITH ;
		Anchor = 8, ;
		Left = 728, ;
		Name = "But_listare1", ;
		Top = 0, ;
		Visible = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'cbArhivat' AS ctip_deviz WITH ;
		Anchor = 8, ;
		Left = 693, ;
		Name = "cbArhivat", ;
		TabIndex = 6, ;
		Top = 251, ;
		_combobox1.Name = "_combobox1"
		*< END OBJECT: ClassLib="oviz_devize.vcx" BaseClass="container" />

	ADD OBJECT 'cbtip_deviz' AS ctip_deviz WITH ;
		Left = 693, ;
		Name = "cbtip_deviz", ;
		TabIndex = 6, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 162, ;
		_combobox1.Name = "_combobox1"
		*< END OBJECT: ClassLib="oviz_devize.vcx" BaseClass="container" />

	ADD OBJECT 'cbValidat' AS ctip_deviz WITH ;
		Anchor = 8, ;
		Left = 693, ;
		Name = "cbValidat", ;
		TabIndex = 6, ;
		Top = 206, ;
		_combobox1.Name = "_combobox1"
		*< END OBJECT: ClassLib="oviz_devize.vcx" BaseClass="container" />

	ADD OBJECT 'Ck_datai' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		camp_nume = a.datai, ;
		Caption = "Data comenzii", ;
		FontName = "Arial Narrow", ;
		Left = 693, ;
		Name = "Ck_datai", ;
		TabIndex = 3, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		tip = D, ;
		Top = 66, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrinmat' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		camp_nume = a.nrinmat, ;
		Caption = "Nr. inmatriculare", ;
		FontName = "Arial Narrow", ;
		Left = 693, ;
		Name = "Ck_nrinmat", ;
		TabIndex = 4, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 81, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrord' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		camp_nume = a.nrord, ;
		Caption = "Nr. comanda", ;
		FontName = "Arial Narrow", ;
		Left = 693, ;
		Name = "Ck_nrord", ;
		TabIndex = 1, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 36, ;
		ZOrderSet = 10
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nume' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		camp_nume = a.nume, ;
		Caption = "Nume client", ;
		FontName = "Arial Narrow", ;
		Left = 693, ;
		Name = "Ck_nume", ;
		TabIndex = 2, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 51, ;
		ZOrderSet = 5
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'ck_series' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		camp_nume = a.series, ;
		Caption = "Serie sasiu", ;
		FontName = "Arial Narrow", ;
		Left = 693, ;
		Name = "ck_series", ;
		TabIndex = 4, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 96, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Clb_nr_inreg' AS clb_tx_simplu WITH ;
		Left = 492, ;
		Name = "Clb_nr_inreg", ;
		Tag = "MOVABLE", ;
		Top = 516, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Lb_simplu1.Caption = "Nr. înregistrari", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cmd_cauta1' AS cmd_cauta WITH ;
		Left = 696, ;
		Name = "Cmd_cauta1", ;
		TabIndex = 7, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 325, ;
		ZOrderSet = 3
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_reset1' AS cmd_reset WITH ;
		Height = 27, ;
		Left = 696, ;
		Name = "Cmd_reset1", ;
		TabIndex = 12, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 361, ;
		Width = 84, ;
		ZOrderSet = 4
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_vizualizare' AS cmd_executa WITH ;
		Caption = "Vi\<zualizare", ;
		Height = 27, ;
		Left = 696, ;
		Name = "Cmd_vizualizare", ;
		TabIndex = 9, ;
		Tag = "MOVABLE", ;
		Top = 465, ;
		Width = 84, ;
		WordWrap = .T., ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grdcomenzi' AS _grdrow WITH ;
		ColumnCount = 13, ;
		DeleteMark = .F., ;
		FontSize = 10, ;
		Height = 468, ;
		Left = 17, ;
		Name = "grdcomenzi", ;
		Panel = 1, ;
		RecordSource = "crscomenzi", ;
		RowHeight = 19, ;
		TabIndex = 8, ;
		Tag = "RESIZABLE", ;
		Top = 36, ;
		Width = 667, ;
		ZOrderSet = 2, ;
		Column1.ControlSource = "nrord", ;
		Column1.FontSize = 10, ;
		Column1.Name = "cNrord", ;
		Column1.Width = 83, ;
		Column2.ColumnOrder = 3, ;
		Column2.ControlSource = "IIF(TYPE('datai')=='D',datai,TTOD(datai))", ;
		Column2.FontName = "Arial", ;
		Column2.FontSize = 10, ;
		Column2.Name = "cDatai", ;
		Column2.Width = 88, ;
		Column3.ColumnOrder = 2, ;
		Column3.ControlSource = "nume", ;
		Column3.FontName = "Arial", ;
		Column3.FontSize = 10, ;
		Column3.Name = "cNume", ;
		Column3.Width = 195, ;
		Column4.ControlSource = "tip_comanda", ;
		Column4.FontName = "Arial", ;
		Column4.FontSize = 10, ;
		Column4.Name = "cTip_comanda", ;
		Column4.Width = 99, ;
		Column5.ControlSource = "IIF(validat=1,'DA','NU')", ;
		Column5.FontName = "Arial", ;
		Column5.FontSize = 10, ;
		Column5.Name = "cValidat", ;
		Column5.Width = 44, ;
		Column6.ControlSource = "dataoravalid", ;
		Column6.FontName = "Arial", ;
		Column6.FontSize = 10, ;
		Column6.Name = "cDataoravalid", ;
		Column6.Width = 77, ;
		Column7.ControlSource = "IIF(facturat=1,'DA','NU')", ;
		Column7.FontName = "Arial", ;
		Column7.FontSize = 10, ;
		Column7.Name = "cFacturat", ;
		Column7.Width = 52, ;
		Column8.ControlSource = "IIF(TYPE('datafact')=='D',datafact,TTOD(datafact))", ;
		Column8.FontName = "Arial", ;
		Column8.FontSize = 10, ;
		Column8.Name = "cDatafact", ;
		Column8.Width = 74, ;
		Column9.ControlSource = "nrfact", ;
		Column9.FontName = "Arial", ;
		Column9.FontSize = 10, ;
		Column9.InputMask = (get_mask(14,0)), ;
		Column9.Name = "cNrFact", ;
		Column9.Width = 87, ;
		Column10.ControlSource = "part_ref", ;
		Column10.FontName = "Arial", ;
		Column10.FontSize = 10, ;
		Column10.Name = "cPartRef", ;
		Column10.Width = 137, ;
		Column11.ControlSource = "series", ;
		Column11.FontSize = 10, ;
		Column11.Name = "cSeries", ;
		Column11.ReadOnly = .T., ;
		Column11.Width = 211, ;
		Column12.ControlSource = "kmint", ;
		Column12.FontSize = 10, ;
		Column12.Name = "cKmint", ;
		Column12.ReadOnly = .T., ;
		Column13.ControlSource = "ore_functionare", ;
		Column13.FontSize = 10, ;
		Column13.Name = "cOreFunctionare", ;
		Column13.ReadOnly = .T.
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdcomenzi.cDatafact.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data factura", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cDatafact.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cDatai.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data comanda", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cDatai.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cDataoravalid.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data validarii", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cDataoravalid.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cFacturat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Facturat", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cFacturat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cKmint.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Km. la bord", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cKmint.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNrFact.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr.factura", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNrFact.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNrord.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr.comanda", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNrord.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cNume.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nume client", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cNume.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cOreFunctionare.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Ore motor", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cOreFunctionare.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cPartRef.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Referinta", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cPartRef.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cSeries.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Serie sasiu", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cSeries.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T., ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cTip_comanda.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Tip comanda", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cTip_comanda.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdcomenzi.cValidat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Validat", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdcomenzi.cValidat.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Gridextra1' AS gridextra WITH ;
		gridexpression = Thisform.grdComenzi, ;
		Left = 700, ;
		Name = "Gridextra1", ;
		Top = 445
		*< END OBJECT: ClassLib="..\comun\utile\gridextras\gridextras.vcx" BaseClass="custom" />

	ADD OBJECT 'Lb_simplu1' AS lb_simplu WITH ;
		BackColor = 255,255,255, ;
		BackStyle = 0, ;
		Caption = "Tip comanda", ;
		FontName = "Arial Narrow", ;
		Left = 693, ;
		Name = "Lb_simplu1", ;
		TabIndex = 5, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 144, ;
		ZOrderSet = 13
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'lbArhivat' AS lb_simplu WITH ;
		Anchor = 8, ;
		BackColor = 255,255,255, ;
		BackStyle = 0, ;
		Caption = "Arhivate", ;
		FontName = "Arial Narrow", ;
		Left = 693, ;
		Name = "lbArhivat", ;
		TabIndex = 5, ;
		Top = 235, ;
		ZOrderSet = 15
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'lbValidat' AS lb_simplu WITH ;
		Anchor = 8, ;
		BackColor = 255,255,255, ;
		BackStyle = 0, ;
		Caption = "Validate", ;
		FontName = "Arial Narrow", ;
		Left = 693, ;
		Name = "lbValidat", ;
		TabIndex = 5, ;
		Top = 190, ;
		ZOrderSet = 15
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Xresize1' AS xresize WITH ;
		Left = 348, ;
		Name = "Xresize1", ;
		Top = 528
		*< END OBJECT: ClassLib="..\comun\clase\xresize.vcx" BaseClass="custom" />
	
	PROCEDURE actualizeaza_grid1
		Parameters tcFiltru
		Local lcFiltru
		If Empty(tcFiltru)
			lcFiltru = pocomenzi.ca_baza1.cfiltru
		Else
			lcFiltru = tcFiltru
		Endif
		
		Thisform.LockScreen = .T.
		Thisform.MousePointer = 11
		save_grid(Thisform.grdcomenzi)
		pocomenzi.ca_baza1.cfiltru = lcFiltru
		pocomenzi.ca_baza1.afisare()
		restore_grid(Thisform.grdcomenzi)
		Thisform.MousePointer = 0
		Thisform.LockScreen = .F.
		
		If Reccount('crscomenzi')>0
			thisform.clb_nr_inreg.text_simplu1.Value=RECCOUNT('crscomenzi')
			Select crscomenzi
			Go Top
			Thisform.cmd_vizualizare.Enabled=.T.
			Thisform.grdcomenzi.SetFocus()
		Else
			thisform.clb_nr_inreg.text_simplu1.Value=0
			Thisform.cmd_vizualizare.Enabled=.F.
		Endif
		
	ENDPROC

	PROCEDURE do_cauta
		*!* 24.08.2015
		*!* marius.mutu
		*!* se afiseaza doar comenzile active (nearhivate)
		
		Local lcFiltru
		*!*	lcfiltru=[((extract(month from datafact) =]+Alltrim(Str(gnLuna))+[ and extract(year from datafact) =]+Alltrim(Str(gnAn))+[) or (datafact is null ))]
		
		lnOptiune = Iif(Thisform.cbValidat._combobox1.Value = '<Toate>', 1, Iif(Thisform.cbValidat._combobox1.Value = 'Validate', 2, 3))
		lnOptiuneArhivat = Iif(Thisform.cbArhivat._combobox1.Value = '<Toate>', 1, Iif(Thisform.cbArhivat._combobox1.Value = 'Active', 2, 3))
		
		lcFiltru = gcCondLuna
		
		If Thisform.ck_datai.Value=1
			lcFiltru = lcFiltru + Thisform.ck_datai.filtru
		Endif
		
		If Thisform.ck_nrinmat.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nrinmat.filtru
		Endif
		
		If Thisform.ck_nrord.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nrord.filtru
		Endif
		
		If Thisform.ck_nume.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nume.filtru
		Endif
		
		If Thisform.ck_series.Value=1
			lcFiltru = lcFiltru + Thisform.ck_series.filtru
		ENDIF
		
		If Thisform.cbtip_deviz._combobox1.Value!="<Toate tipurile>"
			lcFiltru = lcFiltru + [ and a.id_tip = ] + Alltrim(Str(lista_tipuri.id_tip))
		Endif
		
		Do Case
			Case lnOptiune = 2
				lcFiltru = lcFiltru + [ and a.validat = 1]
			Case lnOptiune = 3
				lcFiltru = lcFiltru + [ and a.validat = 0]
		Endcase
		
		Do Case
			Case lnOptiuneArhivat = 2 && Active (nearhivate)
				lcFiltru = lcFiltru + [ and a.inchis_fortat = 0]
			Case lnOptiuneArhivat = 3 && arhivate
				lcFiltru = lcFiltru + [ and a.inchis_fortat = 1]
		ENDCASE
		
		Thisform.actualizeaza_grid1(lcFiltru)
		
		If Reccount('crscomenzi')=0
			aMessagebox('Cautarea nu a intors rezultate!',0+48,'Info cautare')
			Thisform.ck_nrord.SetFocus()
		Endif
		
	ENDPROC

	PROCEDURE do_excel
		If Reccount('crscomenzi')=0
			amessagebox("Nu exista date pentru export!",0+48,"Atentie")
			Return
		Endif
		
		Try
			poExcel = Createobject("Excel.Application")
		Catch
			export_xls('crscomenzi')
			amessagebox("Fisierul XLS a fost creat!",0+48,"Atentie")
		*!*		amessagebox("Nu aveti instalata aplicatia Excel!",0+48,"Atentie")
		*!*		Return
		Endtry
		
		If Type('poExcel') <> 'U'
			Thisform.MousePointer = 11
			Thisform.LockScreen = .T.
		
			Local llIntrerupt
			llIntrerupt = .F.
			loTherm = Newobject("_thermometer","_therm","","Export date in Excel...")
			loTherm.AlwaysOnTop=.T.
			loTherm.Show()
		
			lnPercent = 0
			lcTask= Thisform.lb_titlu_alb_b121.Caption
			loTherm.Update(lnPercent, lcTask)
		
			poExcel.WorkBooks.Add
			poExcel.Sheets(1).Select
			poExcel.Sheets(1).Name=[Comenzi]
			poExcel.Cells(2,2).Font.Bold=.T.
			poExcel.Cells(2,2).Font.Size = 16
			poExcel.Cells(2,2) = Thisform.lb_titlu_alb_b121.Caption
		
			lnRandStart=5
			lnColoanaI=2
		
			Set Cursor Off
			lnRow=lnRandStart
			With Thisform.grdcomenzi
				lcCursor=.RecordSource
				lnNrRanduri=Reccount(lcCursor)
				lnPercent = (lnRow - lnRandStart + 1) * 100 / (lnNrRanduri + 1)
				lcTask = [Completare cap de tabel...]
				loTherm.Update(lnPercent, lcTask)
		
				For nCol=1 To .ColumnCount
					nColumn = .Columns(nCol).ColumnOrder+lnColoanaI
					poExcel.Columns(nColumn).ColumnWidth = .Columns(nCol).Width/7.5
					poExcel.Cells(lnRow,nColumn) = .Columns(nCol).header1.Caption
					lcColoana=Alltrim(.Columns(nCol).ControlSource)
					Do Case
					Case Type(lcColoana)='C'
						poExcel.Columns(nColumn).NumberFormat=[@]
					Case Type(lcColoana)='D'
						poExcel.Columns(nColumn).NumberFormat=[dd/mm/yyyy;@]
					Endcase
					poExcel.Cells(lnRow,nColumn).Font.Bold = .T.
					poExcel.Cells(lnRow,nColumn).Interior.ColorIndex = 16
				Endfor
		
				lcTask = [Completare randuri...]
				Select (lcCursor)
				Scan
					lnRow = lnRow + 1
					lnPercent = (lnRow - lnRandStart + 1) * 100 / (lnNrRanduri + 1)
					loTherm.Update(lnPercent, lcTask)
					If Inkey()=27
						amessagebox("Exportul a fost intrerupt!",0+48,"Atentie")
						llIntrerupt = .T.
						Exit
					Endif
					For nCol = 1 To .ColumnCount
						nColumn = .Columns(nCol).ColumnOrder+lnColoanaI
						poExcel.Cells(lnRow,nColumn) = Eval(.Columns(nCol).ControlSource)
					Endfor
				Endscan
		
				loTherm.Complete()
				loTherm.AlwaysOnTop=.F.
				Release loTherm
			Endwith
			Set Cursor On
			If llIntrerupt
				poExcel.DisplayAlerts = .F.
				poExcel.Quit
			Else
				poExcel.Visible=.T.
			Endif
			Release poExcel
			Thisform.LockScreen=.F.
			Thisform.MousePointer=0
		Endif
	ENDPROC

	PROCEDURE do_executa
		If Reccount('crscomenzi')>0
		*!*	modificare	v 2.0.35
			Select crscomenzi
			Scatter Name ocomanda
			vizualizeaza_detalii_comanda(Thisform,ocomanda,.T.)
		*!*		Private porul,pooper,podevest,pcschema1,pcselect1
		*!*		Store '' To porul,pooper,podevest
		*!*		Do ccsectii in update_devize.prg
		*!*		Select crscomenzi
		*!*		Scatter Name ocomanda
		*!*	*!*	modificare pentru script4 -- neaplicata
		*!*	*!*	pcschema=['ID_ORDL n(10),CODOP c(10),TIMPN n(9,3),PRET n(20,4),VALIDAT n(1),DENOP c(100),SECTIE c(30)']
		*!*	*!*	pcselect=['select id_ordl,codop,timpn,pret,validat,denop,sectie from ] + gcS + [.dev_voper where 1=2']
		*!*	*!*	pcorder=[datai,denop,sectie]
		*!*		pcschema=['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)']
		*!*		pcselect=['select id_ordl,codop,timpn,pret,validat,denop,sectie,datai,id_oper from ] + gcS + [.dev_voper where 1=2']
		*!*	*!*	modificat 09.06
		*!*	*!*	pcorder=[validat desc,dataora,datai,sectie,denop]
		*!*		pcorder=[datai,id_oper]
		*!*	*!* ^
		*!*		pcfiltru=[1=2]
		*!*		llAfiseaza=.F.
		*!*		gencursor('pooper','oper',pcselect,pcfiltru,pcschema,pcorder,llAfiseaza)
		*!*		pooper.ca_baza1.afisare()
		*!*		pooper.ca_baza1.cfiltru = [id_ordl = ]+Alltrim(Str(ocomanda.id_ordl))+[ and ]+;
		*!*			[extract(month from datai)+extract(year from datai)*12<=?gnLuna+?gnAn*12]
		*!*	*!*	modificare 09.06
		*!*	*!*			[extract(month from dataora)+extract(year from dataora)*12<=?gnLuna+?gnAn*12]
		*!*	*!*	*!*			[extract(month from datai)+extract(year from datai)*12<=?gnLuna+?gnAn*12]
		*!*	*!*	^
		*!*		pcschema=['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)']
		*!*		pcselect=['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 + [.dev_vestimari_rep where 1=2']
		*!*		pcorder=[id_dev_estimare_rep]
		*!*		pcfiltru=[1=2]
		*!*		llAfiseaza=.F.
		*!*		gencursor('podevest','v_devizest',pcselect,pcfiltru,pcschema,pcorder)
		*!*		podevest.ca_baza1.afisare()
		*!*		podevest.ca_baza1.cfiltru = [id_lucrare = ] + ALLTRIM(STR(ocomanda.id_lucrare))
		*!*		
		*!*	*!*	modificare	v 2.0.22 : am adaugat tva
		*!*		pcschema=['CODMAT c(50),DENUMIRE c(100),PRETV n(20,4),CANTE n(18,3),DATAACT D,ID_RUL N(20),COTA_DIFERITA N(1),TVA n(20,4)']
		*!*	*!*	modificare	v 2.0.35 : am adaugat decode(proc_tvav,1,1,pack_contafin.getCotaTVAStandard(?gnLuna,?gnAn))
		*!*		pcselect=[select codmat,denumire,pretv,cante,dataact,id_rul,decode(proc_tvav,pack_contafin.getCotaTVAStandard(?gnLuna,?gnAn),0,1) as cota_diferita,] + ;
		*!*			[pack_sesiune.calculeaza_pret_tva(pretv,1,pack_def.GetIdMonedaNationala(),] + ;
		*!*			[decode(proc_tvav,1,1,pack_contafin.getCotaTVAStandard(?gnLuna,?gnAn)),0) as tva ] + ;
		*!*			[from ] + gcS + [.vrul where 1=2]
		*!*		pcorder=[dataact,id_rul]
		*!*		pcfiltru=[1=2]
		*!*		llAfiseaza=.F.
		*!*		gencursor('porul','rul',pcselect,pcfiltru,pcschema,pcorder)
		*!*		porul.ca_baza1.afisare()
		*!*		porul.ca_baza1.cfiltru = [id_lucrare = ]+Alltrim(Str(ocomanda.id_lucrare))+[ and ]+;
		*!*			[luna+an*12<=?gnLuna+?gnAn*12]
		*!*		
		*!*		
		*!*		
		*!*		Thisform.AlwaysOnTop=.F.
		*!*		ofrmvizualizare = Createobject('frm_vizcomanda',2,ocomanda.Validat) && 2 = vizualizare
		*!*		ofrmvizualizare.Show(1)
		*!*		Thisform.AlwaysOnTop=.T.
		*!*	*!*	modificare	v 2.0.5
		*!*		If Used('oper')
		*!*			Use In oper
		*!*		Endif
		*!*		If Used('rul')
		*!*			Use In rul
		*!*		Endif
		*!*	*!*	modificare	v 2.0.5	^
		*!*	modificare	v 2.0.35	^
		Else
			amessagebox("Nu exista inregistrari pentru care sa vizualizati manopera si materialele!",48,"Atentie")
		Endif
		
	ENDPROC

	PROCEDURE do_listare
		Local lnOptiune, lnRecno
		Local lnIdOrdl
		Private ocomanda
		
		lnOptiune = xmenu('Listare deviz;Listare raport comanda')
		If Empty(m.lnOptiune)
			Return
		Endif
		
		If m.lnOptiune = 1
			If Reccount('crscomenzi') > 0
				Private porul, pooper, pcschema1, pcselect1, poFirma
				Store '' To porul, pooper, poFirma
		
				Select crscomenzi
				lnRecno = Recno()
				Use In (Select('crsdevize'))
				Select * From crscomenzi Where Recno() = lnRecno Into Cursor crsdevize
		
				Select crsdevize
				Scan
					Scatter Name ocomanda
					listare_comanda_deviz(Thisform, ocomanda)
				Endscan
				Use In (Select('crsdevize'))
				Select crscomenzi
				Go lnRecno
				Thisform.grdcomenzi.SetFocus()
			Else
				amessagebox("Nu ati selectat nici o comanda!", 0 + 48, "Atentie")
				Thisform.grdcomenzi.SetFocus()
			Endif
		Else
			If Reccount('crscomenzi') > 0
				lnIdOrdl = crscomenzi.id_ordl
				Do listare_precomanda With m.lnIdOrdl
			Endif
		Endif
		
	ENDPROC

	PROCEDURE do_reset
		With Thisform
			For i=1 To .Objects.Count
				If Upper(.Objects(i).BaseClass)='CHECKBOX'
					.Objects(i).Value=0
				Endif
			Endfor
		Endwith
		Thisform.cbtip_deviz.do_reset()
		thisform.cbvalidat.do_reset()
		thisform.cbarhivat.do_reset()
		Thisform.ck_nrord.SetFocus()
		
	ENDPROC

	PROCEDURE Init
		DODEFAULT()
		thisform.clb_nr_inreg.text_simplu1.Value=RECCOUNT('crscomenzi')
		this.gridextra1.setup()
	ENDPROC

	PROCEDURE cbArhivat._combobox1.Destroy
		Use In (SELECT('lista_arhivat'))
	ENDPROC

	PROCEDURE cbArhivat._combobox1.Init
		Create Cursor lista_arhivat (denumire C(50),id N(5))
		Select lista_arhivat
		INSERT INTO lista_arhivat (denumire, id) VALUES ('<Toate>', 0)
		INSERT INTO lista_arhivat (denumire, id) VALUES ('Active', 1)
		INSERT INTO lista_arhivat (denumire, id) VALUES ('Arhivate', 2)
		
		
		This.RowSourceType= 2
		This.RowSource="lista_arhivat"
		This.Value="Active"
		this.Parent.cdefault="Active"
	ENDPROC

	PROCEDURE cbValidat._combobox1.Destroy
		Use In (SELECT('lista_validat'))
	ENDPROC

	PROCEDURE cbValidat._combobox1.Init
		Create Cursor lista_validat(denumire C(50),id N(5))
		Select lista_validat
		INSERT INTO lista_validat(denumire, id) VALUES ('<Toate>', 0)
		INSERT INTO lista_validat(denumire, id) VALUES ('Validate', 1)
		INSERT INTO lista_validat(denumire, id) VALUES ('Nevalidate', 2)
		
		
		This.RowSourceType= 2
		This.RowSource="lista_validat"
		This.Value="<Toate>"
		this.Parent.cdefault="<Toate>"
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_viz_comenzi_regie AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="grdfacturi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNrord.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNrord.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cDatai.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cDatai.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNume.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNume.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cManopera.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cManopera.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cMateriale.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cMateriale.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNrFact.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNrFact.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cDataFact.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cDataFact.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cValctva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cValctva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_cauta1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_reset1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nume" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_datai" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrinmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrord" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrfact" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_materiale" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_totalftva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_manopera" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Xresize1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_excel1" UniqueID="" Timestamp="" />

	*<PropValue>
		cgridsortlist = grdfacturi
		DoCreate = .T.
		Height = 497
		lactiv1 = .T.
		Name = "frm_viz_comenzi_regie"
		Width = 793
		WindowState = 2
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Tag = "RESIZABLE,NOVERTICAL_RESIZE"
		_shape1.Top = 0
		_shape1.Width = 792
		_shape1.ZOrderSet = 0
		_shape2.Height = 29
		_shape2.Left = 732
		_shape2.Name = "_shape2"
		_shape2.Tag = "MOVABLE,NOVERTICAL_MOVE"
		_shape2.Top = -1
		_shape2.Width = 62
		_shape2.ZOrderSet = 8
		Lb_titlu_alb_b121.Caption = "VIZUALIZARE COMENZI DE REGIE ÎNCHISE ÎN LUNA "
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 12
		Lb_titlu_alb_b121.ZOrderSet = 1
		BUT_TERMIN1.Left = 762
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 11
		BUT_TERMIN1.Tag = "MOVABLE,NOVERTICAL_MOVE"
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 11
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'But_excel1' AS but_excel WITH ;
		Anchor = 9, ;
		Left = 732, ;
		Name = "But_excel1", ;
		TabIndex = 17, ;
		Top = 1, ;
		Visible = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Ck_datai' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.datai, ;
		Caption = "Data comenzii", ;
		FontName = "Arial Narrow", ;
		Left = 696, ;
		Name = "Ck_datai", ;
		TabIndex = 3, ;
		tip = D, ;
		Top = 85, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrfact' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nract, ;
		Caption = "Nr. act", ;
		FontName = "Arial Narrow", ;
		Left = 696, ;
		Name = "Ck_nrfact", ;
		TabIndex = 5, ;
		Top = 121, ;
		ZOrderSet = 10
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrinmat' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nrinmat, ;
		Caption = "Nr. înmatriculare", ;
		FontName = "Arial Narrow", ;
		Left = 696, ;
		Name = "Ck_nrinmat", ;
		TabIndex = 4, ;
		Top = 104, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrord' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nrord, ;
		Caption = "Nr. comandă", ;
		FontName = "Arial Narrow", ;
		Left = 696, ;
		Name = "Ck_nrord", ;
		TabIndex = 1, ;
		Top = 48, ;
		ZOrderSet = 9
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nume' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nume, ;
		Caption = "Nume client", ;
		FontName = "Arial Narrow", ;
		Left = 696, ;
		Name = "Ck_nume", ;
		TabIndex = 2, ;
		Top = 66, ;
		ZOrderSet = 5
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Clb_manopera' AS clb_tx_simplu WITH ;
		Left = 21, ;
		Name = "Clb_manopera", ;
		TabIndex = 16, ;
		TabStop = .F., ;
		Tag = "MOVABLE,NOHORIZONTAL_MOVE", ;
		Top = 431, ;
		ZOrderSet = 14, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.Format = "R", ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Total manoperă", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_materiale' AS clb_tx_simplu WITH ;
		Left = 21, ;
		Name = "Clb_materiale", ;
		TabIndex = 14, ;
		TabStop = .F., ;
		Tag = "MOVABLE,NOHORIZONTAL_MOVE", ;
		Top = 459, ;
		ZOrderSet = 12, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.Format = "R", ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Total materiale", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_totalftva' AS clb_tx_simplu WITH ;
		Height = 58, ;
		Left = 588, ;
		Name = "Clb_totalftva", ;
		TabIndex = 15, ;
		TabStop = .F., ;
		Tag = "MOVABLE", ;
		Top = 431, ;
		Width = 194, ;
		ZOrderSet = 13, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.Format = "R", ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Left = 5, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 31, ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Total valoare (fără TVA)", ;
		Lb_simplu1.Left = 18, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 7
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cmd_cauta1' AS cmd_cauta WITH ;
		Left = 696, ;
		Name = "Cmd_cauta1", ;
		TabIndex = 9, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 218, ;
		ZOrderSet = 3
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_reset1' AS cmd_reset WITH ;
		Left = 696, ;
		Name = "Cmd_reset1", ;
		TabIndex = 13, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 254, ;
		ZOrderSet = 4
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grdfacturi' AS _grdrow WITH ;
		ColumnCount = 8, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		Height = 384, ;
		Left = 17, ;
		Name = "grdfacturi", ;
		Panel = 1, ;
		RecordSource = "crsfacturi", ;
		TabIndex = 10, ;
		Tag = "RESIZABLE", ;
		Top = 36, ;
		Width = 667, ;
		ZOrderSet = 2, ;
		Column1.ControlSource = "nrord", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cNrord", ;
		Column1.Width = 90, ;
		Column2.ControlSource = "datai", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cDatai", ;
		Column2.Width = 65, ;
		Column3.ControlSource = "nume", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.Name = "cNume", ;
		Column3.Width = 160, ;
		Column4.ColumnOrder = 4, ;
		Column4.ControlSource = "manopera", ;
		Column4.FontName = "Arial Narrow", ;
		Column4.Format = "R", ;
		Column4.InputMask = (get_mask(12,gnPc)), ;
		Column4.Name = "cManopera", ;
		Column5.ColumnOrder = 5, ;
		Column5.ControlSource = "materiale", ;
		Column5.FontName = "Arial Narrow", ;
		Column5.Format = "R", ;
		Column5.InputMask = (get_mask(12,gnPc)), ;
		Column5.Name = "cMateriale", ;
		Column6.ColumnOrder = 6, ;
		Column6.ControlSource = "nract", ;
		Column6.FontName = "Arial Narrow", ;
		Column6.InputMask = (get_mask(14,0)), ;
		Column6.Name = "cNrFact", ;
		Column7.ColumnOrder = 7, ;
		Column7.ControlSource = "dataact", ;
		Column7.FontName = "Arial Narrow", ;
		Column7.Name = "cDataFact", ;
		Column7.Width = 53, ;
		Column8.ColumnOrder = 8, ;
		Column8.ControlSource = "totalftva", ;
		Column8.FontName = "Arial Narrow", ;
		Column8.Format = "R", ;
		Column8.InputMask = (get_mask(12,gnPc)), ;
		Column8.Name = "cValctva"
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdfacturi.cDataFact.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data act", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cDataFact.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cDatai.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cDatai.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cManopera.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Manopera", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cManopera.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cMateriale.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Materiale", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cMateriale.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cNrFact.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr.act", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cNrFact.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cNrord.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr.comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cNrord.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cNume.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nume client", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cNume.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cValctva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Total fara TVA", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cValctva.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Xresize1' AS xresize WITH ;
		Left = 480, ;
		Name = "Xresize1", ;
		Top = 444
		*< END OBJECT: ClassLib="..\comun\clase\xresize.vcx" BaseClass="custom" />
	
	PROCEDURE actualizeaza_grid1
		Parameters tcFiltru
		Local lcFiltru
		If Empty(tcFiltru)
			lcFiltru = pofacturi.ca_baza1.cfiltru
		Else
			lcFiltru = tcFiltru
		Endif
		
		Thisform.LockScreen = .T.
		Thisform.MousePointer = 11
		
		save_grid_comment(Thisform.grdfacturi)
		pofacturi.ca_baza1.cfiltru = lcFiltru
		pofacturi.ca_baza1.afisare()
		restore_grid_comment(Thisform.grdfacturi)
		
		If Reccount('crsfacturi')>0
			If Used('crstotal')
				Use In crstotal
			Endif
			Select Sum(totalftva) As stotalftva From crsfacturi ;
				into Cursor crstotal
			Select crstotal
			Thisform.clb_totalftva.text_simplu1.Value=stotalftva
			Use In crstotal
		
			Select Sum(manopera) As smanopera,Sum(materiale) As smateriale From crsfacturi WHERE nrcrt=1 ;
				into Cursor crstotal
			Thisform.clb_manopera.text_simplu1.Value=smanopera
			Thisform.clb_materiale.text_simplu1.Value=smateriale
			Use In crstotal
		Else
			Thisform.clb_manopera.text_simplu1.Value=0.000
			Thisform.clb_materiale.text_simplu1.Value=0.000
			Thisform.clb_totalftva.text_simplu1.Value=0.000
		Endif
		DoDefault()
		
		
		Thisform.MousePointer = 0
		Thisform.LockScreen = .F.
	ENDPROC

	PROCEDURE do_cauta
		Local lcFiltru
		lcFiltru=[(extract(month from dataact) =]+Alltrim(Str(gnLuna))+[ and extract(year from dataact) =]+Alltrim(Str(gnAn))+[) and id_set = 31006]
		
		If Thisform.ck_nrord.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nrord.filtru
		Endif
		
		If Thisform.ck_nume.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nume.filtru
		Endif
		
		If Thisform.ck_datai.Value=1
			lcFiltru = lcFiltru + Thisform.ck_datai.filtru
		Endif
		
		If Thisform.ck_nrinmat.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nrinmat.filtru
		Endif
		
		If Thisform.ck_nrfact.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nrfact.filtru
		Endif
		
		Thisform.actualizeaza_grid1(lcFiltru)
		
		If Reccount('crsfacturi')=0
			amessagebox('Cautarea nu a intors rezultate!',0+48,'Info cautare')
			Thisform.ck_nrord.SetFocus()
		Endif
		
	ENDPROC

	PROCEDURE do_excel
		If Reccount('crsfacturi')=0
			amessagebox("Nu exista date pentru export!",0+48,"Atentie")
			Return
		Endif
		
		Try
			poExcel = Createobject("Excel.Application")
		Catch
			export_xls('crsfacturi')
			amessagebox("Fisierul XLS a fost creat!",0+48,"Atentie")
		*!*		amessagebox("Nu aveti instalata aplicatia Excel!",0+48,"Atentie")
		*!*		Return
		Endtry
		
		If Type('poExcel') <> 'U'
			Thisform.MousePointer = 11
			Thisform.LockScreen = .T.
		
			Local llIntrerupt
			llIntrerupt = .F.
		
			loTherm = Newobject("_thermometer","_therm","","Export date in Excel...")
			loTherm.AlwaysOnTop=.T.
			loTherm.Show()
		
			lnPercent = 0
			lcTask= Thisform.lb_titlu_alb_b121.Caption
			loTherm.Update(lnPercent, lcTask)
		
			poExcel.WorkBooks.Add
			poExcel.Sheets(1).Select
			poExcel.Sheets(1).Name=[Facturi]
			poExcel.Cells(2,2).Font.Bold=.T.
			poExcel.Cells(2,2).Font.Size = 16
			poExcel.Cells(2,2) = Thisform.lb_titlu_alb_b121.Caption
		
			lnRandStart=5
			lnColoanaI=2
		
			lnRow=lnRandStart
			Set Cursor Off
			With Thisform.grdfacturi
				lcCursor=.RecordSource
				lnNrRanduri=Reccount(lcCursor)
				lnPercent = (lnRow - lnRandStart + 1) * 100 / (lnNrRanduri + 1)
				lcTask = [Completare cap de tabel...]
				loTherm.Update(lnPercent, lcTask)
		
				For nCol=1 To .ColumnCount
					nColumn = .Columns(nCol).ColumnOrder+lnColoanaI
					poExcel.Columns(nColumn).ColumnWidth = .Columns(nCol).Width/7.5
					poExcel.Cells(lnRow,nColumn) = .Columns(nCol).header1.Caption
					lcColoana=Alltrim(.Columns(nCol).ControlSource)
					Do Case
					Case Type(lcColoana)='C'
						poExcel.Columns(nColumn).NumberFormat=[@]
					Case Type(lcColoana)='D'
						poExcel.Columns(nColumn).NumberFormat=[dd/mm/yyyy;@]
					Endcase
					poExcel.Cells(lnRow,nColumn).Font.Bold = .T.
					poExcel.Cells(lnRow,nColumn).Interior.ColorIndex = 16
				Endfor
		
				lcTask = [Completare randuri...]
				Select (lcCursor)
				Scan
					lnRow = lnRow + 1
					lnPercent = (lnRow - lnRandStart + 1) * 100 / (lnNrRanduri + 1)
					loTherm.Update(lnPercent, lcTask)
					If Inkey()=27
						amessagebox("Exportul a fost intrerupt!",0+48,"Atentie")
						llIntrerupt = .T.
						Exit
					Endif
					For nCol = 1 To .ColumnCount
						nColumn = .Columns(nCol).ColumnOrder+lnColoanaI
						poExcel.Cells(lnRow,nColumn) = Eval(.Columns(nCol).ControlSource)
					Endfor
				Endscan
		
				loTherm.Complete()
				loTherm.AlwaysOnTop=.F.
				Release loTherm
			Endwith
			Set Cursor On
			If llIntrerupt
				poExcel.DisplayAlerts = .F.
				poExcel.Quit
			Else
				poExcel.Visible=.T.
			Endif
			Release poExcel
			Thisform.LockScreen=.F.
			Thisform.MousePointer=0
		Endif
	ENDPROC

	PROCEDURE do_reset
		With Thisform
			For i=1 To .Objects.Count
				If Upper(.Objects(i).BaseClass)='CHECKBOX'
					.Objects(i).Value=0
				Endif
			Endfor
		Endwith
		Thisform.ck_nrord.SetFocus()
		
	ENDPROC

	PROCEDURE Init
		DoDefault()
		Thisform.lb_titlu_alb_b121.Caption=Thisform.lb_titlu_alb_b121.Caption+[ ]+Alltrim(Str(gnLuna))+[/]+Alltrim(Str(gnAn))
		
	ENDPROC

	PROCEDURE grdfacturi.AfterRowColChange
		Lparameters nColIndex
		If This.RowColChange!=2
			DoDefault()
		Endif
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_viz_date_comenzi AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Gridtreeview1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.ColumnTV.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.ColumnTV.Text2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.ColumnTV.Text3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.ColumnTV.Text4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.Column2.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.Column2.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.Column2.Text2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.Column2.Text3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.Column2.Label1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.Column4.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.Column4.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.Column4.Text2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.Column4.Label1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.Column3.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.Column3.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.Column3.Label1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.Column1.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridtreeview1.Column1.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridextra1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtClient" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_excel1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Afficherniveau1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtArticol" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_cautare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_reset1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtData1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtData2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtMasina" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_label5" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: refreshdata
		*p: cclient
	*</DefinedPropArrayMethod>

	*<PropValue>
		Caption = "Form"
		cclient = .NULL.
		cgridsortlist = 
		DoCreate = .T.
		Height = 497
		lactiv1 = .T.
		Name = "frm_viz_date_comenzi"
		Width = 793
		WindowState = 2
		_memberdata = <VFPData>
			<memberdata name="cautocompcursor" display="cAutoCompCursor"/>
			<memberdata name="cautocompselectcmd" display="cAutoCompSelectCMD"/>
			<memberdata name="refreshdata" display="RefreshData"/>
			<memberdata name="cclient" display="cClient"/>
		</VFPData>
		_shape1.Anchor = 10
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Tag = "RESIZABLE,NOVERTICAL_RESIZE"
		_shape1.Top = 0
		_shape1.Width = 792
		_shape1.ZOrderSet = 1
		_shape2.Height = 29
		_shape2.Left = 732
		_shape2.Name = "_shape2"
		_shape2.Tag = "MOVABLE,NOVERTICAL_MOVE"
		_shape2.Top = -1
		_shape2.Width = 62
		_shape2.ZOrderSet = 6
		Lb_titlu_alb_b121.Caption = "Vizualizare date: Client - Masina / Comanda / Articol"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 12
		Lb_titlu_alb_b121.ZOrderSet = 2
		BUT_TERMIN1.Anchor = 8
		BUT_TERMIN1.Left = 762
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 10
		BUT_TERMIN1.Tag = "MOVABLE,NOVERTICAL_MOVE"
		BUT_TERMIN1.Top = 0
		BUT_TERMIN1.ZOrderSet = 9
		Gridsort1.Left = 775
		Gridsort1.Name = "Gridsort1"
		Gridsort1.Top = 468
	*</PropValue>

	ADD OBJECT '_label1' AS _label WITH ;
		Caption = "Client", ;
		FontBold = .T., ;
		Left = 16, ;
		Name = "_label1", ;
		TabIndex = 13, ;
		Top = 36
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label2' AS _label WITH ;
		Caption = "Articol", ;
		FontBold = .T., ;
		Left = 348, ;
		Name = "_label2", ;
		TabIndex = 14, ;
		Top = 36
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label3' AS _label WITH ;
		Caption = "Perioada comanda", ;
		FontBold = .T., ;
		Left = 511, ;
		Name = "_label3", ;
		TabIndex = 16, ;
		Top = 36
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label4' AS _label WITH ;
		Caption = "-", ;
		FontBold = .T., ;
		FontSize = 11, ;
		Left = 586, ;
		Name = "_label4", ;
		TabIndex = 17, ;
		Top = 54
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="label" />

	ADD OBJECT '_label5' AS _label WITH ;
		Caption = "Masina", ;
		FontBold = .T., ;
		Height = 17, ;
		Left = 228, ;
		Name = "_label5", ;
		TabIndex = 15, ;
		Top = 36, ;
		Width = 43
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="label" />

	ADD OBJECT 'Afficherniveau1' AS afficherniveau WITH ;
		Left = 15, ;
		Name = "Afficherniveau1", ;
		TabIndex = 8, ;
		Top = 85, ;
		ZOrderSet = 11, ;
		CmdN0.Name = "CmdN0", ;
		CmdN1.Name = "CmdN1", ;
		CmdN2.Name = "CmdN2"
		*< END OBJECT: ClassLib="..\comun\clase\gridtreeview.vcx" BaseClass="container" />

	ADD OBJECT 'But_cautare1' AS but_cautare WITH ;
		Anchor = 0, ;
		cpicturedown = find_jos.bmp, ;
		cpictureup = find_sus.bmp, ;
		Height = 27, ;
		Left = 705, ;
		Name = "But_cautare1", ;
		Picture = ..\comun\grafice\find_sus.bmp, ;
		TabIndex = 6, ;
		Top = 50, ;
		Width = 30
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_excel1' AS but_excel WITH ;
		Anchor = 8, ;
		Left = 732, ;
		Name = "But_excel1", ;
		TabIndex = 11, ;
		Top = 0, ;
		Visible = .T., ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_reset1' AS but_reset WITH ;
		Anchor = 0, ;
		Left = 676, ;
		Name = "But_reset1", ;
		TabIndex = 7, ;
		Top = 50
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Gridextra1' AS gridextra WITH ;
		gridexpression = thisform.gridtreeview1, ;
		Left = 768, ;
		Name = "Gridextra1", ;
		Top = 72
		*< END OBJECT: ClassLib="..\comun\utile\gridextras\gridextras.vcx" BaseClass="custom" />

	ADD OBJECT 'Gridtreeview1' AS gridtreeview WITH ;
		Anchor = 15, ;
		ColumnCount = 5, ;
		FontName = "Arial Narrow", ;
		GridLines = 3, ;
		HeaderHeight = 35, ;
		Height = 381, ;
		Left = 12, ;
		Name = "Gridtreeview1", ;
		niveau0 = cle1, ;
		niveau1 = cle2, ;
		niveau2 = cle3, ;
		Panel = 1, ;
		RecordMark = .T., ;
		RecordSource = "commandes", ;
		RecordSourceType = 1, ;
		ScrollBars = 3, ;
		TabIndex = 9, ;
		Top = 108, ;
		Width = 768, ;
		ZOrderSet = 0, ;
		ColumnTV.ControlSource = "", ;
		ColumnTV.FontName = "Arial Narrow", ;
		ColumnTV.HeaderTV.Caption = "Client - Masina / Comanda / Articol", ;
		ColumnTV.HeaderTV.FontName = "Arial Narrow", ;
		ColumnTV.HeaderTV.Name = "HeaderTV", ;
		ColumnTV.Name = "ColumnTV", ;
		ColumnTV.Width = 260, ;
		Column2.Bound = .F., ;
		Column2.CurrentControl = "Text1", ;
		Column2.DynamicCurrentControl = 'iif(niveau=0,"label1",iif(niveau=1,"text2",iif(niveau=2,"text3","")))', ;
		Column2.DynamicInputMask = "", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "Column2", ;
		Column2.Sparse = .F., ;
		Column2.Width = 109, ;
		Column3.Bound = .F., ;
		Column3.ColumnOrder = 4, ;
		Column3.DynamicCurrentControl = 'iif(niveau=0,"label1",iif(niveau=2,"text2",""))', ;
		Column3.FontName = "Arial Narrow", ;
		Column3.Name = "Column4", ;
		Column3.Sparse = .F., ;
		Column4.Bound = .F., ;
		Column4.ColumnOrder = 5, ;
		Column4.DynamicCurrentControl = 'iif(niveau=2,"text1","label1")', ;
		Column4.FontName = "Arial Narrow", ;
		Column4.Name = "Column3", ;
		Column4.Sparse = .F., ;
		Column5.ColumnOrder = 3, ;
		Column5.ControlSource = "cante", ;
		Column5.DynamicCurrentControl = 'iif(niveau=2, "text1", "")', ;
		Column5.FontName = "Arial Narrow", ;
		Column5.Name = "Column1", ;
		Column5.ReadOnly = .T., ;
		Column5.Width = 55
		*< END OBJECT: ClassLib="..\comun\clase\gridtreeview.vcx" BaseClass="grid" />

	ADD OBJECT 'Gridtreeview1.Column1.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Cantitate", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'Gridtreeview1.Column1.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Gridtreeview1.Column2.Header1' AS header WITH ;
		Caption = "Data Comanda / Cod Material", ;
		FontName = "Arial Narrow", ;
		Name = "Header1", ;
		WordWrap = .T.
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'Gridtreeview1.Column2.Label1' AS label WITH ;
		Caption = "", ;
		Height = 17, ;
		Left = 76, ;
		Name = "Label1", ;
		Top = 107, ;
		Width = 40
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Gridtreeview1.Column2.Text1' AS textbox WITH ;
		Alignment = 3, ;
		BorderStyle = 0, ;
		ControlSource = "cod_fiscal", ;
		FontName = "Arial Narrow", ;
		Format = "!K", ;
		Height = 10, ;
		Left = 26, ;
		Margin = 1, ;
		Name = "Text1", ;
		Top = 29, ;
		Width = 10
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Gridtreeview1.Column2.Text2' AS textbox WITH ;
		BorderStyle = 0, ;
		ControlSource = "datai", ;
		Format = "!KD", ;
		Height = 10, ;
		InputMask = "", ;
		Left = 38, ;
		Name = "Text2", ;
		Top = 29, ;
		Width = 10
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Gridtreeview1.Column2.Text3' AS textbox WITH ;
		BorderStyle = 0, ;
		ControlSource = "codmat", ;
		Format = "!K", ;
		Height = 23, ;
		Left = 40, ;
		Name = "Text3", ;
		Top = 83, ;
		Width = 100
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Gridtreeview1.Column3.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'Gridtreeview1.Column3.Label1' AS label WITH ;
		BackStyle = 0, ;
		BorderStyle = 0, ;
		Caption = "", ;
		Height = 17, ;
		Left = 31, ;
		Name = "Label1", ;
		Top = 83, ;
		Width = 40
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Gridtreeview1.Column3.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ControlSource = "data", ;
		DateFormat = 11, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Format = "DZK", ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Gridtreeview1.Column4.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'Gridtreeview1.Column4.Label1' AS label WITH ;
		Caption = "", ;
		Height = 17, ;
		Left = 11, ;
		Name = "Label1", ;
		Top = 95, ;
		Width = 40
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Gridtreeview1.Column4.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ControlSource = "telefon1", ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Format = "RK", ;
		InputMask = "UUUUUUUUUUUUUUUU", ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Gridtreeview1.Column4.Text2' AS textbox WITH ;
		Alignment = 1, ;
		BorderStyle = 0, ;
		ControlSource = "pret", ;
		Format = "RK", ;
		Height = 23, ;
		InputMask = "999 999 999.99", ;
		Left = 23, ;
		Name = "Text2", ;
		Top = 71, ;
		Width = 100
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Gridtreeview1.ColumnTV.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Gridtreeview1.ColumnTV.Text2' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text2"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Gridtreeview1.ColumnTV.Text3' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text3"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Gridtreeview1.ColumnTV.Text4' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text4"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'txtArticol' AS _textbox WITH ;
		Format = "!K", ;
		Height = 23, ;
		Left = 348, ;
		Name = "txtArticol", ;
		TabIndex = 3, ;
		Top = 54, ;
		Width = 152
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'txtClient' AS _textbox WITH ;
		Format = "!K", ;
		Height = 23, ;
		Left = 16, ;
		Name = "txtClient", ;
		TabIndex = 1, ;
		Top = 54, ;
		Width = 202
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'txtData1' AS _textbox WITH ;
		Alignment = 3, ;
		Format = "K", ;
		Height = 23, ;
		Left = 511, ;
		Name = "txtData1", ;
		TabIndex = 4, ;
		Top = 54, ;
		Value = {}, ;
		Width = 73
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'txtData2' AS _textbox WITH ;
		Alignment = 3, ;
		Format = "K", ;
		Height = 23, ;
		Left = 594, ;
		Name = "txtData2", ;
		TabIndex = 5, ;
		Top = 54, ;
		Value = {}, ;
		Width = 73
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'txtMasina' AS _textbox WITH ;
		Format = "!K", ;
		Height = 23, ;
		Left = 228, ;
		Name = "txtMasina", ;
		TabIndex = 2, ;
		Top = 54, ;
		Width = 111
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />
	
	PROCEDURE actualizeaza_grid1
		Parameters tcFiltru
		Local lcFiltru
		If Empty(tcFiltru)
			lcFiltru = poDateComenzi.ca_baza1.cfiltru
		Else
			lcFiltru = tcFiltru
		Endif
		
		Thisform.LockScreen = .T.
		Thisform.MousePointer = 11
		
		save_grid_comment(Thisform.Gridtreeview1)
		
		poDateComenzi.ca_baza1.cfiltru = lcFiltru
		poDateComenzi.ca_baza1.afisare()
		
		*** Actualizare arbore
		This.RefreshData()
		
		restore_grid_comment(Thisform.gridtreeview1)
		
		Thisform.MousePointer = 0
		Thisform.LockScreen = .F.
	ENDPROC

	PROCEDURE do_cauta
		PRIVATE pcClient, pcArticol, pdData1, pdData2, pcMasina
		Local lcFiltru
		lcFiltru = ""
		pcClient = [%] + ALLTRIM(this.txtClient.Value) + [%]
		pcArticol = [%] + ALLTRIM(this.txtArticol.Value) + [%]
		pcMasina = [%] + ALLTRIM(this.txtMasina.Value) + [%]
		
		pdData1 = this.txtData1.Value
		pdData2 = this.txtData2.Value
		IF !EMPTY(m.pdData1) AND (EMPTY(m.pdData2) OR m.pdData2 < m.pdData1)
			pdData2 = m.pdData1
		ENDIF 
		
		IF !EMPTY(ALLTRIM(this.txtClient.Value))
			lcFiltru = lcFiltru + [ and nume LIKE ?pcClient]
		ENDIF 
		IF !EMPTY(ALLTRIM(this.txtArticol.Value))
			lcFiltru = lcFiltru + [ and denumire LIKE ?pcArticol]
		ENDIF 
		IF !EMPTY(ALLTRIM(this.txtMasina.Value))
			lcFiltru = lcFiltru + [ and nrinmat LIKE ?pcMasina]
		ENDIF 
		IF !EMPTY(m.pdData1)
			lcFiltru = lcFiltru + [ and datai between ?pdData1 and ?pdData2]
		ENDIF 
		
		IF !EMPTY(m.lcFiltru)
			lcFiltru = SUBSTR(m.lcFiltru, 6)
		ENDIF 	
		Thisform.actualizeaza_grid1(lcFiltru)
		If Reccount('crsDateComenzi') = 0
			amessagebox('Cautarea nu a intors rezultate!',0+48,'Info cautare')
		Endif
		
	ENDPROC

	PROCEDURE do_excel
		If Reccount('crsDateComenzi')=0
			amessagebox("Nu exista date pentru export!",0+48,"Atentie")
			Return
		Endif
		
		export_xls('crsDateComenzi')
		amessagebox("Fisierul XLS a fost creat!",0+48,"Atentie")
	ENDPROC

	PROCEDURE do_reset
		WITH thisform
			.txtClient.value = ""
			.txtMasina.value = ""
			.txtArticol.value = ""
			.txtData1.value = {}
			.txtData2.value = {}
		ENDWITH 
		
	ENDPROC

	PROCEDURE Init
		DODEFAULT()
		THIS.Gridtreeview1.SetAll("DynamicForeColor", "IIF(SEMN = 'A', RGB(0,200,100), IIF(SEMN = 'B', RGB(0,100,250), RGB(0,0,0)))", "Column")
		this.gridextra1.setup()
	ENDPROC

	PROCEDURE Load
		This.RefreshData(.T.)
	ENDPROC

	PROCEDURE refreshdata
		Lparameters tlEmpty
		Local lnTip, lcWhere
		
		If m.tlEmpty
			lcWhere = "where 1=2"
		Else
			lcWhere = "where .T."
		Endif
		
		lnTip = 2 && client-masina/comanda/articol
		Do Case
			Case lnTip = 1 && client/comanda/articol
				Select nume As cle1, nrord As cle2, denumire As cle3, 2 As niveau, "" As expanded, .F. As Visible, ;
					cod_fiscal, email, telefon1, ;
					Ttod(datai) As datai, nrinmat, ;
					semn, codmat, cante, Pret, Ttod(Data) As Data ;
					From crsDateComenzi ;
					&lcWhere ;
					Order By nume, datai, semn, denumire ;
					Into Cursor Commandes Readwrite
		
				Select Distinct cle1, 0 As niveau, "N" As expanded, .T. As Visible, ;
					cod_fiscal, email, telefon1 ;
					From Commandes Into Cursor c0
		
				Select Distinct cle1, cle2, 1 As niveau, "N" As expanded, .F. As Visible, ;
					datai, nrinmat ;
					From Commandes Into Cursor c1
		
			Case lnTip = 2 && client-masina/comanda/articol
				Select Padr(Alltrim(nume) + ' - ' + Alltrim(nrinmat), 70, ' ') As cle1, nrord As cle2, denumire As cle3, 2 As niveau, "" As expanded, .F. As Visible, ;
					cod_fiscal, email, telefon1, ;
					Ttod(datai) As datai, ;
					semn, codmat, cante, Pret, Ttod(Data) As Data ;
					From crsDateComenzi ;
					&lcWhere ;
					Order By nume, datai, semn, denumire ;
					Into Cursor Commandes Readwrite
		
				Select Distinct cle1, 0 As niveau, "N" As expanded, .T. As Visible, ;
					cod_fiscal, email, telefon1 ;
					From Commandes Into Cursor c0
		
				Select Distinct cle1, cle2, 1 As niveau, "N" As expanded, .F. As Visible, ;
					datai ;
					From Commandes Into Cursor c1
		
			Otherwise && client/masina/articol
				Select nume As cle1, nrinmat As cle2, denumire As cle3, 2 As niveau, "" As expanded, .F. As Visible, ;
					cod_fiscal, email, telefon1, ;
					Ttod(datai) As datai, nrord, ;
					semn, codmat, cante, Pret, Ttod(Data) As Data ;
					From crsDateComenzi ;
					&lcWhere ;
					Order By nume, nrinmat, semn, Data, denumire ;
					Into Cursor Commandes Readwrite
		
				Select Distinct cle1, 0 As niveau, "N" As expanded, .T. As Visible, ;
					cod_fiscal, email, telefon1 ;
					From Commandes Into Cursor c0
		
				Select Distinct cle1, cle2, 1 As niveau, "N" As expanded, .F. As Visible, ;
					datai, nrord ;
					From Commandes Into Cursor c1
		
		Endcase
		Select Commandes
		Append From Dbf("c0")
		Append From Dbf("c1")
		Index On cle1 + cle2 + semn + cle3 Tag Id
		Use In (Select('c0'))
		Use In (Select('c1'))
		Select Commandes
		SET FILTER TO visible
		GO top
	ENDPROC

	PROCEDURE txtData1.LostFocus
		Local ldData1, ldData2
		ldData1 = This.Value
		ldData2 = Thisform.txtData2.Value
		
		Do Case
			Case  !Empty(m.ldData1) And (Empty(m.ldData2) Or m.ldData2 < m.ldData1)
				Thisform.txtData2.Value = m.ldData1
			Case Empty(m.ldData1) And !Empty(m.ldData2)
				Thisform.txtData2.Value = {}
		Endcase
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_viz_facturi AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="grdfacturi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNrord.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNrord.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cDatai.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cDatai.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNume.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNume.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cAsigurator.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cAsigurator.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cInspector.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cInspector.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cManopera.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cManopera.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cMateriale.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cMateriale.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNrFact.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNrFact.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cDataFact.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cDataFact.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cValctva.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cValctva.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNr_dosar.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cNr_dosar.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cPartRef.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdfacturi.cPartRef.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_cauta1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_reset1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nume" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nr_dosar" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_datai" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrinmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_asigurator" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrord" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrfact" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_inspector" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_materiale" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_valctva" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_manopera" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_datafact" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Xresize1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_excel1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Gridextra1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: refreshdata
	*</DefinedPropArrayMethod>

	*<PropValue>
		cgridsortlist = grdfacturi
		DoCreate = .T.
		Height = 497
		lactiv1 = .T.
		Name = "frm_viz_facturi"
		Width = 793
		WindowState = 2
		_memberdata = <VFPData>
			<memberdata name="refreshdata" display="RefreshData"/>
		</VFPData>
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Tag = "RESIZABLE,NOVERTICAL_RESIZE"
		_shape1.Top = 0
		_shape1.Width = 792
		_shape1.ZOrderSet = 0
		_shape2.Height = 29
		_shape2.Left = 731
		_shape2.Name = "_shape2"
		_shape2.Tag = "MOVABLE,NOVERTICAL_MOVE"
		_shape2.Top = -1
		_shape2.Width = 62
		_shape2.ZOrderSet = 8
		Lb_titlu_alb_b121.Caption = "VIZUALIZARE FACTURI EMISE ÎN LUNA "
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 12
		Lb_titlu_alb_b121.ZOrderSet = 1
		BUT_TERMIN1.Left = 762
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 11
		BUT_TERMIN1.Tag = "MOVABLE,NOVERTICAL_MOVE"
		BUT_TERMIN1.Top = 0
		BUT_TERMIN1.ZOrderSet = 11
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT 'But_excel1' AS but_excel WITH ;
		Anchor = 9, ;
		Left = 703, ;
		Name = "But_excel1", ;
		TabIndex = 17, ;
		Top = 0, ;
		Visible = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_listare1' AS but_listare WITH ;
		Anchor = 9, ;
		Left = 733, ;
		Name = "But_listare1", ;
		TabIndex = 12, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 0, ;
		Visible = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Ck_asigurator' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.asigurator, ;
		Caption = "Asigurator", ;
		Left = 678, ;
		Name = "Ck_asigurator", ;
		TabIndex = 6, ;
		Top = 140, ;
		ZOrderSet = 5
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_datafact' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.dataact, ;
		Caption = "Data factura", ;
		Left = 678, ;
		Name = "Ck_datafact", ;
		TabIndex = 3, ;
		tip = D, ;
		Top = 39, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_datai' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.datai, ;
		Caption = "Data comanda", ;
		Left = 678, ;
		Name = "Ck_datai", ;
		TabIndex = 3, ;
		tip = D, ;
		Top = 104, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_inspector' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.inspector, ;
		Caption = "Inspector", ;
		Left = 678, ;
		Name = "Ck_inspector", ;
		TabIndex = 7, ;
		Top = 157, ;
		ZOrderSet = 5
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nr_dosar' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nr_dosar, ;
		Caption = "Nr.dosar", ;
		Left = 678, ;
		Name = "Ck_nr_dosar", ;
		TabIndex = 8, ;
		Top = 174, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrfact' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nract, ;
		Caption = "Nr. factura", ;
		Left = 678, ;
		Name = "Ck_nrfact", ;
		TabIndex = 5, ;
		Top = 55, ;
		ZOrderSet = 10
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrinmat' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nrinmat, ;
		Caption = "Nr. înmatriculare", ;
		Left = 678, ;
		Name = "Ck_nrinmat", ;
		TabIndex = 4, ;
		Top = 122, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrord' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nrord, ;
		Caption = "Nr. comanda", ;
		Left = 678, ;
		Name = "Ck_nrord", ;
		TabIndex = 1, ;
		Top = 87, ;
		ZOrderSet = 9
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nume' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nume, ;
		Caption = "Nume client", ;
		Left = 678, ;
		Name = "Ck_nume", ;
		TabIndex = 2, ;
		Top = 70, ;
		ZOrderSet = 5
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Clb_manopera' AS clb_tx_simplu WITH ;
		Left = 7, ;
		Name = "Clb_manopera", ;
		TabIndex = 16, ;
		TabStop = .F., ;
		Tag = "MOVABLE,NOHORIZONTAL_MOVE", ;
		Top = 431, ;
		ZOrderSet = 14, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.Format = "R", ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Total manopera", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_materiale' AS clb_tx_simplu WITH ;
		Left = 7, ;
		Name = "Clb_materiale", ;
		TabIndex = 14, ;
		TabStop = .F., ;
		Tag = "MOVABLE,NOHORIZONTAL_MOVE", ;
		Top = 459, ;
		ZOrderSet = 12, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.Format = "R", ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Total materiale", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_valctva' AS clb_tx_simplu WITH ;
		Height = 58, ;
		Left = 479, ;
		Name = "Clb_valctva", ;
		TabIndex = 15, ;
		TabStop = .F., ;
		Tag = "MOVABLE", ;
		Top = 431, ;
		Width = 194, ;
		ZOrderSet = 13, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.Format = "R", ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Left = 5, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Top = 31, ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Total valoare facturi (cu TVA)", ;
		Lb_simplu1.Left = 18, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 7
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cmd_cauta1' AS cmd_cauta WITH ;
		Height = 27, ;
		Left = 678, ;
		Name = "Cmd_cauta1", ;
		TabIndex = 9, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 218, ;
		Width = 109, ;
		ZOrderSet = 3
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_reset1' AS cmd_reset WITH ;
		Height = 27, ;
		Left = 678, ;
		Name = "Cmd_reset1", ;
		TabIndex = 13, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 254, ;
		Width = 109, ;
		ZOrderSet = 4
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grdfacturi' AS _grdrow WITH ;
		ColumnCount = 12, ;
		DeleteMark = .F., ;
		FontSize = 10, ;
		Height = 384, ;
		Left = 7, ;
		Name = "grdfacturi", ;
		Panel = 1, ;
		RecordSource = "crsfacturi", ;
		RowHeight = 19, ;
		TabIndex = 10, ;
		Tag = "RESIZABLE", ;
		Top = 36, ;
		Width = 665, ;
		ZOrderSet = 2, ;
		Column1.ColumnOrder = 4, ;
		Column1.ControlSource = "nrord", ;
		Column1.FontName = "Arial", ;
		Column1.FontSize = 10, ;
		Column1.Name = "cNrord", ;
		Column1.Width = 108, ;
		Column2.ColumnOrder = 5, ;
		Column2.ControlSource = "datai", ;
		Column2.FontName = "Arial", ;
		Column2.FontSize = 10, ;
		Column2.Name = "cDatai", ;
		Column2.Width = 88, ;
		Column3.ColumnOrder = 3, ;
		Column3.ControlSource = "nume", ;
		Column3.FontName = "Arial", ;
		Column3.FontSize = 10, ;
		Column3.Name = "cNume", ;
		Column3.Width = 190, ;
		Column4.ColumnOrder = 9, ;
		Column4.ControlSource = "asigurator", ;
		Column4.FontName = "Arial", ;
		Column4.FontSize = 10, ;
		Column4.Name = "cAsigurator", ;
		Column4.Width = 127, ;
		Column5.ColumnOrder = 10, ;
		Column5.ControlSource = "inspector", ;
		Column5.FontName = "Arial", ;
		Column5.FontSize = 10, ;
		Column5.Name = "cInspector", ;
		Column5.Width = 117, ;
		Column6.ColumnOrder = 6, ;
		Column6.ControlSource = "manopera", ;
		Column6.FontName = "Arial", ;
		Column6.FontSize = 10, ;
		Column6.Format = "R", ;
		Column6.InputMask = (get_mask(12,gnPc)), ;
		Column6.Name = "cManopera", ;
		Column7.ColumnOrder = 7, ;
		Column7.ControlSource = "materiale", ;
		Column7.FontName = "Arial", ;
		Column7.FontSize = 10, ;
		Column7.Format = "R", ;
		Column7.InputMask = (get_mask(12,gnPc)), ;
		Column7.Name = "cMateriale", ;
		Column8.ColumnOrder = 2, ;
		Column8.ControlSource = "nract", ;
		Column8.FontName = "Arial", ;
		Column8.FontSize = 10, ;
		Column8.InputMask = (get_mask(14,0)), ;
		Column8.Name = "cNrFact", ;
		Column8.Width = 90, ;
		Column9.ColumnOrder = 1, ;
		Column9.ControlSource = "dataact", ;
		Column9.FontName = "Arial", ;
		Column9.FontSize = 10, ;
		Column9.Name = "cDataFact", ;
		Column9.Width = 74, ;
		Column10.ColumnOrder = 8, ;
		Column10.ControlSource = "valctva", ;
		Column10.FontName = "Arial", ;
		Column10.FontSize = 10, ;
		Column10.Format = "R", ;
		Column10.InputMask = (get_mask(12,gnPc)), ;
		Column10.Name = "cValctva", ;
		Column10.Width = 95, ;
		Column11.ColumnOrder = 11, ;
		Column11.ControlSource = "nr_dosar", ;
		Column11.FontName = "Arial", ;
		Column11.FontSize = 10, ;
		Column11.Name = "cNr_dosar", ;
		Column12.ColumnOrder = 12, ;
		Column12.ControlSource = "part_ref", ;
		Column12.FontName = "Arial", ;
		Column12.FontSize = 10, ;
		Column12.Name = "cPartRef", ;
		Column12.Width = 95
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdfacturi.cAsigurator.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Asigurator", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cAsigurator.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cDataFact.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data factura", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cDataFact.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cDatai.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data comanda", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cDatai.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cInspector.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Inspector", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cInspector.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cManopera.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Manopera", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cManopera.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cMateriale.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Materiale", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cMateriale.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cNr_dosar.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. dosar", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cNr_dosar.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cNrFact.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. factura", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cNrFact.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cNrord.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr.comanda", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cNrord.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cNume.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nume client", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cNume.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cPartRef.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Referinta", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cPartRef.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdfacturi.cValctva.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare cu TVA", ;
		FontName = "Arial", ;
		FontSize = 10, ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdfacturi.cValctva.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial", ;
		FontSize = 10, ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		SelectedBackColor = 100,185,255
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'Gridextra1' AS gridextra WITH ;
		gridexpression = Thisform.grdFacturi, ;
		Left = 684, ;
		Name = "Gridextra1", ;
		Top = 396
		*< END OBJECT: ClassLib="..\comun\utile\gridextras\gridextras.vcx" BaseClass="custom" />

	ADD OBJECT 'Xresize1' AS xresize WITH ;
		Left = 778, ;
		Name = "Xresize1", ;
		Top = 480
		*< END OBJECT: ClassLib="..\comun\clase\xresize.vcx" BaseClass="custom" />
	
	PROCEDURE actualizeaza_grid1
		Parameters tcFiltru
		Local lcFiltru
		If Empty(tcFiltru)
			lcFiltru = pofacturi.ca_baza1.cfiltru
		Else
			lcFiltru = tcFiltru
		Endif
		
		Thisform.LockScreen = .T.
		Thisform.MousePointer = 11
		
		save_grid_comment(Thisform.grdfacturi)
		pofacturi.ca_baza1.cfiltru = lcFiltru
		pofacturi.ca_baza1.afisare()
		restore_grid_comment(Thisform.grdfacturi)
		
		This.RefreshData()
		
		Thisform.MousePointer = 0
		Thisform.LockScreen = .F.
	ENDPROC

	PROCEDURE do_cauta
		Local lcFiltru
		*!*	lcFiltru=[b.luna=]+Alltrim(Str(gnLuna))+[ and b.an=]+Alltrim(Str(gnAn))
		
		lcFiltru=[(extract(month from dataact) =]+Alltrim(Str(gnLuna))+[ and extract(year from dataact) =]+Alltrim(Str(gnAn))+[)]
		*!*	lcFiltru = gcCondLuna +	[ and a.facturat=1]	-- modificare 27.01
		If Thisform.ck_nrord.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nrord.filtru
		Endif
		
		If Thisform.ck_nume.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nume.filtru
		Endif
		
		If Thisform.ck_datai.Value=1
			lcFiltru = lcFiltru + Thisform.ck_datai.filtru
		Endif
		
		If Thisform.ck_nrinmat.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nrinmat.filtru
		Endif
		
		If Thisform.ck_nrfact.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nrfact.filtru
		Endif
		
		If Thisform.ck_datafact.Value=1
			lcFiltru = lcFiltru + Thisform.ck_datafact.filtru
		ENDIF
		
		If Thisform.ck_asigurator.Value=1
			lcFiltru = lcFiltru + Thisform.ck_asigurator.filtru
		Endif
		
		If Thisform.ck_inspector.Value=1
			lcFiltru = lcFiltru + Thisform.ck_inspector.filtru
		Endif
		
		If Thisform.ck_nr_dosar.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nr_dosar.filtru
		Endif
		
		Thisform.actualizeaza_grid1(lcFiltru)
		
		If Reccount('crsfacturi')=0
			amessagebox('Cautarea nu a intors rezultate!',0+48,'Info cautare')
			Thisform.ck_nrord.SetFocus()
		Endif
		
	ENDPROC

	PROCEDURE do_excel
		If Reccount('crsfacturi')=0
			amessagebox("Nu exista date pentru export!",0+48,"Atentie")
			Return
		Endif
		
		Try
			poExcel = Createobject("Excel.Application")
		Catch
			export_xls('crsfacturi')
			amessagebox("Fisierul XLS a fost creat!",0+48,"Atentie")
		*!*		amessagebox("Nu aveti instalata aplicatia Excel!",0+48,"Atentie")
		*!*		Return
		Endtry
		
		If Type('poExcel') <> 'U'
			Thisform.MousePointer = 11
			Thisform.LockScreen = .T.
		
			Local llIntrerupt
			llIntrerupt = .F.
		
			loTherm = Newobject("_thermometer","_therm","","Export date in Excel...")
			loTherm.AlwaysOnTop=.T.
			loTherm.Show()
		
			lnPercent = 0
			lcTask= Thisform.lb_titlu_alb_b121.Caption
			loTherm.Update(lnPercent, lcTask)
		
			poExcel.WorkBooks.Add
			poExcel.Sheets(1).Select
			poExcel.Sheets(1).Name=[Facturi]
			poExcel.Cells(2,2).Font.Bold=.T.
			poExcel.Cells(2,2).Font.Size = 16
			poExcel.Cells(2,2) = Thisform.lb_titlu_alb_b121.Caption
		
			lnRandStart=5
			lnColoanaI=2
		
			lnRow=lnRandStart
			Set Cursor Off
			With Thisform.grdfacturi
				lcCursor=.RecordSource
				lnNrRanduri=Reccount(lcCursor)
				lnPercent = (lnRow - lnRandStart + 1) * 100 / (lnNrRanduri + 1)
				lcTask = [Completare cap de tabel...]
				loTherm.Update(lnPercent, lcTask)
		
				For nCol=1 To .ColumnCount
					nColumn = .Columns(nCol).ColumnOrder+lnColoanaI
					poExcel.Columns(nColumn).ColumnWidth = .Columns(nCol).Width/7.5
					poExcel.Cells(lnRow,nColumn) = .Columns(nCol).header1.Caption
					lcColoana=Alltrim(.Columns(nCol).ControlSource)
					Do Case
					Case Type(lcColoana)='C'
						poExcel.Columns(nColumn).NumberFormat=[@]
					Case Type(lcColoana)='D'
						poExcel.Columns(nColumn).NumberFormat=[dd/mm/yyyy;@]
					Endcase
					poExcel.Cells(lnRow,nColumn).Font.Bold = .T.
					poExcel.Cells(lnRow,nColumn).Interior.ColorIndex = 16
				Endfor
		
				lcTask = [Completare randuri...]
				Select (lcCursor)
				Scan
					lnRow = lnRow + 1
					lnPercent = (lnRow - lnRandStart + 1) * 100 / (lnNrRanduri + 1)
					loTherm.Update(lnPercent, lcTask)
					If Inkey()=27
						amessagebox("Exportul a fost intrerupt!",0+48,"Atentie")
						llIntrerupt = .T.
						Exit
					Endif
					For nCol = 1 To .ColumnCount
						nColumn = .Columns(nCol).ColumnOrder+lnColoanaI
						poExcel.Cells(lnRow,nColumn) = Eval(.Columns(nCol).ControlSource)
					Endfor
				Endscan
		
				loTherm.Complete()
				loTherm.AlwaysOnTop=.F.
				Release loTherm
			Endwith
			Set Cursor On
			If llIntrerupt
				poExcel.DisplayAlerts = .F.
				poExcel.Quit
			Else
				poExcel.Visible=.T.
			Endif
			Release poExcel
			Thisform.LockScreen=.F.
			Thisform.MousePointer=0
		Endif
	ENDPROC

	PROCEDURE do_listare
		Local lnOptiune
		
		lnOptiune = xmenu('Relistare \<factura;\<Lista facturi')
		If Empty(m.lnOptiune)
			Return
		Endif
		Thisform.AlwaysOnTop = .F.
		If m.lnOptiune = 1
			Do alege_facturi_relistare With 'crsFacturi' In oproceduri_devize.prg
		Else
			Private pcTitlu, pcPerioada
			pcTitlu = 'Lista facturi ' + Padl(Int(gnLuna), 2, '0') + '/' + Alltrim(Str(Int(gnAn)))
			pcPerioada = ''
			goExport.export2frx("crsFacturi", "rap_facturi_clienti", .F., , , , , .T.)
		Endif
		Thisform.AlwaysOnTop = .T.
	ENDPROC

	PROCEDURE do_reset
		With Thisform
			For i=1 To .Objects.Count
				If Upper(.Objects(i).BaseClass)='CHECKBOX'
					.Objects(i).Value=0
				Endif
			Endfor
		Endwith
		Thisform.ck_nrord.SetFocus()
		
	ENDPROC

	PROCEDURE Init
		DoDefault()
		Thisform.lb_titlu_alb_b121.Caption=Thisform.lb_titlu_alb_b121.Caption+Alltrim(Str(gnLuna))+"/"+Alltrim(Str(gnAn))
		
		This.RefreshData()
		
		this.gridextra1.setup()
	ENDPROC

	PROCEDURE refreshdata
		If Reccount('crsfacturi')>0
			If Used('crstotal')
				Use In crstotal
			Endif
			Select Sum(valctva) As svalctva From crsfacturi ;
				into Cursor crstotal
			Select crstotal
			Thisform.clb_valctva.text_simplu1.Value=svalctva
			Use In crstotal
		
			Select Sum(manopera) As smanopera,Sum(materiale) As smateriale From crsfacturi WHERE nrcrt=1;
				into Cursor crstotal
			Thisform.clb_manopera.text_simplu1.Value=smanopera
			Thisform.clb_materiale.text_simplu1.Value=smateriale
			Use In crstotal
		
			Thisform.grdfacturi.SetFocus()
		Else
			Thisform.clb_manopera.text_simplu1.Value=0.000
			Thisform.clb_materiale.text_simplu1.Value=0.000
			Thisform.clb_valctva.text_simplu1.Value=0.000
		Endif
		
	ENDPROC

	PROCEDURE But_listare1.Click
		Local lnOptiune
		
		lnOptiune = xmenu('Relistare \<factura;\<Lista facturi')
		If Empty(m.lnOptiune)
			Return
		Endif
		Thisform.AlwaysOnTop = .F.
		If m.lnOptiune = 1
			Do alege_facturi_relistare With 'crsFacturi' In oproceduri_devize.prg
		Else
			Private pcTitlu, pcPerioada
			pcTitlu = 'Lista facturi ' + Padl(Int(gnLuna), 2, '0') + '/' + Alltrim(Str(Int(gnAn)))
			pcPerioada = ''
			goExport.export2frx("crsFacturi", "rap_facturi_clienti", .F., , , , , .T.)
		Endif
		Thisform.AlwaysOnTop = .T.
	ENDPROC

	PROCEDURE grdfacturi.AfterRowColChange
		Lparameters nColIndex
		If This.RowColChange!=2
			DoDefault()
		Endif
		
	ENDPROC

ENDDEFINE

DEFINE CLASS frm_viz_manopera AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="grdmanopera" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cNrord.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cNrord.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cDatai.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cDatai.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cDenumire.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cDenumire.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cTimpN.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cTimpN.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cPret.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cPret.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cValoare.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cValoare.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cSectie.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cSectie._cbbase1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cSectie._textbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cFacturat.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cFacturat.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cUtil.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cUtil.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cDataora.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cDataora.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cNrfact.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cNrfact.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cDatafactura.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cDatafactura.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cTip_comanda.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmanopera.cTip_comanda.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_cauta1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_reset1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_datafact" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_sectie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_mecanic" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_nrord" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_denumire" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_totalore" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_nrinreg" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Clb_totalvaloare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_simplu1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_shape3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lb_nrord" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_totalore" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Lb_timpn" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmecanici" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmecanici.cMecanic.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmecanici.cMecanic._cbbase1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmecanici.cMecanic._textbox1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmecanici.cOre.Header1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="grdmecanici.cOre.Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Ck_dataora" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="tx_timpn" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="tx_nrord" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_nou1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_sterge1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Cmd_normare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="tx_totalore" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cbtip_deviz" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*p: lsalvat		&& Arata daca modificarile facute asupra datelor din grid au fost salvate in baza de date.
		*p: lvalidat		&& Arata daca inregistrarea modificata a fost validata sau nu inainte de iesirea din forma.
		*p: norainitiala		&& Ora initiala.
		*p: noramodificata		&& Ora modificata.
		*p: ntimpnedistribuit		&& Specifica cat timp a ramas nedistribuit pentru operatia selectata.
	*</DefinedPropArrayMethod>

	*<PropValue>
		cgridsortlist = grdmanopera,grdmecanici
		DoCreate = .T.
		Height = 530
		lactiv2 = .T.
		lactiv4 = .T.
		lsalvat = .T.
		lvalidat = .T.
		Name = "frm_viz_manopera"
		ntimpnedistribuit = 0.000
		Width = 793
		WindowState = 2
		_shape1.Anchor = 10
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Tag = "RESIZABLE,NOVERTICAL_RESIZE"
		_shape1.Top = 0
		_shape1.Width = 792
		_shape1.ZOrderSet = 0
		_shape2.Anchor = 8
		_shape2.Height = 29
		_shape2.Left = 731
		_shape2.Name = "_shape2"
		_shape2.Tag = "MOVABLE,NOVERTICAL_MOVE"
		_shape2.Top = 0
		_shape2.Width = 67
		_shape2.ZOrderSet = 10
		Lb_titlu_alb_b121.Caption = "MANOPERĂ"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 17
		Lb_titlu_alb_b121.ZOrderSet = 1
		BUT_TERMIN1.Anchor = 8
		BUT_TERMIN1.Comment = "MOVABLE,NOVERTICAL_MOVE"
		BUT_TERMIN1.Left = 763
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 15
		BUT_TERMIN1.Tag = "MOVABLE,NOVERTICAL_MOVE"
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 13
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT '_shape3' AS _shape WITH ;
		Anchor = 13, ;
		BackColor = 255,255,255, ;
		BackStyle = 0, ;
		BorderColor = 128,128,128, ;
		Height = 242, ;
		Left = 435, ;
		Name = "_shape3", ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 143, ;
		Width = 345, ;
		ZOrderSet = 14
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="shape" />

	ADD OBJECT 'But_listare1' AS but_listare WITH ;
		Anchor = 8, ;
		Left = 733, ;
		Name = "But_listare1", ;
		TabIndex = 16, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 1, ;
		Visible = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_nou1' AS but_nou WITH ;
		Anchor = 8, ;
		Left = 730, ;
		Name = "But_nou1", ;
		TabIndex = 12, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 128
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'But_sterge1' AS but_sterge WITH ;
		Anchor = 8, ;
		Left = 760, ;
		Name = "But_sterge1", ;
		TabIndex = 13, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 128, ;
		Visible = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'cbtip_deviz' AS ctip_deviz WITH ;
		Anchor = 8, ;
		Height = 27, ;
		Left = 521, ;
		Name = "cbtip_deviz", ;
		TabIndex = 9, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 88, ;
		Width = 84, ;
		_combobox1.Height = 24, ;
		_combobox1.Left = 1, ;
		_combobox1.Name = "_combobox1", ;
		_combobox1.Top = 2, ;
		_combobox1.Width = 83
		*< END OBJECT: ClassLib="oviz_devize.vcx" BaseClass="container" />

	ADD OBJECT 'Ck_datafact' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.datafact, ;
		Caption = "Dată factură", ;
		FontName = "Arial Narrow", ;
		Left = 516, ;
		Name = "Ck_datafact", ;
		TabIndex = 7, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		tip = D, ;
		Top = 39, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_dataora' AS ck_filtru_numar WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = b.dataora, ;
		Caption = "Data efectuării", ;
		FontName = "Arial Narrow", ;
		Left = 432, ;
		Name = "Ck_dataora", ;
		TabIndex = 6, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		tip = D, ;
		Top = 109, ;
		ZOrderSet = 6
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_denumire' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = b.denop, ;
		Caption = "Denumire", ;
		FontName = "Arial Narrow", ;
		Left = 432, ;
		Name = "Ck_denumire", ;
		TabIndex = 3, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 57, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_mecanic' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = nume||CHR(32)||prenume, ;
		Caption = "Mecanic", ;
		FontName = "Arial Narrow", ;
		Left = 432, ;
		Name = "Ck_mecanic", ;
		TabIndex = 5, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 91, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_nrord' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = a.nrord, ;
		Caption = "Nr. comandă", ;
		FontName = "Arial Narrow", ;
		Left = 432, ;
		Name = "Ck_nrord", ;
		TabIndex = 2, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 39, ;
		ZOrderSet = 9
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Ck_sectie' AS ck_filtru_text WITH ;
		Alignment = 0, ;
		Anchor = 8, ;
		camp_nume = b.sectie, ;
		Caption = "Secție", ;
		FontName = "Arial Narrow", ;
		Left = 432, ;
		Name = "Ck_sectie", ;
		TabIndex = 4, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 75, ;
		ZOrderSet = 7
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="checkbox" />

	ADD OBJECT 'Clb_nrinreg' AS clb_tx_simplu WITH ;
		Anchor = 12, ;
		Left = 492, ;
		Name = "Clb_nrinreg", ;
		TabIndex = 18, ;
		TabStop = .F., ;
		Tag = "MOVABLE", ;
		Top = 487, ;
		ZOrderSet = 12, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.InputMask = "999 999 999 999", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Nr. înregistrări", ;
		Lb_simplu1.Left = 3, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_totalore' AS clb_tx_simplu WITH ;
		Anchor = 12, ;
		Left = 492, ;
		Name = "Clb_totalore", ;
		TabIndex = 20, ;
		TabStop = .F., ;
		Tag = "MOVABLE", ;
		Top = 408, ;
		ZOrderSet = 11, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.InputMask = "999 999 999.999", ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Total timp normat", ;
		Lb_simplu1.Left = 3, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Clb_totalvaloare' AS clb_tx_simplu WITH ;
		Anchor = 12, ;
		Left = 492, ;
		Name = "Clb_totalvaloare", ;
		TabIndex = 21, ;
		TabStop = .F., ;
		Tag = "MOVABLE", ;
		Top = 436, ;
		ZOrderSet = 12, ;
		Text_simplu1.Alignment = 3, ;
		Text_simplu1.InputMask = (get_mask(12,gnPc)), ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.ReadOnly = .T., ;
		Text_simplu1.Value = 0, ;
		Lb_simplu1.Caption = "Total valoare lei", ;
		Lb_simplu1.Left = 4, ;
		Lb_simplu1.Name = "Lb_simplu1", ;
		Lb_simplu1.Top = 6
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT 'Cmd_cauta1' AS cmd_cauta WITH ;
		Anchor = 8, ;
		Left = 612, ;
		Name = "Cmd_cauta1", ;
		TabIndex = 10, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 49, ;
		ZOrderSet = 3
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_normare' AS cmd_executa WITH ;
		Anchor = 8, ;
		Caption = "\<Distribuire egală timp normat", ;
		Enabled = .F., ;
		Height = 50, ;
		Left = 707, ;
		Name = "Cmd_normare", ;
		TabIndex = 14, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 53, ;
		Width = 81, ;
		WordWrap = .T.
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'Cmd_reset1' AS cmd_reset WITH ;
		Anchor = 8, ;
		Left = 612, ;
		Name = "Cmd_reset1", ;
		TabIndex = 19, ;
		TabStop = .F., ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 85, ;
		ZOrderSet = 4
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />

	ADD OBJECT 'grdmanopera' AS _grdrow WITH ;
		Anchor = 15, ;
		ColumnCount = 13, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		Height = 468, ;
		Left = 17, ;
		Name = "grdmanopera", ;
		Panel = 1, ;
		RecordSource = "crsmanopera", ;
		RowHeight = 23, ;
		TabIndex = 1, ;
		Tag = "RESIZABLE", ;
		Top = 36, ;
		Width = 403, ;
		ZOrderSet = 2, ;
		Column1.ControlSource = "nrord", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cNrord", ;
		Column1.ReadOnly = .T., ;
		Column1.Width = 90, ;
		Column2.ControlSource = "datai", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Name = "cDatai", ;
		Column2.ReadOnly = .T., ;
		Column2.Width = 65, ;
		Column3.ControlSource = "denop", ;
		Column3.FontName = "Arial Narrow", ;
		Column3.Name = "cDenumire", ;
		Column3.ReadOnly = .T., ;
		Column3.Width = 160, ;
		Column4.ControlSource = "timpn", ;
		Column4.FontName = "Arial Narrow", ;
		Column4.Format = "R", ;
		Column4.InputMask = "99 999.999", ;
		Column4.Name = "cTimpN", ;
		Column4.ReadOnly = .T., ;
		Column4.Width = 58, ;
		Column5.ControlSource = "pret", ;
		Column5.FontName = "Arial Narrow", ;
		Column5.Format = "R", ;
		Column5.InputMask = (get_mask(12,gnPPretV)), ;
		Column5.Name = "cPret", ;
		Column5.ReadOnly = .T., ;
		Column5.Width = 85, ;
		Column6.ControlSource = "pret*timpn", ;
		Column6.FontName = "Arial Narrow", ;
		Column6.Format = "R", ;
		Column6.InputMask = (get_mask(12,gnPc)), ;
		Column6.Name = "cValoare", ;
		Column6.ReadOnly = .T., ;
		Column6.Width = 108, ;
		Column7.ControlSource = "sectie", ;
		Column7.DynamicCurrentControl = "IIF(glLunaInchisa,'_textbox1',IIF(facturat=1,'_textbox1','_cbbase1'))", ;
		Column7.FontName = "Arial Narrow", ;
		Column7.Name = "cSectie", ;
		Column7.Sparse = .F., ;
		Column7.Width = 132, ;
		Column8.Alignment = 2, ;
		Column8.ControlSource = "IIF(facturat=1,'Da','Nu')", ;
		Column8.FontName = "Arial Narrow", ;
		Column8.Name = "cFacturat", ;
		Column8.ReadOnly = .T., ;
		Column8.Width = 38, ;
		Column9.ColumnOrder = 11, ;
		Column9.ControlSource = "util", ;
		Column9.FontName = "Arial Narrow", ;
		Column9.Name = "cUtil", ;
		Column9.ReadOnly = .T., ;
		Column9.Width = 115, ;
		Column10.ColumnOrder = 12, ;
		Column10.ControlSource = "dataora", ;
		Column10.FontName = "Arial Narrow", ;
		Column10.Name = "cDataora", ;
		Column10.ReadOnly = .T., ;
		Column10.Width = 93, ;
		Column11.ColumnOrder = 9, ;
		Column11.ControlSource = "nrfact", ;
		Column11.FontName = "Arial Narrow", ;
		Column11.InputMask = (get_mask(14,0)), ;
		Column11.Name = "cNrfact", ;
		Column11.ReadOnly = .T., ;
		Column12.ColumnOrder = 10, ;
		Column12.ControlSource = "datafact", ;
		Column12.FontName = "Arial Narrow", ;
		Column12.Name = "cDatafactura", ;
		Column12.ReadOnly = .T., ;
		Column13.ControlSource = "tip_comanda", ;
		Column13.FontName = "Arial Narrow", ;
		Column13.Name = "cTip_comanda"
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdmanopera.cDatafactura.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data factura", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cDatafactura.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cDatai.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cDatai.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cDataora.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Data si ora validarii", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cDataora.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cDenumire.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Denumire", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cDenumire.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cFacturat.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Facturat", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cFacturat.Text1' AS textbox WITH ;
		Alignment = 2, ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cNrfact.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. factura", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cNrfact.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cNrord.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr.comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cNrord.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cPret.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Pret", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cPret.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cSectie._cbbase1' AS _cbbase WITH ;
		FontName = "Arial Narrow", ;
		Left = 41, ;
		Name = "_cbbase1", ;
		RowSource = "v_nom_sectii.sectie,id_sectie", ;
		RowSourceType = 6, ;
		Top = 23
		*< END OBJECT: ClassLib="..\comun\clase\_cb_base.vcx" BaseClass="combobox" />

	ADD OBJECT 'grdmanopera.cSectie._textbox1' AS _textbox WITH ;
		Enabled = .F., ;
		Left = 55, ;
		Name = "_textbox1", ;
		ReadOnly = .T., ;
		Top = 23
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cSectie.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Sectia", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cTimpN.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Timp normat", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cTimpN.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cTip_comanda.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Tip comanda", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cTip_comanda.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cUtil.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Validata de catre", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cUtil.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmanopera.cValoare.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Valoare", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmanopera.cValoare.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1", ;
		ReadOnly = .T.
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'grdmecanici' AS _grdrow WITH ;
		Anchor = 13, ;
		ColumnCount = 2, ;
		DeleteMark = .F., ;
		FontName = "Arial Narrow", ;
		Height = 208, ;
		Left = 446, ;
		Name = "grdmecanici", ;
		Panel = 1, ;
		RecordSource = "crsmecanici", ;
		RowHeight = 27, ;
		TabIndex = 11, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 159, ;
		Width = 324, ;
		ZOrderSet = 17, ;
		Column1.ControlSource = "nume", ;
		Column1.DynamicCurrentControl = "IIF(glLunaInchisa,'_textbox1','_cbbase1')", ;
		Column1.FontName = "Arial Narrow", ;
		Column1.Name = "cMecanic", ;
		Column1.Sparse = .F., ;
		Column1.Width = 227, ;
		Column2.ControlSource = "ore", ;
		Column2.FontName = "Arial Narrow", ;
		Column2.Format = "R", ;
		Column2.InputMask = "99 999.999", ;
		Column2.Name = "cOre", ;
		Column2.Width = 65
		*< END OBJECT: ClassLib="..\comun\clase\_grd_base.vcx" BaseClass="grid" />

	ADD OBJECT 'grdmecanici.cMecanic._cbbase1' AS _cbbase WITH ;
		FontName = "Arial Narrow", ;
		Left = 35, ;
		Name = "_cbbase1", ;
		RowSource = "v_mecanici.nume,id_mecanic", ;
		RowSourceType = 6, ;
		Top = 27
		*< END OBJECT: ClassLib="..\comun\clase\_cb_base.vcx" BaseClass="combobox" />

	ADD OBJECT 'grdmecanici.cMecanic._textbox1' AS _textbox WITH ;
		Left = 131, ;
		Name = "_textbox1", ;
		Top = 80
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'grdmecanici.cMecanic.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Mecanic", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmecanici.cOre.Header1' AS header WITH ;
		Alignment = 2, ;
		Caption = "Nr. ore", ;
		FontName = "Arial Narrow", ;
		Name = "Header1"
		*< END OBJECT: BaseClass="header" />

	ADD OBJECT 'grdmecanici.cOre.Text1' AS textbox WITH ;
		BackColor = 255,255,255, ;
		BorderStyle = 0, ;
		FontName = "Arial Narrow", ;
		ForeColor = 0,0,0, ;
		Margin = 0, ;
		Name = "Text1"
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'lb_nrord' AS lb_simplu WITH ;
		Anchor = 8, ;
		BackColor = 255,255,255, ;
		BackStyle = 1, ;
		Caption = "Nr. comandă : ", ;
		FontName = "Arial Narrow", ;
		Left = 448, ;
		Name = "lb_nrord", ;
		TabIndex = 22, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 136, ;
		ZOrderSet = 15
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_simplu1' AS lb_simplu WITH ;
		Anchor = 8, ;
		BackColor = 255,255,255, ;
		BackStyle = 1, ;
		Caption = "Tip comandă", ;
		FontName = "Arial Narrow", ;
		Left = 516, ;
		Name = "Lb_simplu1", ;
		TabIndex = 8, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 71, ;
		ZOrderSet = 14
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_timpn' AS lb_simplu WITH ;
		Anchor = 8, ;
		BackColor = 255,255,255, ;
		BackStyle = 1, ;
		Caption = "Timp normat :", ;
		FontName = "Arial Narrow", ;
		Height = 18, ;
		Left = 603, ;
		Name = "Lb_timpn", ;
		TabIndex = 23, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 136, ;
		ZOrderSet = 16
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'Lb_totalore' AS lb_simplu WITH ;
		Anchor = 12, ;
		BackColor = 255,255,255, ;
		BackStyle = 1, ;
		Caption = "Total ore:", ;
		FontName = "Arial Narrow", ;
		Height = 18, ;
		Left = 672, ;
		Name = "Lb_totalore", ;
		TabIndex = 24, ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 376, ;
		ZOrderSet = 16
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT 'tx_nrord' AS _textbox WITH ;
		Anchor = 8, ;
		FontName = "Arial Narrow", ;
		Height = 23, ;
		Left = 513, ;
		Name = "tx_nrord", ;
		ReadOnly = .T., ;
		TabIndex = 27, ;
		TabStop = .F., ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 132, ;
		Width = 86
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'tx_timpn' AS _textbox WITH ;
		Anchor = 8, ;
		FontBold = .T., ;
		Format = "R", ;
		Height = 23, ;
		InputMask = "99 999.999", ;
		Left = 664, ;
		Name = "tx_timpn", ;
		ReadOnly = .T., ;
		TabIndex = 25, ;
		TabStop = .F., ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 132, ;
		Width = 60
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'tx_totalore' AS _textbox WITH ;
		Anchor = 12, ;
		FontBold = .T., ;
		Format = "R", ;
		Height = 23, ;
		InputMask = "99 999.999", ;
		Left = 715, ;
		Name = "tx_totalore", ;
		ReadOnly = .T., ;
		TabIndex = 26, ;
		TabStop = .F., ;
		Tag = "MOVABLE,NOVERTICAL_MOVE", ;
		Top = 372, ;
		Width = 60
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />
	
	PROCEDURE Activate
		If Reccount('crsmanopera')>0
			Select Sum(ROUND(Pret*timpn,gnPc)) As totalval,Sum(timpn) As totalore From crsmanopera Into Cursor crstotal
			Select crstotal
			Thisform.clb_totalvaloare.text_simplu1.Value=totalval
			Thisform.clb_totalore.text_simplu1.Value=totalore
			Use In crstotal
		
			Thisform.cmd_normare.Enabled=IIF(!glLunaInchisa,.T.,.F.)
			Thisform.grdmanopera.SetFocus()
		Else
			Thisform.cmd_normare.Enabled=.F.
		Endif
		*!*	If This.WindowState= 2 And Type('this.xresize1')='O'
		*!*		This.xresize1.rearrange()
		*!*	Endif
	ENDPROC

	PROCEDURE actualizeaza_grid1
		Parameters tcFiltru
		Local lcFiltru
		If Empty(tcFiltru)
			lcFiltru = pomanopera.ca_baza1.cfiltru
		Else
			lcFiltru = tcFiltru
		Endif
		
		Thisform.LockScreen = .T.
		Thisform.MousePointer = 11
		
		save_grid_comment(Thisform.grdmanopera)
		pomanopera.ca_baza1.cfiltru = lcFiltru
		pomanopera.ca_baza1.afisare()
		restore_grid_comment(Thisform.grdmanopera)
		
		If Reccount('crsmanopera')>0
			Select Sum(ROUND(Pret*timpn,gnPc)) As totalval,Sum(timpn) As totalore From crsmanopera Into Cursor crstotal
			Select crstotal
			Thisform.clb_totalvaloare.text_simplu1.Value=totalval
			Thisform.clb_totalore.text_simplu1.Value=totalore
			Thisform.clb_totalvaloare.refresh
			Thisform.clb_totalore.refresh
			Use In crstotal
		
			Thisform.cmd_normare.Enabled=IIF(!glLunaInchisa,.T.,.F.)
			Thisform.grdmanopera.SetFocus()
		
			Select crsmecanici
			Go Top
		Else
			Thisform.clb_totalvaloare.text_simplu1.Value=0
			Thisform.clb_totalore.text_simplu1.Value=0
			Thisform.clb_totalvaloare.refresh
			Thisform.clb_totalore.refresh
			Thisform.cmd_normare.Enabled=.F.
		Endif
		
		Thisform.clb_nrinreg.text_simplu1.Value=Reccount('crsmanopera')
		Thisform.MousePointer = 0
		Thisform.LockScreen = .F.
		
	ENDPROC

	PROCEDURE actualizeaza_grid2
		Parameters tcFiltru
		Local lcFiltru,lnTimpn
		If Empty(tcFiltru)
			lcFiltru = pomecanici.ca_baza1.cfiltru
		Else
			lcFiltru = tcFiltru
		Endif
		
		Thisform.LockScreen = .T.
		Thisform.MousePointer = 11
		
		Select crsmanopera
		lnTimpn=timpn
		
		save_grid_tag(Thisform.grdmecanici)
		pomecanici.ca_baza1.cfiltru = lcFiltru
		pomecanici.ca_baza1.afisare()
		restore_grid_tag(Thisform.grdmecanici)
		
		If Used('crstotalore')
			Use In crstotalore
		Endif
		Select Nvl(Sum(ore),0) As Total From crsmecanici Into Cursor crstotalore
		Select crstotalore
		Thisform.tx_totalore.Value=Total
		Thisform.ntimpnedistribuit=lnTimpn-Total
		Use In crstotalore
		Thisform.grdmecanici.nrecno=1
		
		Thisform.MousePointer = 0
		Thisform.LockScreen = .F.
		
	ENDPROC

	PROCEDURE do_adauga
		If Reccount('crsmanopera')>0 AND !glLunaInchisa
			Private pnIesire,pcselect,pcfiltru,pcorder,pnid_mecanic,pnid_sectie,pnid_oper,oCautare
			Local lnTimpn,lnSumaOre
			Store "" To oCautare
			pnIesire=0
			pnid_mecanic=0
			Select crsmanopera
			pnid_oper=id_oper
		
			If Thisform.nTimpnedistribuit=0.000
				lcMesaj=Space(6)+"Nu mai puteti adauga inca un mecanic"+Space(6)+Chr(10)+Chr(13)+"deoarece nu mai exista timp normat nedistribuit!"
				amessagebox(lcMesaj,0+48,"Atentie")
				Return
			Endif
		
			pcselect=['select id_mecanic,nume||CHR(32)||prenume as nume,sectie from ] + gcS + [.auto_vmecanici where inactiv=0']
		*!*		pcfiltru = [2=2]	&&	modificare 27.01
			pcfiltru = [inactiv=0]
			pcordine = [nume]
			oCautare=cauta_alfa(pcselect,pcfiltru,[''],pcordine,'nume,sectie','Alegeti mecanicul','Mecanic,Sectie')
			pnid_mecanic=oCautare.id_mecanic
			If pnIesire != 1 Or Empty(pnid_mecanic)
				Return
			Endif
		
			lcSql=[INSERT INTO ] + gcS + [.DEV_OPER_MECANICI(ID_OPER,ID_MECANIC,ORE) VALUES(]+Alltrim(Str(pnid_oper))+[,]+Alltrim(Str(pnid_mecanic))+[,]+Alltrim(Str(Thisform.nTimpnedistribuit,9,3))+[)]
			lnSucces=goExecutor.oExecute(lcSql)
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,0+16,'Eroare')
				Return
			Endif
		
			Thisform.actualizeaza_grid2()
			Select crsmecanici
			Locate For id_mecanic=pnid_mecanic
			Thisform.grdmecanici.SetFocus()
			Release oCautare
		Endif
		
	ENDPROC

	PROCEDURE do_cauta
		Local lcFiltru
		Store '' To lcFiltru
		*!*	lcFiltru = [(extract(month from a.datafact) = ] + Alltrim(Str(gnLuna)) + [ and extract(year from a.datafact) = ]+Alltrim(Str(gnAn)) + [ or a.datafact is null)]
		
		If Thisform.ck_datafact.Value=1
			lcFiltru = lcFiltru + Thisform.ck_datafact.filtru
		Endif
		
		IF thisform.ck_denumire.Value=1
			lcFiltru = lcFiltru + thisform.ck_denumire.filtru
		endif
		
		If Thisform.ck_dataora.Value=1
			lcFiltru = lcFiltru + Thisform.ck_dataora.filtru
		Endif
		
		If Thisform.ck_nrord.Value=1
			lcFiltru = lcFiltru + Thisform.ck_nrord.filtru
		Endif
		
		If Thisform.ck_sectie.Value=1
			lcFiltru = lcFiltru + Thisform.ck_sectie.filtru
		Endif
		
		If Thisform.ck_mecanic.Value=1
			lcFiltru = lcFiltru + [ and (b.id_oper in (select id_oper from ]+Alltrim(gcS)+[.auto_voper_detalii_m where ]+Substr(Thisform.ck_mecanic.filtru,5)+[))]
		Endif
		
		IF thisform.cbtip_deviz._combobox1.value!='<Toate tipurile>'
			lcFiltru = lcFiltru + [ and a.id_tip = ] + ALLTRIM(STR(lista_tipuri.id_tip))
		ENDIF
		
		IF !EMPTY(lcFiltru)
			lcFiltru = SUBSTR(lcFiltru,5) + [ and ]
		ENDIF
		
		lcFiltru = lcFiltru + gcCondLuna + ;
					[and (extract(month from b.dataora)+extract(year from b.dataora)*12<=?gnLuna+?gnAn*12)]
		*!*	With Thisform.opt_tip_comanda
		*!*		Do Case
		*!*		Case .Value=2
		*!*			lcFiltru = lcFiltru + [ and a.id_tip=1]
		*!*		Case .Value=3
		*!*			lcFiltru = lcFiltru + [ and a.id_tip=2]
		*!*		Case .Value=4
		*!*			lcFiltru = lcFiltru + [ and a.id_tip=3]
		*!*		Case .Value=5
		*!*			lcFiltru = lcFiltru + [ and a.id_tip=4]
		*!*		Endcase
		*!*	Endwith
		
		Thisform.grdmanopera.nrecno=0
		Thisform.actualizeaza_grid1(lcFiltru)
		
		If Reccount('crsmanopera')=0
			Thisform.tx_nrord.Value=""
			Thisform.tx_timpn.Value=0.000
			lcFiltru=[1=2]
			Thisform.actualizeaza_grid2(lcFiltru)
			amessagebox('Cautarea nu a intors rezultate!',0+48,'Info cautare')
			Thisform.ck_nrord.SetFocus()
		Endif
	ENDPROC

	PROCEDURE do_executa
		If Reccount('crsmanopera')>0 And Thisform.cmd_normare.Enabled
			lcMesaj=format_msg('Doriti sa distribuiti in mod egal timpul normat'+Chr(13)+Chr(10)+;
				'pentru comenzile din selectie care nu il au distribuit in totalitate?')
			If amessagebox(lcMesaj,4+32+256,'Distribuire timp normat')==6
				Local lcFiltru,lcSql,lnSucces
		*!*	*!*			lcFiltru=Strtran(pomanopera.ca_baza1.cfiltru,Chr(39),Chr(63))
		*!*			lcFiltru = Strtran(gcCondLuna,Chr(39),Chr(63))
		*!*			lcSql=[begin pack_devize.dev_distribuie_timp_n('] + Alltrim(gcS) + [',']+Alltrim(lcFiltru)+['); end;]
		*!*			lnSucces=goExecutor.oExecute(lcSql)
		*!*			If lnSucces < 0
		*!*				amessagebox(goExecutor.cEroare,0+16,'Eroare')
		*!*				Return
		*!*			Endif
				distribuire_timp_normat()
				Thisform.grdmanopera.nrecno=0
				Thisform.actualizeaza_grid1()
				Thisform.grdmanopera.SetFocus()
			Endif
		Endif
		
	ENDPROC

	PROCEDURE do_listare
		If Reccount('crsmanopera')>0
			Private pcdataora,pntotaltn,pntotalval
			If Used('crslistare')
				Use In crslistare
			Endif
		
			*!* inlocuire dev_vvalid_comenzi
			lcSql=[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,]+;
				[c.ore,c.nume||CHR(32)||c.prenume as nume ]+;
				[from ] + gcS + [.auto_normare_comenzi a ]+;
				[join ] + gcS + [.auto_voper b on a.id_ordl=b.id_ordl ]+;
				[left join ] + gcS + [.auto_voper_detalii_m c on b.id_oper=c.id_oper]
		
		*!*		lcSql=[select a.nrord,a.datai,b.id_oper,b.timpn,b.pret,b.id_sectie,b.sectie,b.denop,b.util,b.dataora,]+;
		*!*			[(case when c.id_set in (31003,31004,31005,31011,31012) then 1 else 0 end) as facturat,c.nract as nrfact,c.dataact as datafact,]+;
		*!*			[d.ore,d.nume||CHR(32)||d.prenume as nume ]+;
		*!*			[from ] + gcS + [.dev_vordl a ]+;
		*!*			[join ] + gcS + [.dev_voper b on a.id_ordl=b.id_ordl ]+;
		*!*			[left join ] + gcS + [.dev_vordl_facturi c on a.id_ordl=c.id_ordl ]+;
		*!*			[left join ] + gcS + [.dev_voper_detalii_m d on b.id_oper=d.id_oper]
			lcSql=lcSql+[ where ]+pomanopera.ca_baza1.cfiltru+[ order by ]+pomanopera.ca_baza1.corder
			lnSucces=goExecutor.oExecute(lcSql,'crslistare')
			If lnSucces<0
				amessagebox(goExecutor.cEroare,0+16,'Eroare')
				Return
			Endif
		
			pcdataora=get_ora(2)
			If Used('crstotallist')
				Use In crstotallist
			Endif
			Select Distinct id_oper,timpn,Pret From crslistare Into Cursor crstotallist
			Calculate Sum(timpn),Sum(ROUND(Pret*timpn,gnPc)) To pntotaltn,pntotalval
			Use In crstotallist
			Thisform.visible=.F.
			gofundal.visible=.F.
			Select crslistare
			KEYBOARD "{ctrl+f10}" 
			Report Form rap_oper To Printer Prompt PREVIEW 
			gofundal.visible=.T.
			Thisform.visible=.T.
			Use In crslistare
		Endif
		
	ENDPROC

	PROCEDURE do_modifica
		Lparameters tnTip	&& daca nu exista,atunci procedura a fost apelata din KeyPress
		Local lnTimpN,lnOraI
		IF glLunaInchisa OR Empty(tnTip)
			Return
		Endif
		Thisform.lsalvat=.T.
		lnOraI=Thisform.norainitiala
		lnTimpN=Thisform.ntimpnedistribuit+lnOraI
		Select crsmecanici
		pnid_opermecanic=id_opermecanic
		Do Case
		*!*	Case Thisform.noramodificata<=0
		*!*		amessagebox("Numarul de ore introdus trebuie sa fie mai mare decat 0!",0+48,"Atentie")
		*!*		Update crsmecanici Set ore=lnOraI Where id_opermecanic=pnid_opermecanic
		*!*		Thisform.grdmecanici.cOre.text1.Refresh()
		*!*		Thisform.lvalidat=.F.
		*!*		Return
		Case Thisform.noramodificata>lnTimpN
			amessagebox("Numarul maxim de ore pe care il puteti introduce este "+Alltrim(Str(lnTimpN,9,3))+"!",0+48,"Atentie")
			Update crsmecanici Set ore=lnOraI Where id_opermecanic=pnid_opermecanic
			Thisform.grdmecanici.cOre.text1.Refresh()
			Thisform.lvalidat=.F.
			Return
		Endcase
		lcSql=[UPDATE ] + gcS + [.DEV_OPER_MECANICI SET ORE=]+Alltrim(Str(Thisform.noramodificata,9,3))+[ WHERE ID_OPERMECANIC=]+Alltrim(Str(pnid_opermecanic))
		lnSucces=goExecutor.oExecute(lcSql)
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
			Update crsmecanici Set ore=lnOraI Where id_opermecanic=pnid_opermecanic
			Thisform.grdmecanici.cOre.text1.Refresh()
			Thisform.lvalidat=.F.
			Return
		Endif
		Thisform.ntimpnedistribuit=lnTimpN-Thisform.noramodificata
		Thisform.tx_totalore.Value=Thisform.tx_timpn.Value-Thisform.ntimpnedistribuit
		Thisform.lvalidat=.T.
		
	ENDPROC

	PROCEDURE do_reset
		With Thisform
			For i=1 To .Objects.Count
				If Upper(.Objects(i).BaseClass)='CHECKBOX'
					.Objects(i).Value=0
				Endif
			Endfor
		Endwith
		Thisform.cbtip_deviz.do_reset()
		Thisform.ck_nrord.SetFocus()
		
	ENDPROC

	PROCEDURE do_sterge
		If Used('crsmecanici') And Reccount('crsmecanici')>0 AND !glLunaInchisa
			Private pnid_opermecanic,pcnume
			Select crsmecanici
			pnid_opermecanic=id_opermecanic
			pcnume=nume
			If amessagebox('Doriti sa stergeti mecanicul '+Alltrim(pcnume)+' ?',4+32+256,'Stergere')==6
				lcSql=[UPDATE ] + gcS + [.DEV_OPER_MECANICI SET STERS=1 WHERE ID_OPERMECANIC=]+Alltrim(Str(pnid_opermecanic))
				lnSucces=goExecutor.oExecute(lcSql)
				If lnSucces < 0
					amessagebox(goExecutor.cEroare,0+16,'Eroare')
					Return
				Endif
				Thisform.actualizeaza_grid2()
				Thisform.grdmanopera.SetFocus()
			Endif
		Endif
		
	ENDPROC

	PROCEDURE inainte_de_do_renunt
		Local llReturn
		Thisform.lvalidat=.T.
		If Thisform.lsalvat=.F.
			If amessagebox("Doriti sa salvati ultima modificare facuta?",4+32+256,"Modificare ore")==6
				Thisform.do_modifica(3)
			Endif
		Endif
		Return Thisform.lvalidat
	ENDPROC

	PROCEDURE inainte_de_do_termin
		Local llReturn
		Thisform.lvalidat=.T.
		If Thisform.lsalvat=.F.
			If amessagebox("Doriti sa salvati ultima modificare facuta?",4+32+256,"Modificare ore")==6
				Thisform.do_modifica(2)
			Endif
		Endif
		Return Thisform.lvalidat
		
	ENDPROC

	PROCEDURE Init
		DoDefault()
		If glLunaInchisa
			Thisform.RemoveObject([but_nou1])
			Thisform.RemoveObject([but_sterge1])
			Thisform.cmd_normare.Enabled=.F.
			Thisform.grdmecanici.ReadOnly=.T.
		Endif
	ENDPROC

	PROCEDURE grdmanopera.AfterRowColChange
		Lparameters nColIndex
		If This.RowColChange != 2 And This.nrecno!=Recno()
			DoDefault()
			Local lnid_oper
			Select crsmanopera
			lnid_oper=id_oper
		*!*	modificare	v 2.0.4
			If facturat = 0
				Thisform.grdmecanici.core.ReadOnly = .F.
			Else
				Thisform.grdmecanici.core.ReadOnly = .T.
			Endif
		*!*	modificare	v 2.0.4	^
			Thisform.tx_nrord.Value=Alltrim(nrord)
			Thisform.tx_timpn.Value=timpn
			lcFiltru=[id_oper=]+Alltrim(Str(lnid_oper))
			Thisform.actualizeaza_grid2(lcFiltru)
		Endif
	ENDPROC

	PROCEDURE grdmanopera.cSectie._cbbase1.GotFocus
		This.Tag=Alltrim(Str(v_nom_sectii.id_sectie))
	ENDPROC

	PROCEDURE grdmanopera.cSectie._cbbase1.Valid
		pnid_sectie=v_nom_sectii.id_sectie
		If Int(Val(This.Tag))!=pnid_sectie
			pnid_oper=crsmanopera.id_oper
			lcSql=[UPDATE ] + gcS + [.DEV_OPER SET ID_SECTIE=]+Alltrim(Str(pnid_sectie))+[ WHERE ID_OPER=]+Alltrim(Str(pnid_oper))
			lnSucces=goExecutor.oExecute(lcSql)
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,0+16,'Eroare')
				Return
			Endif
		Endif
		
	ENDPROC

	PROCEDURE grdmecanici.cMecanic._cbbase1.GotFocus
		This.Tag=Alltrim(Str(v_mecanici.id_mecanic))
		
	ENDPROC

	PROCEDURE grdmecanici.cMecanic._cbbase1.Valid
		pnid_mecanic=v_mecanici.id_mecanic
		If Int(Val(This.Tag))!=pnid_mecanic
			pnid_opermecanic=crsmecanici.id_opermecanic
			lcSql=[UPDATE ] + gcS + [.DEV_OPER_MECANICI SET ID_MECANIC=]+Alltrim(Str(pnid_mecanic))+[ WHERE ID_OPERMECANIC=]+Alltrim(Str(pnid_opermecanic))
			lnSucces=goExecutor.oExecute(lcSql)
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,0+16,'Eroare')
				Return
			Endif
		Endif
		
	ENDPROC

	PROCEDURE grdmecanici.cOre.Text1.GotFocus
		Thisform.norainitiala=This.Value
		Thisform.noramodificata=This.Value
		Thisform.lvalidat=.T.
	ENDPROC

	PROCEDURE grdmecanici.cOre.Text1.InteractiveChange
		Thisform.noramodificata=This.Value
		Thisform.lsalvat=.F.
	ENDPROC

	PROCEDURE grdmecanici.cOre.Text1.Valid
		If Thisform.norainitiala!=Thisform.noramodificata And Thisform.lsalvat=.F.
			Thisform.do_modifica(1)
		Endif
		
	ENDPROC

	PROCEDURE grdmecanici.Init
		DoDefault()
		This.core.ReadOnly = .F.
	ENDPROC

ENDDEFINE

DEFINE CLASS optiuni_frm AS _frmbase OF "..\comun\clase\_frm_base.vcx" 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="_pgfrmbase1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1._shape3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1._shape2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1._shape1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Cb_sectie_itp" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Cb_sectie_sp" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Cb_casa" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Lb_explicatie1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Lb_simplu7" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Lb_explicatie2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Lb_simplu6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Lb_simplu10" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.opt_avans" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.opt_discount" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.opt_cui" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.lb_garantie_facturare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.lb_garantie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.lb_postgarantie_facturare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.lb_postgarantie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.lb_constatare_validare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.lb_regie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.lb_productie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.opt_regie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.opt_productie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.lb_constatare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Ct_clb_operatie_itp" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.ct_articolcumulat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Ct_bonfiscal" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Lb_explicatie3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Ct_clb_operatie_sp" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Ct_incasare" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Ct_facturaasig" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Ct_factura" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.ct_disp_plata" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Ct_inchprod" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE1.Ct_inchreg" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE2._shape3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE2.Clb_coef_man" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE2.Clb_coef_man_regie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE2.Lb_explicatie1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.PAGE2.Ct_manoperaspec" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.opt_cnp" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.opt_formatfactura" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.opt_bondetmat" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.txtFooterFact1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.txtFooterFact2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.txtFooterFact3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.txtFooterFact4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.txtFooterFact5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.Lb_simplu2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.Lb_simplu4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.opt_precomenzi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.opt_factlinii" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.Lb_simplu3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.opt_facturi" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.Lb_simplu5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.opt_cgarantie" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.Lb_simplu11" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.Lb_simplu12" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.Lb_simplu9" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_pgfrmbase1.Page3.Lb_simplu8" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="But_renunt1" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: do_cauta_articol
		*m: do_cauta_fdoc
		*m: do_cauta_operatie
		*p: ccasa
		*p: cdenop1
		*p: cdenop2
		*p: csectie1
		*p: csectie2
		*p: nidarticol
		*p: nidbonfiscal
		*p: niddispplata
		*p: nidfactura
		*p: nidfacturaasig
		*p: nidincasare
		*p: nidinchprod
		*p: nidinchreg
		*p: nid_norme_itp
		*p: nid_norme_spalare
		*p: nid_norme_spec
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 3
		ccasa = 
		cdenop1 = 
		cdenop2 = 
		csectie1 = 
		csectie2 = 
		DoCreate = .T.
		Height = 570
		Name = "optiuni_frm"
		nidarticol = 0
		nidbonfiscal = 0
		niddispplata = 0
		nidfactura = -1
		nidfacturaasig = 0
		nidincasare = -1
		nidinchprod = 0
		nidinchreg = -1
		nid_norme_itp = -1
		nid_norme_spalare = -1
		nid_norme_spec = 0
		Width = 783
		_memberdata = <VFPData>

		</VFPData>
		_shape1.Height = 29
		_shape1.Left = 0
		_shape1.Name = "_shape1"
		_shape1.Top = 0
		_shape1.Width = 783
		_shape1.ZOrderSet = 1
		_shape2.Height = 29
		_shape2.Left = 720
		_shape2.Name = "_shape2"
		_shape2.Top = 0
		_shape2.Width = 36
		_shape2.ZOrderSet = 2
		Lb_titlu_alb_b121.Caption = "OPȚIUNI"
		Lb_titlu_alb_b121.FontBold = .T.
		Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
		Lb_titlu_alb_b121.TabIndex = 3
		Lb_titlu_alb_b121.ZOrderSet = 3
		BUT_TERMIN1.Anchor = 8
		BUT_TERMIN1.Left = 752
		BUT_TERMIN1.Name = "BUT_TERMIN1"
		BUT_TERMIN1.TabIndex = 2
		BUT_TERMIN1.Top = 1
		BUT_TERMIN1.ZOrderSet = 4
		Gridsort1.Name = "Gridsort1"
	*</PropValue>

	ADD OBJECT '_pgfrmbase1' AS _pgfrmbase WITH ;
		ErasePage = .T., ;
		Height = 516, ;
		Left = 12, ;
		Name = "_pgfrmbase1", ;
		PageCount = 3, ;
		TabIndex = 1, ;
		Top = 48, ;
		Width = 761, ;
		PAGE1.BackColor = 255,255,255, ;
		PAGE1.Caption = "Setări comenzi și facturare", ;
		PAGE1.Name = "PAGE1", ;
		PAGE2.BackColor = 255,255,255, ;
		PAGE2.Caption = "Setări manoperă", ;
		PAGE2.Name = "PAGE2", ;
		Page3.Caption = "Listare factura si alte setari", ;
		Page3.Name = "Page3"
		*< END OBJECT: ClassLib="..\comun\clase\_frm_base.vcx" BaseClass="pageframe" />

	ADD OBJECT '_pgfrmbase1.PAGE1._shape1' AS _shape WITH ;
		BackStyle = 0, ;
		Height = 136, ;
		Left = 7, ;
		Name = "_shape1", ;
		Top = 11, ;
		Width = 328, ;
		ZOrderSet = 2
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="shape" />

	ADD OBJECT '_pgfrmbase1.PAGE1._shape2' AS _shape WITH ;
		BackStyle = 0, ;
		Height = 222, ;
		Left = 6, ;
		Name = "_shape2", ;
		Top = 158, ;
		Width = 328, ;
		ZOrderSet = 1
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="shape" />

	ADD OBJECT '_pgfrmbase1.PAGE1._shape3' AS _shape WITH ;
		BackStyle = 0, ;
		Height = 220, ;
		Left = 351, ;
		Name = "_shape3", ;
		Top = 158, ;
		Width = 389, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="shape" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Cb_casa' AS cb_tx_simplu WITH ;
		Left = 11, ;
		Name = "Cb_casa", ;
		TabIndex = 5, ;
		Top = 169, ;
		ZOrderSet = 7, ;
		_CBBASE1.Name = "_CBBASE1", ;
		_CBBASE1.RowSource = "v_nom_casa.nume,id_part", ;
		_CBBASE1.RowSourceType = 6, ;
		_LBBASE1.Caption = "Casa", ;
		_LBBASE1.Left = 6, ;
		_LBBASE1.Name = "_LBBASE1", ;
		_LBBASE1.Top = 6
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Cb_sectie_itp' AS cb_tx_simplu WITH ;
		Left = 12, ;
		Name = "Cb_sectie_itp", ;
		TabIndex = 1, ;
		Top = 23, ;
		ZOrderSet = 3, ;
		_CBBASE1.Name = "_CBBASE1", ;
		_CBBASE1.RowSource = "v_sectii1.sectie,id_sectie", ;
		_CBBASE1.RowSourceType = 6, ;
		_LBBASE1.Caption = "Secție ITP", ;
		_LBBASE1.Name = "_LBBASE1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Cb_sectie_sp' AS cb_tx_simplu WITH ;
		Left = 12, ;
		Name = "Cb_sectie_sp", ;
		TabIndex = 3, ;
		Top = 79, ;
		ZOrderSet = 4, ;
		_CBBASE1.Name = "_CBBASE1", ;
		_CBBASE1.RowSource = "v_sectii2.sectie,id_sectie", ;
		_CBBASE1.RowSourceType = 6, ;
		_LBBASE1.Caption = "Secție spălare", ;
		_LBBASE1.Name = "_LBBASE1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pgfrmbase1.PAGE1.ct_articolcumulat' AS ct_clb_cautare WITH ;
		cconditie = 1=2, ;
		cprocedura = thisform.do_cauta_articol, ;
		Height = 31, ;
		Left = 10, ;
		Name = "ct_articolcumulat", ;
		TabIndex = 11, ;
		Top = 336, ;
		Width = 324, ;
		ZOrderSet = 25, ;
		img_cautare.Left = 297, ;
		img_cautare.Name = "img_cautare", ;
		img_cautare.Top = 5, ;
		clb_tx_cautare.Height = 29, ;
		clb_tx_cautare.Lb_simplu1.Caption = "Articol Reparatii", ;
		clb_tx_cautare.Lb_simplu1.Name = "Lb_simplu1", ;
		clb_tx_cautare.Lb_simplu1.ToolTipText = "Articolul Reparatii Auto care se va lista in loc de MATERIALE si MANOPERA pe factura.", ;
		clb_tx_cautare.Left = 1, ;
		clb_tx_cautare.Name = "clb_tx_cautare", ;
		clb_tx_cautare.Text_simplu1.Height = 23, ;
		clb_tx_cautare.Text_simplu1.Left = 101, ;
		clb_tx_cautare.Text_simplu1.Name = "Text_simplu1", ;
		clb_tx_cautare.Text_simplu1.Top = 3, ;
		clb_tx_cautare.Text_simplu1.Width = 184, ;
		clb_tx_cautare.Top = 1, ;
		clb_tx_cautare.Width = 290
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="container" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Ct_bonfiscal' AS ct_clb_cautare WITH ;
		cconditie = 1=2, ;
		clista_parametri = 7, ;
		cprocedura = thisform.do_cauta_fdoc, ;
		Height = 31, ;
		Left = 10, ;
		Name = "Ct_bonfiscal", ;
		TabIndex = 9, ;
		Top = 280, ;
		Width = 324, ;
		ZOrderSet = 25, ;
		img_cautare.Left = 297, ;
		img_cautare.Name = "img_cautare", ;
		img_cautare.Top = 5, ;
		clb_tx_cautare.Height = 29, ;
		clb_tx_cautare.Lb_simplu1.Caption = "Doc. bon fiscal", ;
		clb_tx_cautare.Lb_simplu1.Name = "Lb_simplu1", ;
		clb_tx_cautare.Left = 1, ;
		clb_tx_cautare.Name = "clb_tx_cautare", ;
		clb_tx_cautare.Text_simplu1.Left = 101, ;
		clb_tx_cautare.Text_simplu1.Name = "Text_simplu1", ;
		clb_tx_cautare.Text_simplu1.Top = 3, ;
		clb_tx_cautare.Top = 1, ;
		clb_tx_cautare.Width = 290
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="container" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Ct_clb_operatie_itp' AS ct_clb_cautare WITH ;
		cconditie = 1=2, ;
		clista_parametri = 1, ;
		cprocedura = thisform.do_cauta_operatie, ;
		Height = 31, ;
		Left = 11, ;
		Name = "Ct_clb_operatie_itp", ;
		TabIndex = 2, ;
		Top = 50, ;
		Width = 324, ;
		ZOrderSet = 24, ;
		img_cautare.Left = 297, ;
		img_cautare.Name = "img_cautare", ;
		img_cautare.Top = 5, ;
		clb_tx_cautare.Height = 29, ;
		clb_tx_cautare.Lb_simplu1.Caption = "Operație ITP", ;
		clb_tx_cautare.Lb_simplu1.Name = "Lb_simplu1", ;
		clb_tx_cautare.Left = 1, ;
		clb_tx_cautare.Name = "clb_tx_cautare", ;
		clb_tx_cautare.Text_simplu1.Left = 101, ;
		clb_tx_cautare.Text_simplu1.Name = "Text_simplu1", ;
		clb_tx_cautare.Text_simplu1.Top = 3, ;
		clb_tx_cautare.Top = 1, ;
		clb_tx_cautare.Width = 290
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="container" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Ct_clb_operatie_sp' AS ct_clb_cautare WITH ;
		cconditie = 1=2, ;
		clista_parametri = 2, ;
		cprocedura = thisform.do_cauta_operatie, ;
		Height = 31, ;
		Left = 11, ;
		Name = "Ct_clb_operatie_sp", ;
		TabIndex = 4, ;
		Top = 106, ;
		Width = 324, ;
		ZOrderSet = 25, ;
		img_cautare.Left = 297, ;
		img_cautare.Name = "img_cautare", ;
		img_cautare.Top = 5, ;
		clb_tx_cautare.Height = 29, ;
		clb_tx_cautare.Lb_simplu1.Caption = "Operație spălare", ;
		clb_tx_cautare.Lb_simplu1.Name = "Lb_simplu1", ;
		clb_tx_cautare.Left = 1, ;
		clb_tx_cautare.Name = "clb_tx_cautare", ;
		clb_tx_cautare.Text_simplu1.Left = 101, ;
		clb_tx_cautare.Text_simplu1.Name = "Text_simplu1", ;
		clb_tx_cautare.Text_simplu1.Top = 3, ;
		clb_tx_cautare.Top = 1, ;
		clb_tx_cautare.Width = 290
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="container" />

	ADD OBJECT '_pgfrmbase1.PAGE1.ct_disp_plata' AS ct_clb_cautare WITH ;
		cconditie = 1=2, ;
		clista_parametri = 5, ;
		cprocedura = thisform.do_cauta_fdoc, ;
		Height = 31, ;
		Left = 10, ;
		Name = "ct_disp_plata", ;
		TabIndex = 10, ;
		Top = 308, ;
		Width = 324, ;
		ZOrderSet = 25, ;
		IMG_CAUTARE.Left = 297, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		IMG_CAUTARE.Top = 5, ;
		CLB_TX_CAUTARE.Height = 29, ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Doc. disp. plată", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CLB_TX_CAUTARE.Left = 1, ;
		CLB_TX_CAUTARE.Name = "CLB_TX_CAUTARE", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Left = 101, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Top = 3, ;
		CLB_TX_CAUTARE.Top = 1, ;
		CLB_TX_CAUTARE.Width = 290
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="container" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Ct_factura' AS ct_clb_cautare WITH ;
		cconditie = 1=2, ;
		clista_parametri = 1, ;
		cprocedura = thisform.do_cauta_fdoc, ;
		Height = 31, ;
		Left = 10, ;
		Name = "Ct_factura", ;
		TabIndex = 6, ;
		Top = 196, ;
		Width = 324, ;
		ZOrderSet = 25, ;
		IMG_CAUTARE.Left = 297, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		IMG_CAUTARE.Top = 5, ;
		CLB_TX_CAUTARE.Height = 29, ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Doc.factură", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CLB_TX_CAUTARE.Left = 1, ;
		CLB_TX_CAUTARE.Name = "CLB_TX_CAUTARE", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Left = 101, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Top = 3, ;
		CLB_TX_CAUTARE.Top = 1, ;
		CLB_TX_CAUTARE.Width = 290
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="container" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Ct_facturaasig' AS ct_clb_cautare WITH ;
		cconditie = 1=2, ;
		clista_parametri = 6, ;
		cprocedura = thisform.do_cauta_fdoc, ;
		Height = 31, ;
		Left = 10, ;
		Name = "Ct_facturaasig", ;
		TabIndex = 7, ;
		Top = 224, ;
		Width = 324, ;
		ZOrderSet = 25, ;
		img_cautare.Left = 297, ;
		img_cautare.Name = "img_cautare", ;
		img_cautare.Top = 5, ;
		clb_tx_cautare.Height = 29, ;
		clb_tx_cautare.Lb_simplu1.Caption = "Doc.factură asig.", ;
		clb_tx_cautare.Lb_simplu1.Name = "Lb_simplu1", ;
		clb_tx_cautare.Left = 1, ;
		clb_tx_cautare.Name = "clb_tx_cautare", ;
		clb_tx_cautare.Text_simplu1.Left = 101, ;
		clb_tx_cautare.Text_simplu1.Name = "Text_simplu1", ;
		clb_tx_cautare.Text_simplu1.Top = 3, ;
		clb_tx_cautare.Top = 1, ;
		clb_tx_cautare.Width = 290
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="container" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Ct_incasare' AS ct_clb_cautare WITH ;
		cconditie = 1=2, ;
		clista_parametri = 2, ;
		cprocedura = thisform.do_cauta_fdoc, ;
		Height = 31, ;
		Left = 10, ;
		Name = "Ct_incasare", ;
		TabIndex = 8, ;
		Top = 252, ;
		Width = 324, ;
		ZOrderSet = 25, ;
		IMG_CAUTARE.Left = 297, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		IMG_CAUTARE.Top = 5, ;
		CLB_TX_CAUTARE.Height = 29, ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Doc. chitanță", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CLB_TX_CAUTARE.Left = 1, ;
		CLB_TX_CAUTARE.Name = "CLB_TX_CAUTARE", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Left = 101, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Top = 3, ;
		CLB_TX_CAUTARE.Top = 1, ;
		CLB_TX_CAUTARE.Width = 290
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="container" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Ct_inchprod' AS ct_clb_cautare WITH ;
		cconditie = 1=2, ;
		clista_parametri = 4, ;
		cprocedura = thisform.do_cauta_fdoc, ;
		Height = 31, ;
		Left = 359, ;
		Name = "Ct_inchprod", ;
		TabIndex = 13, ;
		Top = 336, ;
		Width = 372, ;
		ZOrderSet = 26, ;
		IMG_CAUTARE.Left = 346, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		IMG_CAUTARE.Top = 5, ;
		CLB_TX_CAUTARE.Height = 29, ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Doc. închidere com. prod.", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Left = 3, ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Top = 6, ;
		CLB_TX_CAUTARE.Left = 1, ;
		CLB_TX_CAUTARE.Name = "CLB_TX_CAUTARE", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Left = 144, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Top = 3, ;
		CLB_TX_CAUTARE.Top = 1, ;
		CLB_TX_CAUTARE.Width = 335
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="container" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Ct_inchreg' AS ct_clb_cautare WITH ;
		cconditie = 1=2, ;
		clista_parametri = 3, ;
		cprocedura = thisform.do_cauta_fdoc, ;
		Height = 31, ;
		Left = 359, ;
		Name = "Ct_inchreg", ;
		TabIndex = 12, ;
		Top = 308, ;
		Width = 372, ;
		ZOrderSet = 26, ;
		IMG_CAUTARE.Left = 346, ;
		IMG_CAUTARE.Name = "IMG_CAUTARE", ;
		IMG_CAUTARE.Top = 5, ;
		CLB_TX_CAUTARE.Height = 29, ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Caption = "Doc. închidere com. regie", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Left = 3, ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Name = "LB_SIMPLU1", ;
		CLB_TX_CAUTARE.LB_SIMPLU1.Top = 6, ;
		CLB_TX_CAUTARE.Left = 1, ;
		CLB_TX_CAUTARE.Name = "CLB_TX_CAUTARE", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Left = 144, ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Name = "TEXT_SIMPLU1", ;
		CLB_TX_CAUTARE.TEXT_SIMPLU1.Top = 3, ;
		CLB_TX_CAUTARE.Top = 1, ;
		CLB_TX_CAUTARE.Width = 335
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="container" />

	ADD OBJECT '_pgfrmbase1.PAGE1.lb_constatare' AS lb_simplu WITH ;
		Caption = "Inchidere com. constatare", ;
		Left = 359, ;
		Name = "lb_constatare", ;
		TabIndex = 21, ;
		Top = 246, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.PAGE1.lb_constatare_validare' AS lb_simplu WITH ;
		Caption = "Validare", ;
		FontBold = .T., ;
		Left = 536, ;
		Name = "lb_constatare_validare", ;
		TabIndex = 21, ;
		Top = 246, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Lb_explicatie1' AS lb_simplu WITH ;
		BackColor = 255,255,255, ;
		BackStyle = 1, ;
		Caption = "Setări secții și operații facturare", ;
		Left = 14, ;
		Name = "Lb_explicatie1", ;
		TabIndex = 19, ;
		Top = 3, ;
		ZOrderSet = 8
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Lb_explicatie2' AS lb_simplu WITH ;
		BackColor = 255,255,255, ;
		BackStyle = 1, ;
		Caption = "Setări facturare", ;
		Left = 13, ;
		Name = "Lb_explicatie2", ;
		TabIndex = 17, ;
		Top = 150, ;
		ZOrderSet = 16
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Lb_explicatie3' AS lb_simplu WITH ;
		BackColor = 255,255,255, ;
		BackStyle = 1, ;
		Caption = "Setări comenzi", ;
		Left = 361, ;
		Name = "Lb_explicatie3", ;
		TabIndex = 18, ;
		Top = 150, ;
		ZOrderSet = 27
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.PAGE1.lb_garantie' AS lb_simplu WITH ;
		Caption = "Inchidere com. garantie", ;
		Left = 359, ;
		Name = "lb_garantie", ;
		TabIndex = 21, ;
		Top = 188, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.PAGE1.lb_garantie_facturare' AS lb_simplu WITH ;
		Caption = "Facturare", ;
		FontBold = .T., ;
		Left = 536, ;
		Name = "lb_garantie_facturare", ;
		TabIndex = 21, ;
		Top = 188, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.PAGE1.lb_postgarantie' AS lb_simplu WITH ;
		Caption = "Inchidere com. post-garantie", ;
		Left = 359, ;
		Name = "lb_postgarantie", ;
		TabIndex = 21, ;
		Top = 170, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.PAGE1.lb_postgarantie_facturare' AS lb_simplu WITH ;
		Caption = "Facturare", ;
		FontBold = .T., ;
		Left = 536, ;
		Name = "lb_postgarantie_facturare", ;
		TabIndex = 21, ;
		Top = 170, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.PAGE1.lb_productie' AS lb_simplu WITH ;
		Caption = "Inchidere com. productie", ;
		Left = 359, ;
		Name = "lb_productie", ;
		TabIndex = 21, ;
		Top = 227, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.PAGE1.lb_regie' AS lb_simplu WITH ;
		Caption = "Inchidere com. regie", ;
		Left = 359, ;
		Name = "lb_regie", ;
		TabIndex = 21, ;
		Top = 207, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Lb_simplu10' AS lb_simplu WITH ;
		Caption = "Este obligatoriu CUI/CNP la introducerea clientilor?", ;
		Left = 347, ;
		Name = "Lb_simplu10", ;
		TabIndex = 21, ;
		Top = 92, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Lb_simplu6' AS lb_simplu WITH ;
		Caption = "La discount factură deviz se folosește contul:", ;
		Left = 347, ;
		Name = "Lb_simplu6", ;
		TabIndex = 20, ;
		Top = 51, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.PAGE1.Lb_simplu7' AS lb_simplu WITH ;
		Caption = "La avans materiale se folosește contul:", ;
		Left = 347, ;
		Name = "Lb_simplu7", ;
		TabIndex = 22, ;
		Top = 11, ;
		ZOrderSet = 9
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.PAGE1.opt_avans' AS _optiongrup WITH ;
		BorderStyle = 0, ;
		Height = 27, ;
		Left = 347, ;
		Name = "opt_avans", ;
		TabIndex = 14, ;
		Top = 24, ;
		Width = 128, ;
		ZOrderSet = 20, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "419", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "707", ;
		Option2.Left = 84, ;
		Option2.Name = "Option2", ;
		Option2.Top = 5
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_pgfrmbase1.PAGE1.opt_cui' AS _optiongrup WITH ;
		BorderStyle = 0, ;
		Height = 27, ;
		Left = 347, ;
		Name = "opt_cui", ;
		TabIndex = 16, ;
		Top = 107, ;
		Value = 2, ;
		Width = 123, ;
		ZOrderSet = 21, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Da", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option1.Value = 0, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Nu", ;
		Option2.Left = 84, ;
		Option2.Name = "Option2", ;
		Option2.Top = 5, ;
		Option2.Value = 1
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_pgfrmbase1.PAGE1.opt_discount' AS _optiongrup WITH ;
		BorderStyle = 0, ;
		Height = 27, ;
		Left = 347, ;
		Name = "opt_discount", ;
		TabIndex = 15, ;
		Top = 66, ;
		Width = 128, ;
		ZOrderSet = 21, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "4111", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "667", ;
		Option2.Left = 84, ;
		Option2.Name = "Option2", ;
		Option2.Top = 5
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_pgfrmbase1.PAGE1.opt_productie' AS _optiongrup WITH ;
		AutoSize = .T., ;
		BorderStyle = 0, ;
		Height = 27, ;
		Left = 530, ;
		Name = "opt_productie", ;
		TabIndex = 16, ;
		Top = 223, ;
		Value = 2, ;
		Width = 196, ;
		ZOrderSet = 21, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Validare", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option1.Value = 0, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Nota inchidere", ;
		Option2.Left = 93, ;
		Option2.Name = "Option2", ;
		Option2.Top = 5, ;
		Option2.Value = 1
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_pgfrmbase1.PAGE1.opt_regie' AS _optiongrup WITH ;
		AutoSize = .T., ;
		BorderStyle = 0, ;
		Height = 27, ;
		Left = 530, ;
		Name = "opt_regie", ;
		TabIndex = 16, ;
		Top = 203, ;
		Value = 2, ;
		Width = 196, ;
		ZOrderSet = 21, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Validare", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option1.Value = 0, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Nota inchidere", ;
		Option2.Left = 93, ;
		Option2.Name = "Option2", ;
		Option2.Top = 5, ;
		Option2.Value = 1
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_pgfrmbase1.PAGE2._shape3' AS _shape WITH ;
		BackStyle = 0, ;
		Height = 49, ;
		Left = 17, ;
		Name = "_shape3", ;
		Top = 91, ;
		Width = 390, ;
		ZOrderSet = 0
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="shape" />

	ADD OBJECT '_pgfrmbase1.PAGE2.Clb_coef_man' AS clb_tx_simplu WITH ;
		Left = 22, ;
		Name = "Clb_coef_man", ;
		TabIndex = 1, ;
		Top = 14, ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = "99.999", ;
		Text_simplu1.Left = 229, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 56, ;
		Lb_simplu1.Caption = "Coeficient brut manoperă", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pgfrmbase1.PAGE2.Clb_coef_man_regie' AS clb_tx_simplu WITH ;
		Left = 22, ;
		Name = "Clb_coef_man_regie", ;
		TabIndex = 2, ;
		Top = 42, ;
		Text_simplu1.Height = 23, ;
		Text_simplu1.InputMask = "99.999", ;
		Text_simplu1.Left = 229, ;
		Text_simplu1.Name = "Text_simplu1", ;
		Text_simplu1.Top = 3, ;
		Text_simplu1.Width = 56, ;
		Lb_simplu1.Caption = "Coeficient brut regie", ;
		Lb_simplu1.Name = "Lb_simplu1"
		*< END OBJECT: ClassLib="..\comun\clase\lb_tx.vcx" BaseClass="container" />

	ADD OBJECT '_pgfrmbase1.PAGE2.Ct_manoperaspec' AS ct_clb_cautare WITH ;
		cconditie = 1=2, ;
		clista_parametri = 3, ;
		cprocedura = thisform.do_cauta_operatie, ;
		Height = 31, ;
		Left = 22, ;
		Name = "Ct_manoperaspec", ;
		TabIndex = 3, ;
		Top = 102, ;
		Width = 384, ;
		ZOrderSet = 26, ;
		img_cautare.Left = 356, ;
		img_cautare.Name = "img_cautare", ;
		img_cautare.Top = 5, ;
		clb_tx_cautare.Height = 29, ;
		clb_tx_cautare.Lb_simplu1.Caption = "Operație manoperă specială", ;
		clb_tx_cautare.Lb_simplu1.Left = 3, ;
		clb_tx_cautare.Lb_simplu1.Name = "Lb_simplu1", ;
		clb_tx_cautare.Lb_simplu1.Top = 6, ;
		clb_tx_cautare.Left = 1, ;
		clb_tx_cautare.Name = "clb_tx_cautare", ;
		clb_tx_cautare.Text_simplu1.Left = 160, ;
		clb_tx_cautare.Text_simplu1.Name = "Text_simplu1", ;
		clb_tx_cautare.Text_simplu1.Top = 3, ;
		clb_tx_cautare.Top = 1, ;
		clb_tx_cautare.Width = 347
		*< END OBJECT: ClassLib="..\comun\clase\caut_ora.vcx" BaseClass="container" />

	ADD OBJECT '_pgfrmbase1.PAGE2.Lb_explicatie1' AS lb_simplu WITH ;
		BackStyle = 1, ;
		Caption = "Setări raport facturi pe secții", ;
		Left = 27, ;
		Name = "Lb_explicatie1", ;
		TabIndex = 4, ;
		Top = 83, ;
		ZOrderSet = 27
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.Page3.Lb_simplu11' AS lb_simplu WITH ;
		Caption = "Se afiseaza CNP persoane fizice in factura?", ;
		Left = 347, ;
		Name = "Lb_simplu11", ;
		TabIndex = 15, ;
		Top = 88, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.Page3.Lb_simplu12' AS lb_simplu WITH ;
		Caption = "Text subsol factura (maxim 5 linii)", ;
		Height = 17, ;
		Left = 11, ;
		Name = "Lb_simplu12", ;
		TabIndex = 17, ;
		Top = 181, ;
		Width = 185, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.Page3.Lb_simplu2' AS lb_simplu WITH ;
		Caption = "Se folosesc formulare tipizate pentru precomenzi?", ;
		Left = 11, ;
		Name = "Lb_simplu2", ;
		TabIndex = 19, ;
		Top = 6, ;
		ZOrderSet = 12
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.Page3.Lb_simplu3' AS lb_simplu WITH ;
		Caption = "Formularele personalizate de facturi sunt cu chitanță?", ;
		Left = 11, ;
		Name = "Lb_simplu3", ;
		TabIndex = 20, ;
		Top = 130, ;
		ZOrderSet = 14
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.Page3.Lb_simplu4' AS lb_simplu WITH ;
		Caption = "Se folosesc formulare tipizate pentru facturi?", ;
		Left = 11, ;
		Name = "Lb_simplu4", ;
		TabIndex = 18, ;
		Top = 47, ;
		ZOrderSet = 12
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.Page3.Lb_simplu5' AS lb_simplu WITH ;
		Caption = "Certificatul de garanție trebuie completat pe factură?", ;
		Left = 347, ;
		Name = "Lb_simplu5", ;
		TabIndex = 13, ;
		Top = 6, ;
		ZOrderSet = 17
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.Page3.Lb_simplu8' AS lb_simplu WITH ;
		Caption = "Pe bonul fiscal, materialele se listează detaliat :", ;
		Left = 347, ;
		Name = "Lb_simplu8", ;
		TabIndex = 16, ;
		Top = 47, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.Page3.Lb_simplu9' AS lb_simplu WITH ;
		Caption = "Alegeți formatul implicit pentru facturile netipizate :", ;
		Left = 11, ;
		Name = "Lb_simplu9", ;
		TabIndex = 14, ;
		Top = 88, ;
		ZOrderSet = 19
		*< END OBJECT: ClassLib="..\comun\clase\lb.vcx" BaseClass="label" />

	ADD OBJECT '_pgfrmbase1.Page3.opt_bondetmat' AS _optiongrup WITH ;
		BorderStyle = 0, ;
		Height = 27, ;
		Left = 347, ;
		Name = "opt_bondetmat", ;
		TabIndex = 6, ;
		Top = 61, ;
		Value = 2, ;
		Width = 123, ;
		ZOrderSet = 21, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Da", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option1.Value = 0, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Nu", ;
		Option2.Left = 84, ;
		Option2.Name = "Option2", ;
		Option2.Top = 5, ;
		Option2.Value = 1
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_pgfrmbase1.Page3.opt_cgarantie' AS _optiongrup WITH ;
		BorderStyle = 0, ;
		Height = 27, ;
		Left = 347, ;
		Name = "opt_cgarantie", ;
		TabIndex = 5, ;
		Top = 19, ;
		Width = 123, ;
		ZOrderSet = 18, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Da", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Nu", ;
		Option2.Left = 84, ;
		Option2.Name = "Option2", ;
		Option2.Top = 5
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_pgfrmbase1.Page3.opt_cnp' AS _optiongrup WITH ;
		BorderStyle = 0, ;
		Height = 27, ;
		Left = 347, ;
		Name = "opt_cnp", ;
		TabIndex = 7, ;
		Top = 103, ;
		Value = 2, ;
		Width = 123, ;
		ZOrderSet = 21, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Da", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option1.Value = 0, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Nu", ;
		Option2.Left = 84, ;
		Option2.Name = "Option2", ;
		Option2.Top = 5, ;
		Option2.Value = 1
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_pgfrmbase1.Page3.opt_factlinii' AS _optiongrup WITH ;
		BorderStyle = 0, ;
		Height = 27, ;
		Left = 11, ;
		Name = "opt_factlinii", ;
		TabIndex = 2, ;
		Top = 61, ;
		Width = 123, ;
		ZOrderSet = 13, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Da", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Nu", ;
		Option2.Left = 84, ;
		Option2.Name = "Option2", ;
		Option2.Top = 5
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_pgfrmbase1.Page3.opt_facturi' AS _optiongrup WITH ;
		AutoSize = .F., ;
		BorderStyle = 0, ;
		ButtonCount = 3, ;
		Height = 27, ;
		Left = 11, ;
		Name = "opt_facturi", ;
		TabIndex = 4, ;
		Top = 143, ;
		Width = 186, ;
		ZOrderSet = 15, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Da", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.TabIndex = 1, ;
		Option1.Top = 5, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Nu", ;
		Option2.Left = 60, ;
		Option2.Name = "Option2", ;
		Option2.TabIndex = 2, ;
		Option2.Top = 5, ;
		Option3.AutoSize = .T., ;
		Option3.BackStyle = 0, ;
		Option3.Caption = "După caz", ;
		Option3.FontCharSet = 238, ;
		Option3.Height = 17, ;
		Option3.Left = 112, ;
		Option3.Name = "Option3", ;
		Option3.Top = 5, ;
		Option3.Width = 69
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_pgfrmbase1.Page3.opt_formatfactura' AS _optiongrup WITH ;
		BorderStyle = 0, ;
		ButtonCount = 3, ;
		Height = 27, ;
		Left = 11, ;
		Name = "opt_formatfactura", ;
		TabIndex = 3, ;
		Top = 103, ;
		Value = 1, ;
		Width = 150, ;
		ZOrderSet = 21, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "A4", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.TabIndex = 1, ;
		Option1.Top = 5, ;
		Option1.Value = 1, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "A5", ;
		Option2.Left = 45, ;
		Option2.Name = "Option2", ;
		Option2.TabIndex = 2, ;
		Option2.Top = 5, ;
		Option2.Value = 0, ;
		Option3.BackStyle = 0, ;
		Option3.Caption = "A4 și A5", ;
		Option3.FontCharSet = 238, ;
		Option3.Height = 17, ;
		Option3.Left = 84, ;
		Option3.Name = "Option3", ;
		Option3.TabIndex = 3, ;
		Option3.Top = 5, ;
		Option3.Width = 61
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_pgfrmbase1.Page3.opt_precomenzi' AS _optiongrup WITH ;
		BorderStyle = 0, ;
		Height = 27, ;
		Left = 11, ;
		Name = "opt_precomenzi", ;
		TabIndex = 1, ;
		Top = 19, ;
		Width = 123, ;
		ZOrderSet = 13, ;
		Option1.AutoSize = .T., ;
		Option1.Caption = "Da", ;
		Option1.Left = 5, ;
		Option1.Name = "Option1", ;
		Option1.Top = 5, ;
		Option2.AutoSize = .T., ;
		Option2.Caption = "Nu", ;
		Option2.Left = 84, ;
		Option2.Name = "Option2", ;
		Option2.Top = 5
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="optiongroup" />

	ADD OBJECT '_pgfrmbase1.Page3.txtFooterFact1' AS _textbox WITH ;
		Height = 23, ;
		Left = 13, ;
		MaxLength = 250, ;
		Name = "txtFooterFact1", ;
		TabIndex = 8, ;
		Top = 199, ;
		Width = 620
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT '_pgfrmbase1.Page3.txtFooterFact2' AS _textbox WITH ;
		Height = 23, ;
		Left = 13, ;
		MaxLength = 250, ;
		Name = "txtFooterFact2", ;
		TabIndex = 9, ;
		Top = 221, ;
		Width = 620
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT '_pgfrmbase1.Page3.txtFooterFact3' AS _textbox WITH ;
		Height = 23, ;
		Left = 13, ;
		MaxLength = 250, ;
		Name = "txtFooterFact3", ;
		TabIndex = 10, ;
		Top = 243, ;
		Width = 620
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT '_pgfrmbase1.Page3.txtFooterFact4' AS _textbox WITH ;
		Height = 23, ;
		Left = 13, ;
		MaxLength = 250, ;
		Name = "txtFooterFact4", ;
		TabIndex = 11, ;
		Top = 265, ;
		Width = 620
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT '_pgfrmbase1.Page3.txtFooterFact5' AS _textbox WITH ;
		Height = 23, ;
		Left = 13, ;
		MaxLength = 250, ;
		Name = "txtFooterFact5", ;
		TabIndex = 12, ;
		Top = 287, ;
		Width = 620
		*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="textbox" />

	ADD OBJECT 'But_renunt1' AS but_renunt WITH ;
		Left = 720, ;
		Name = "But_renunt1", ;
		TabIndex = 4, ;
		Top = 1
		*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />
	
	PROCEDURE Destroy
		Use In v_sectii1
		Use In v_sectii2
		Use In v_nom_casa
	ENDPROC

	PROCEDURE do_cauta_articol
		Lparameters tnTip
		Local loCauta, lcXMLArticole
		loCauta = NULL
		lcXMLArticole = cauta_nom_articole([denumire like 'REPARATII AUTO%'])
		lcCursorArt = [crstmpart]
		SET STEP ON 
		If gnButon = 1
			Xmltocursor(m.lcXMLArticole, m.lcCursorArt)
			Select (m.lcCursorArt)
			GO TOP 
			Scatter Name loCauta
		ENDIF 	
		USE IN (SELECT(m.lcCursorArt))
			
		If !Isnull(loCauta)
			Thisform.nIdArticol = loCauta.id_articol
			Thisform._pgfrmbase1.page1.ct_articolcumulat.clb_tx_cautare.text_simplu1.value = NVL(loCauta.denumire, '')
		ENDIF
		
		
					
	ENDPROC

	PROCEDURE do_cauta_fdoc
		Lparameters tnTip
		Local loCauta
		loCauta = caut_fdoc()
		If !Isnull(loCauta) And !Empty(loCauta.id_fdoc)
			Do Case
			Case tnTip = 1
				Thisform.nidfactura = loCauta.id_fdoc
				Thisform._pgfrmbase1.page1.ct_factura.clB_TX_CAUTARE.texT_SIMPLU1.Value = loCauta.fel_document
			Case tnTip = 2
				Thisform.nidincasare = loCauta.id_fdoc
				Thisform._pgfrmbase1.page1.ct_incasare.clB_TX_CAUTARE.texT_SIMPLU1.Value = loCauta.fel_document
			Case tnTip = 3
				Thisform.nidinchreg = loCauta.id_fdoc
				Thisform._pgfrmbase1.page1.ct_inchreg.clB_TX_CAUTARE.texT_SIMPLU1.Value = loCauta.fel_document
			Case tnTip = 4
				Thisform.nidinchprod = loCauta.id_fdoc
				Thisform._pgfrmbase1.page1.ct_inchprod.clB_TX_CAUTARE.texT_SIMPLU1.Value = loCauta.fel_document
			CASE tnTip = 5
				Thisform.niddispplata = loCauta.id_fdoc
				Thisform._pgfrmbase1.page1.ct_disp_plata.clb_TX_CAUTARE.teXT_SIMPLU1.Value = loCauta.fel_document
			Case tnTip = 6
				Thisform.nidfacturaasig = loCauta.id_fdoc
				Thisform._pgfrmbase1.page1.ct_facturaasig.clB_TX_CAUTARE.texT_SIMPLU1.Value = loCauta.fel_document
		*!*	modificare v 2.0.29
			CASE tnTip = 7
				Thisform.nidbonfiscal = loCauta.id_fdoc
				Thisform._pgfrmbase1.page1.ct_bonfiscal.clb_tx_cautare.text_simplu1.value = loCauta.fel_document
		*!*	modificare v 2.0.29	^
			Otherwise
				amessagebox("Eroare la copierea optiunii!",0+16,"Eroare")
			Endcase
		Endif
	ENDPROC

	PROCEDURE do_cauta_operatie
		Lparameters tnTip
		Local loCauta
		loCauta = caut_norme()
		If !Isnull(loCauta) And !Empty(loCauta.id_norme)
			Do Case
			Case tnTip = 1
				Thisform.nid_norme_itp = loCauta.id_norme
				Thisform._pgfrmbase1.page1.ct_clb_operatie_itp.clb_tx_cautare.text_simplu1.Value = Alltrim(loCauta.denop)
			Case tnTip = 2
				Thisform.nid_norme_spalare = loCauta.id_norme
				Thisform._pgfrmbase1.page1.ct_clb_operatie_sp.clb_tx_cautare.text_simplu1.Value = Alltrim(loCauta.denop)
			Case tnTip = 3
				Thisform.nid_norme_spec = loCauta.id_norme
				Thisform._pgfrmbase1.page2.ct_manoperaspec.clb_tx_cautare.text_simplu1.Value = Alltrim(loCauta.denop)
			Otherwise
				amessagebox("Eroare la copierea optiunii!",0+16,"Eroare")
			Endcase
		Endif
		
	ENDPROC

	PROCEDURE inainte_de_do_termin
		*!* 02.03.2016
		*!* marius.mutu
		*!* + optiune glCuiClientObligatoriu
		
		*!* 19.11.2018
		*!* marius.mutu
		*!* + optiune gnCNPFactura, gcTextFooterFact1..5
		
		Local lcSql,lcOptiuni,lcValori,lnIdSectieITP,lnIdSectieSp,lnIdDenopITP,lnIdDenopSp,lnIdNormeSpec, lnIdArticolReparatii, llSucces
		Local lnCNPFactura
		Local lnInchidereValidareProductie, lnInchidereValidareRegie, lcSeparator, llAutoBonDet
		Local llCuiClientObligatoriu, lnCoefMan, lnCoefManReg, lnFormatFactura, lnIdBonFiscal, lnIdCasa
		Local lnIdFactura, lnIdFacturaAsig, lnIdIncasare, lnIdInchProd, lnIdInchReg, lnIdNormeITP
		Local lnIdNormeSp, lnSucces
		*:Global gcTextFooterFact1, gcTextFooterFact2, gcTextFooterFact3, gcTextFooterFact4
		*:Global gcTextFooterFact5, glAutoBonDet, glCuiClientObligatoriu, gnAUTOIdArticolReparatii
		*:Global gnAvans419, gnCNPFactura, gnCgarantie, gnCoefMan, gnCoefManReg, gnDiscount411
		*:Global gnFormatFactura, gnTip_LFactura, gnTip_LFactura_Linii, gnTip_LPrecomanda, gnid_casa_achit
		*:Global gnid_fdoc_bonfiscal, gnid_fdoc_chitanta, gnid_fdoc_dispplata, gnid_fdoc_fact
		*:Global gnid_fdoc_factasig, gnid_fdoc_inchprod, gnid_fdoc_inchreg, gnid_norme_itp
		*:Global gnid_norme_spalare, gnid_norme_spec, gnid_sectie_itp, gnid_sectie_spalare
		
		
		llSucces = .T.
		lcOptiuni = []
		lcValori = []
		lcSeparator = [|]
		lnIdSectieITP = v_sectii1.id_sectie
		lnIdSectieSp = v_sectii2.id_sectie
		lnIdNormeITP = Thisform.nid_norme_itp
		lnIdNormeSp = Thisform.nid_norme_spalare
		lnIdNormeSpec = Thisform.nid_norme_spec
		lnIdCasa = v_nom_casa.id_part
		lnCoefMan = Thisform._pgfrmbase1.page2.Clb_coef_man.text_simplu1.Value
		lnCoefManReg = Thisform._pgfrmbase1.page2.clb_coef_man_regie.text_simplu1.Value
		lnIdFactura = Nvl(Thisform.nidfactura,-1)
		lnIdFacturaAsig = Nvl(Thisform.nidfacturaasig,-1)
		lnIdIncasare = Nvl(Thisform.nidincasare,-1)
		lnIdInchReg = Nvl(Thisform.nidinchreg,-1)
		lnIdInchProd = Nvl(Thisform.nidinchprod,-1)
		
		
		With Thisform._pgfrmbase1.page1
			lnIdArticolReparatii = Nvl(Thisform.nIdarticol, 0)
			If lnIdArticolReparatii != Nvl(m.gnAUTOIdArticolReparatii, 0)
				lcOptiuni = lcOptiuni + [AUTOIDARTICOLREPARATII] + lcSeparator
				lcValori = lcValori + Iif(Empty(m.lnIdArticolReparatii), '', Alltrim(Str(lnIdArticolReparatii))) + lcSeparator
			Endif
			If lnIdSectieITP!=Nvl(gnid_sectie_itp,-1) And Thisform.csectie1!=Alltrim(.cb_sectie_itp._cbbase1.Value)
				lcOptiuni = lcOptiuni + [ID_SECTIE_ITP] + lcSeparator
				lcValori = lcValori + Alltrim(Str(lnIdSectieITP)) + lcSeparator
			Endif
			If lnIdNormeITP!=Nvl(gnid_norme_itp,-1)
				lcOptiuni = lcOptiuni + [ID_NORME_ITP] + lcSeparator
				lcValori = lcValori + Alltrim(Str(lnIdNormeITP)) + lcSeparator
			Endif
			If lnIdSectieSp!=Nvl(gnid_sectie_spalare,-1) And Thisform.csectie2!=Alltrim(.cb_sectie_sp._cbbase1.Value)
				lcOptiuni = lcOptiuni + [ID_SECTIE_SPALARE] + lcSeparator
				lcValori = lcValori + Alltrim(Str(lnIdSectieSp)) + lcSeparator
			Endif
			If lnIdNormeSp!=Nvl(gnid_norme_spalare,-1)
				lcOptiuni = lcOptiuni + [ID_NORME_SPALARE] + lcSeparator
				lcValori = lcValori + Alltrim(Str(lnIdNormeSp)) + lcSeparator
			Endif
			If lnIdNormeSpec!=Nvl(gnid_norme_spec,-1)
				lcOptiuni = lcOptiuni + [ID_NORME_SPEC] + lcSeparator
				lcValori = lcValori + Alltrim(Str(lnIdNormeSpec)) + lcSeparator
			Endif
		
			If lnIdCasa!=Nvl(gnid_casa_achit,-1) And Thisform.ccasa!=Alltrim(.cb_casa._cbbase1.Value)
				lcOptiuni = lcOptiuni + [ID_CASA_ACHIT] + lcSeparator
				lcValori = lcValori + Alltrim(Str(lnIdCasa)) + lcSeparator
			Endif
		
			If lnIdFactura!=Nvl(gnid_fdoc_fact,-1)
				lcOptiuni = lcOptiuni + [ID_FDOC_FACT] + lcSeparator
				lcValori = lcValori + Alltrim(Str(lnIdFactura)) + lcSeparator
			Endif
			If lnIdFacturaAsig!=Nvl(gnid_fdoc_factasig,-1)
				lcOptiuni = lcOptiuni + [ID_FDOC_FACTASIG] + lcSeparator
				lcValori = lcValori + Alltrim(Str(lnIdFacturaAsig)) + lcSeparator
			Endif
		
			If lnIdIncasare!=Nvl(gnid_fdoc_chitanta,-1)
				lcOptiuni = lcOptiuni + [ID_FDOC_CHITANTA] + lcSeparator
				lcValori = lcValori + Alltrim(Str(lnIdIncasare)) + lcSeparator
			Endif
		
			lnIdBonFiscal = Nvl(Thisform.nidbonfiscal,-1)
			If lnIdBonFiscal!=Nvl(gnid_fdoc_bonfiscal,-1)
				lcOptiuni = lcOptiuni + [ID_FDOC_BONFISCAL] + lcSeparator
				lcValori = lcValori + Alltrim(Str(lnIdBonFiscal)) + lcSeparator
			Endif
		
			If Nvl(Thisform.niddispplata,-1)!=Nvl(gnid_fdoc_dispplata,-1)
				lcOptiuni = lcOptiuni + [ID_FDOC_DISPPLATA] + lcSeparator
				lcValori = lcValori + Alltrim(Str(Thisform.niddispplata)) + lcSeparator
			Endif
		
			If gnAvans419!=.opt_avans.Value
				lcOptiuni = lcOptiuni + [AVANS419] + lcSeparator
				lcValori = lcValori + Alltrim(Str(.opt_avans.Value)) + lcSeparator
			Endif
			If gnDiscount411!=.opt_discount.Value
				lcOptiuni = lcOptiuni + [DISCOUNT411] + lcSeparator
				lcValori = lcValori + Alltrim(Str(.opt_discount.Value)) + lcSeparator
			Endif
		
		
			If lnIdInchReg !=Nvl(gnid_fdoc_inchreg,-1)
				lcOptiuni = lcOptiuni + [ID_FDOC_INCHREG] + lcSeparator
				lcValori = lcValori + Alltrim(Str(lnIdInchReg)) + lcSeparator
			Endif
			If lnIdInchProd !=Nvl(gnid_fdoc_inchprod,-1)
				lcOptiuni = lcOptiuni + [ID_FDOC_INCHPROD] + lcSeparator
				lcValori = lcValori + Alltrim(Str(lnIdInchProd)) + lcSeparator
			Endif
			If lnCoefMan <> gnCoefMan
				lcOptiuni = lcOptiuni + [COEFMAN] + lcSeparator
				lcValori = lcValori + Alltrim(Str(lnCoefMan,8,3)) + lcSeparator
			Endif
			If lnCoefManReg <> gnCoefManReg
				lcOptiuni = lcOptiuni + [COEFMANREG] + lcSeparator
				lcValori = lcValori + Alltrim(Str(lnCoefManReg,8,3)) + lcSeparator
			Endif
		
			llCuiClientObligatoriu = Iif(.opt_cui.Value = 1, .T., .F.)
			If m.llCuiClientObligatoriu != m.glCuiClientObligatoriu
				lcOptiuni = lcOptiuni + [CUICLIENTOBLIGATORIU] + lcSeparator
				lcValori = lcValori + Iif(m.llCuiClientObligatoriu,[T],[F]) + lcSeparator
			Endif
		
		Endwith
		
		With Thisform._pgfrmbase1.page3
			If gnTip_LPrecomanda!=.opt_precomenzi.Value
				lcOptiuni = lcOptiuni + [TIP_LPRECOMANDA] + lcSeparator
				lcValori = lcValori + Alltrim(Str(.opt_precomenzi.Value)) + lcSeparator
			Endif
			If gnTip_LFactura_Linii!=.opt_factlinii.Value
				lcOptiuni = lcOptiuni + [TIP_LFACTURA_LINII] + lcSeparator
				lcValori = lcValori + Alltrim(Str(.opt_factlinii.Value)) + lcSeparator
			Endif
		
			lnFormatFactura = .opt_formatfactura.Value
			If lnFormatFactura <> gnFormatFactura
				lcOptiuni = lcOptiuni + [FORMATFACTURA] + lcSeparator
				lcValori = lcValori + Alltrim(Str(lnFormatFactura )) + lcSeparator
			Endif
		
			If gnTip_LFactura!=.opt_facturi.Value
				lcOptiuni = lcOptiuni + [TIP_LFACTURA] + lcSeparator
				lcValori = lcValori + Alltrim(Str(.opt_facturi.Value)) + lcSeparator
			Endif
		
			If gnCgarantie!=.opt_cgarantie.Value
				lcOptiuni = lcOptiuni + [CGARANTIE] + lcSeparator
				lcValori = lcValori + Alltrim(Str(.opt_cgarantie.Value)) + lcSeparator
			ENDIF
		
			llAutoBonDet = Iif(.opt_bondetmat.Value=1,.T.,.F.)
			If llAutoBonDet!= glAutoBonDet
				lcOptiuni = lcOptiuni + [AUTOBONDET] + lcSeparator
				lcValori = lcValori + Iif(llAutoBonDet,[T],[F]) + lcSeparator
			Endif	
			
			lnCNPFactura = Iif(.opt_cnp.Value = 1, 1, 0)	
			If m.lnCNPFactura != m.gnCNPFactura
				lcOptiuni = lcOptiuni + [CNPFACTURA] + lcSeparator
				lcValori = lcValori + Iif(m.lnCNPFactura = 1,[1],[0]) + lcSeparator
			ENDIF
		
			If .txtFooterFact1.Value != NVL(m.gcTextFooterFact1, '')
				lcOptiuni = lcOptiuni + [TEXTFOOTERFACT1] + lcSeparator
				lcValori = lcValori + ALLTRIM(.txtFooterFact1.Value) + lcSeparator
			ENDIF
			If .txtFooterFact2.Value != NVL(m.gcTextFooterFact2, '')
				lcOptiuni = lcOptiuni + [TEXTFOOTERFACT2] + lcSeparator
				lcValori = lcValori + ALLTRIM(.txtFooterFact2.Value) + lcSeparator
			ENDIF
			If .txtFooterFact3.Value != NVL(m.gcTextFooterFact3, '')
				lcOptiuni = lcOptiuni + [TEXTFOOTERFACT3] + lcSeparator
				lcValori = lcValori + ALLTRIM(.txtFooterFact3.Value) + lcSeparator
			ENDIF
			If .txtFooterFact4.Value != NVL(m.gcTextFooterFact4, '')
				lcOptiuni = lcOptiuni + [TEXTFOOTERFACT4] + lcSeparator
				lcValori = lcValori + ALLTRIM(.txtFooterFact4.Value) + lcSeparator
			ENDIF
			If .txtFooterFact5.Value != NVL(m.gcTextFooterFact5, '')
				lcOptiuni = lcOptiuni + [TEXTFOOTERFACT5] + lcSeparator
				lcValori = lcValori + ALLTRIM(.txtFooterFact5.Value) + lcSeparator
			ENDIF			
		
		ENDWITH
		
		lnInchidereValidareRegie = IIF(this._pgfrmbase1.page1.opt_regie.Value = 1, 1, 0)
		lnInchidereValidareProductie = IIF(this._pgfrmbase1.page1.opt_productie.Value = 1, 1, 0)
		llModificareValidare = lnInchidereValidareRegie <> gnInchidereValidare3 or lnInchidereValidareProductie  <> gnInchidereValidare6
		
		If (!Empty(lcOptiuni) And !Empty(lcValori)) or m.llModificareValidare
			If amessagebox("Sunteti sigur ca doriti sa salvati modificarile facute?",4+32,"Confirmare")==6
				lcSql = [begin ]
				If (!Empty(lcOptiuni) And !Empty(lcValori))
					lcSql = lcSql + [actualizeaza_optiuni(?gcNumeProgram,'] + lcOptiuni + [','] + lcValori + [','] + lcSeparator +[');] 
				ENDIF 
				IF m.llModificareValidare
					lcSql = lcSql + [pack_auto.setOptiuneInchidere(3, ] + ALLTRIM(STR(m.lnInchidereValidareRegie)) + [);] + ;
					[pack_auto.setOptiuneInchidere(6, ] + ALLTRIM(STR(m.lnInchidereValidareProductie)) + [);]
				ENDIF 
				lcSql = lcSql + [ end;]
				
				llSucces = goExecutor.oExecuta(lcSql)
				IF m.llSucces
					amessagebox("Modificarile au fost salvate in baza de date!",0+48,"Info salvare optiuni")
					gnid_sectie_itp = lnIdSectieITP
					gnid_norme_itp = lnIdNormeITP
					gnid_sectie_spalare = lnIdSectieSp
					gnid_norme_spalare = lnIdNormeSp
					gnid_norme_spec = lnIdNormeSpec
		
					gnid_casa_achit = lnIdCasa
					gnid_fdoc_fact = Iif(lnIdFactura=-1,Null,lnIdFactura)
					gnid_fdoc_factasig = Iif(lnIdFacturaAsig=-1,Null,lnIdFacturaAsig)
					gnid_fdoc_chitanta = Iif(lnIdIncasare=-1,Null,lnIdIncasare)
					gnAvans419 = Thisform._pgfrmbase1.page1.opt_avans.Value
					gnDiscount411 = Thisform._pgfrmbase1.page1.opt_discount.Value
					gnCoefManReg = lnCoefManReg
					gnCoefMan = lnCoefMan
					gnid_fdoc_inchreg = Iif(lnIdInchReg=-1,Null,lnIdInchReg)
					gnid_fdoc_inchprod = Iif(lnIdInchProd=-1,Null,lnIdInchProd)
		
					glAutoBonDet = llAutoBonDet
					glCuiClientObligatoriu = m.llCuiClientObligatoriu
					gnid_fdoc_dispplata = This.niddispplata
		
					gnFormatFactura = lnFormatFactura
					gnid_fdoc_bonfiscal = Iif(lnIdBonFiscal=-1,Null,lnIdBonFiscal)
					gnAUTOIdArticolReparatii = m.lnIdArticolReparatii
					gnCNPFactura = m.lnCNPFactura 
					WITH Thisform._pgfrmbase1.page3
						gnTip_LPrecomanda = .opt_precomenzi.Value
						gnTip_LFactura = .opt_facturi.Value
						gnTip_LFactura_Linii = .opt_factlinii.Value
						gnCgarantie = .opt_cgarantie.Value				
						gcTextFooterFact1 = ALLTRIM(.txtFooterFact1.Value)
						gcTextFooterFact2 = ALLTRIM(.txtFooterFact2.Value)
						gcTextFooterFact3 = ALLTRIM(.txtFooterFact3.Value)
						gcTextFooterFact4 = ALLTRIM(.txtFooterFact4.Value)												
						gcTextFooterFact5 = ALLTRIM(.txtFooterFact5.Value)
					ENDWITH 
		
					gnInchidereValidare3 = m.lnInchidereValidareRegie
					gnInchidereValidare6 = m.lnInchidereValidareProductie	
		
				ENDIF && llSucces
			ENDIF
			
		Endif
		Return m.llSucces
		 
	ENDPROC

	PROCEDURE Init
		DoDefault()
		With Thisform._pgfrmbase1.page1
			Select v_sectii1
			Locate For id_sectie=gnid_sectie_itp
			If Found()
				Thisform.csectie1=Alltrim(sectie)
				.cb_sectie_itp._cBBASE1.Value=sectie
			Endif
		
			Select v_sectii2
			Locate For id_sectie=gnid_sectie_spalare
			If Found()
				Thisform.csectie2=Alltrim(sectie)
				.cb_sectie_sp._cBBASE1.Value=sectie
			Endif
		
			lcSql=[select id_articol, denumire from vnom_articole where id_articol = ?gnAUTOIdArticolReparatii]
			lnSucces=goExecutor.oExecute(lcSql,'crsoptArt')
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,0+16,'Eroare')
			Else
				Select crsoptArt
				IF RECCOUNT('crsoptArt') = 1
					Thisform.nIdarticol = id_articol
					Thisform._pgfrmbase1.page1.ct_articolcumulat.clb_tx_cautare.text_simplu1.Value = ALLTRIM(NVL(denumire, ''))
				Else
					Thisform.nIdarticol = Null
				ENDIF
				USE IN (SELECT('crsoptArt'))
			ENDIF 
				
			lcSql=[select id_norme,denop from ] + gcS + [.auto_vnorme where id_norme in (?gnid_norme_spalare,?gnid_norme_itp,?gnid_norme_spec)]
			lnSucces=goExecutor.oExecute(lcSql,'crsoptnorme')
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,0+16,'Eroare')
			Else
				Select crsoptnorme
				*!*	id_norme operatie spalare
				Locate For id_norme = Nvl(gnid_norme_spalare,0)
				If Found()
					Thisform.nid_norme_spalare = id_norme
					Thisform._pgfrmbase1.page1.ct_clb_operatie_sp.clb_tx_cautare.text_simplu1.Value = denop
				Else
					Thisform.nid_norme_spalare = Null
				Endif
				*!*	id_norme operatie ITP
				Locate For id_norme = Nvl(gnid_norme_itp,0)
				If Found()
					Thisform.nid_norme_itp = id_norme
					Thisform._pgfrmbase1.page1.ct_clb_operatie_itp.clb_tx_cautare.text_simplu1.Value = denop
				Else
					Thisform.nid_norme_itp = Null
				Endif
				*!*	id_norme operatie manopera speciala
				Locate For id_norme = Nvl(gnid_norme_spec,0)
				If Found()
					Thisform.nid_norme_spec = id_norme
					Thisform._pgfrmbase1.page2.ct_manoperaspec.clb_tx_cautare.text_simplu1.Value = denop
				Else
					Thisform.nid_norme_spec = Null
				Endif
				Use In crsoptnorme
			Endif
		
			Select v_nom_casa
			Locate For id_part=gnid_casa_achit
			If Found()
				Thisform.ccasa=Alltrim(nume)
				.cb_casa._cBBASE1.Value=nume
			Endif
		
		*!*	modificare	v 2.0.28 : am inlocuit gnid_fdoc_factura cu gnid_fdoc_fact si am adaugat gnid_fdoc_factasig
			lcSql=[select id_fdoc,fel_document from ] + gcS + [.vnom_fdoc where id_fdoc in (?gnid_fdoc_fact,?gnid_fdoc_factasig,?gnid_fdoc_chitanta,?gnid_fdoc_bonfiscal,?gnid_fdoc_inchreg,?gnid_fdoc_inchprod,?gnid_fdoc_dispplata)]
			&&	modificare v 2.0.29 : am inlocuit gnid_fdoc_incasare, am adaugat gnid_fdoc_bonfiscal
		*!*	modificare	v 2.0.28 ^
			lnSucces=goExecutor.oExecute(lcSql,'crsoptfdoc')
			If lnSucces < 0
				amessagebox(goExecutor.cEroare,0+16,'Eroare')
			Else
				Select crsoptfdoc
		*!*	modificare	v 2.0.28 : am inlocuit gnid_fdoc_factura cu gnid_fdoc_fact si am adaugat gnid_fdoc_factasig
				Locate For id_fdoc=gnid_fdoc_fact
				If Found()
					Thisform.nidfactura = id_fdoc
					.ct_factura.clb_tx_cautare.text_simplu1.Value = fel_document
				ENDIF
				
				Locate For id_fdoc=gnid_fdoc_factasig
				If Found()
					Thisform.nidfacturaasig = id_fdoc
					.ct_facturaasig.clb_tx_cautare.text_simplu1.Value = fel_document
				Endif
		*!*	modificare	v 2.0.28	^
				Locate For id_fdoc=gnid_fdoc_chitanta		&&	modificare v 2.0.29 : am inlocuit gnid_fdoc_incasare
				If Found()
					Thisform.nidincasare = id_fdoc
					.ct_incasare.clb_tx_cautare.text_simplu1.Value = fel_document
				Endif
				*!*	modificare	v 2.0.29
				Locate For id_fdoc = gnId_fdoc_bonfiscal
				If Found()
					Thisform.nidbonfiscal = id_fdoc
					.ct_bonfiscal.clb_tx_cautare.text_simplu1.Value = fel_document
				Endif
				*!*	modificare	v 2.0.29	^
				Locate For id_fdoc=gnid_fdoc_inchreg
				If Found()
					Thisform.nidinchreg = id_fdoc
					.ct_inchreg.clb_tx_cautare.text_simplu1.Value = fel_document
				Endif
		
				Locate For id_fdoc=gnid_fdoc_inchprod
				If Found()
					Thisform.nidinchprod = id_fdoc
					.ct_inchprod.clb_tx_cautare.text_simplu1.Value = fel_document
				Endif
		
				*!*	modificare v 2.0.21
				Locate For id_fdoc = gnid_fdoc_dispplata
				If Found()
					Thisform.niddispplata = id_fdoc
					.ct_disp_plata.clb_tx_cautare.text_simplu1.Value = fel_document
				Endif
				*!*	modificare	v 2.0.21	^
				Use In crsoptfdoc
			Endif
		
		
			.opt_avans.Value=gnAvans419
			.opt_discount.Value=gnDiscount411
			.opt_cui.Value = IIF(m.glCUIClientObligatoriu, 1, 2)	
		
		*!*	modificare	v 2.0.28
		*!*		.opt_atasamenteauto.Value = IIF(glAtasamenteAuto,1,2)
		*!*	modificare	v 2.0.28	^
		*!*		.opt_bonuri.Value=gnSerie_bf-1
		*!*		.opt_regie.Value=Iif(Nvl(gnDev_valregie,-1)<>1,2,1)
		Endwith
		With Thisform._pgfrmbase1.page2
			.clb_coef_man.text_simplu1.Value = gnCoefMan
			.clb_coef_man_regie.text_simplu1.Value = gnCoefManReg
		ENDWITH
		
		WITH Thisform._pgfrmbase1.page3
			.opt_precomenzi.Value=gnTip_LPrecomanda
			.opt_factlinii.Value=gnTip_LFactura_Linii	
			.opt_formatfactura.Value = gnFormatFactura	
			.opt_facturi.Value=gnTip_LFactura	
			.opt_cgarantie.Value=gnCgarantie	
			.opt_bondetmat.Value = IIF(m.glAutoBonDet,1,2)	
			.opt_cnp.Value = IIF(m.gnCNPFactura = 1, 1, 2)		
			.txtFooterFact1.value = ALLTRIM(NVL(m.gcTextFooterFact1, ''))
			.txtFooterFact2.value = ALLTRIM(NVL(m.gcTextFooterFact2, ''))
			.txtFooterFact3.value = ALLTRIM(NVL(m.gcTextFooterFact3, ''))
			.txtFooterFact4.value = ALLTRIM(NVL(m.gcTextFooterFact4, ''))
			.txtFooterFact5.value = ALLTRIM(NVL(m.gcTextFooterFact5, ''))
		ENDWITH 	
		
		* Inchidere prin validare comenzi regie si productie
		this._pgfrmbase1.page1.opt_regie.Value = IIF(m.gnInchidereValidare3 = 1, 1, 2)
		this._pgfrmbase1.page1.opt_productie.Value = IIF(m.gnInchidereValidare6 = 1, 1, 2)
	ENDPROC

	PROCEDURE Load
		If Used('v_sectii1')
			Use In v_sectii1
		Endif
		If Used('v_sectii2')
			Use In v_sectii2
		Endif
		Do ccsectii in update_devize.prg
		Select * From v_nom_sectii Into Cursor v_sectii1
		Select * From v_nom_sectii Into Cursor v_sectii2
		Use In v_nom_sectii
		
		If Used('v_nom_casa')
			Use In v_nom_casa
		Endif
		lcSql=[select id_part,nume from ] + gcS + [.vcoresp_tip_part where tip_partener='CASA LEI']
		lnSucces=goExecutor.oExecute(lcSql,'v_nom_casa')
		If lnSucces < 0
			amessagebox(goExecutor.cEroare,0+16,'Eroare')
		Endif
	ENDPROC

ENDDEFINE
