*--------------------------------------------------------------------------------------------------------------------------------------------------------
* (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!!
*--------------------------------------------------------------------------------------------------------------------------------------------------------
*< FOXBIN2PRG: Version="1.21" SourceFile="orapoarte_contabilitate.vcx" CPID="1250" /> (Solo para binarios VFP 9 / Only for VFP 9 binaries)
*
*
DEFINE CLASS frm_date_rap_balpart_temp 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="But_excel1" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="ed_explicatii_filtru" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="But_reset2" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="But_start_criterii1" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="_label1" UniqueID="" Timestamp="" />
*
BorderStyle = 1
DoCreate = .T.
Height = 302
Name = "frm_date_rap_balpart_temp"
Width = 562
_shape1.Height = 29
_shape1.Left = 0
_shape1.Name = "_shape1"
_shape1.Top = 0
_shape1.Width = 564
_shape2.Height = 29
_shape2.Left = 439
_shape2.Name = "_shape2"
_shape2.Top = 0
_shape2.Width = 125
Lb_titlu_alb_b121.Caption = "RAPORT BAZAT PE BALANTE PARTENERI"
Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
BUT_TERMIN1.Left = 533
BUT_TERMIN1.Name = "BUT_TERMIN1"
BUT_TERMIN1.Top = 1
Gridsort1.Name = "Gridsort1"
*
ADD OBJECT '_label1' AS _label WITH ;
Caption = "Alegeti criteriile de cautare (butonul binoclu) si apasati pe butonul Export XLS", ;
Left = 15, ;
Name = "_label1", ;
Top = 39
*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="label" />
ADD OBJECT 'But_excel1' AS but_excel WITH ;
Anchor = 9, ;
Left = 503, ;
Name = "But_excel1", ;
TabIndex = 6, ;
Top = 1, ;
ZOrderSet = 6
*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />
ADD OBJECT 'But_reset2' AS but_reset WITH ;
Anchor = 9, ;
caction = do_reset_filtru, ;
Left = 443, ;
Name = "But_reset2", ;
TabIndex = 9, ;
ToolTipText = "Reseteaza filtru", ;
Top = 1, ;
ZOrderSet = 14
*< END OBJECT: ClassLib="..\comun\clase\cmd_butoane.vcx" BaseClass="commandbutton" />
ADD OBJECT 'But_start_criterii1' AS but_start_criterii WITH ;
Anchor = 9, ;
lcautare = .F., ;
Left = 473, ;
Name = "But_start_criterii1", ;
TabIndex = 13, ;
Top = 1, ;
ZOrderSet = 15
*< END OBJECT: ClassLib="..\comun\clase\ocriterii.vcx" BaseClass="commandbutton" />
ADD OBJECT 'ed_explicatii_filtru' AS _editbox WITH ;
Anchor = 13, ;
ControlSource = "Thisform.filtru_pretty_ro", ;
Height = 228, ;
Left = 12, ;
Name = "ed_explicatii_filtru", ;
ReadOnly = .T., ;
TabIndex = 12, ;
Top = 60, ;
Width = 540, ;
ZOrderSet = 12
*< END OBJECT: ClassLib="..\comun\clase\_baza.vcx" BaseClass="editbox" />
PROCEDURE do_excel
Local lcFileName,lcSql,lcCursor, lcCursorExport, lnSucces, lcFiltruPerioada, lcCondSoldInitial
lcFileName = ""
lcCursor = [crsRaport]
lcCursorExport = [crsExport]
If Used(lcCursor)
Use In (lcCursor)
Endif
lcFiltru = [AND ] + Thisform.filtru_pretty + [ AND]
lnPozitie = 1
lcFiltruPerioada = []
Do While .T.
lcElement = Strextract(lcFiltru,[AND],[AND],lnPozitie)
If Empty(lcElement)
Exit
Endif
If Upper(Substr(Alltrim(lcElement),1,10)) = [AN*12+LUNA]
lcFiltruPerioada = lcFiltruPerioada + [ AND ] + lcElement
Endif
lnPozitie = lnPozitie + 1
ENDDO
IF EMPTY(m.lcFiltruPerioada)
AMESSAGEBOX('Completati perioada de raportare!',0+48,_screen.Caption)
RETURN
ENDIF
lcFiltruPerioada = Substr(lcFiltruPerioada,5)
lcSql = [select pivot_gen.build_sql_complex2('VRAPOARTE_BALPART',] + ;
['GROUPING_ID(CONT,ACONT,DENUMIRE,COD_FISCAL) AS GID,CONT,ACONT,DENUMIRE,COD_FISCAL',] + ;
['SUM(debit) as Rulaj_debitor,SUM(credit) as Rulaj_creditor,SUM(soldluna) as Diferenta_rulaje',] + ;
['LUNAAN',] + ;
['ANLUNA',] + ;
['soldinit',] + ;
['Sold_initial',] + ;
['debit|credit|soldluna|soldfinal|',] + ;
['Rulaj_debitor|Rulaj_creditor|Diferenta_rulaje|Sold_final',] + ;
[null,] + ;
[null,] + ;
['] + lcFiltruPerioada + [',] + ;
['SUM',] + ;
['0',] + ;
['1=2',] + ;
[0,] + ;
['ROLLUP(CONT,ACONT,(DENUMIRE,COD_FISCAL)) ',] + ;
['CONT,ACONT,GID,CONT,ACONT,DENUMIRE,COD_FISCAL',] + ;
['|') as sir_sql from dual]
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
If lnSucces < 0
amessagebox(goExecutor.cEroare,16,"Atentie")
Return
Else
If Reccount(lcCursor) > 0
Select (lcCursor)
lcSql = Alltrim(sir_sql)
Endif
Use In (lcCursor)
Endif
lcSql = Strtran(lcSql,[WHERE 1=2],Iif(!Empty(Thisform.filtru_pretty),[WHERE ] + Thisform.filtru_pretty + gcCondSucursala,;
[] + Substr(gcCondSucursala,5)))
lnSucces = goExecutor.oExecute(lcSql,lcCursor)
If lnSucces < 0
amessagebox(goExecutor.oPrelucrareEroare(),16,"Eroare")
Return
Endif
If Used(lcCursor) And Reccount(lcCursor)<>0
If Used(lcCursorExport)
Use In (lcCursorExport)
Endif
Dimension aColoane[1]
lcSelect = [SELECT Iif(gid<>0,'TOTAL',Space(5)) As explicatie]
Afields(aColoane,lcCursor)
lcColoaneFiltru = []
lnOptiune = aMessagebox("Doriti ca raportul sa includa si partenerii cu sold initial 0 si fara rulaje in perioada?",4+32,"Confirmare")
For i = 1 To Alen(aColoane,1)
If Upper(Alltrim(aColoane[i,1])) <> 'GID'
lcNumeColoana = Upper(Alltrim(aColoane[i,1]))
lcSelect = lcSelect + [,] + Iif(aColoane[i,2] = 'T', [TTOD(] + lcNumeColoana + [) as ] + ;
lcNumeColoana, lcNumeColoana)
If Between(i,6,9) And lnOptiune = 7
lcColoaneFiltru = lcColoaneFiltru + [ or ] + lcNumeColoana + [ <> 0]
Endif
Endif
Endfor
If !Empty(lcColoaneFiltru)
lcSelect = lcSelect + [ From ] + lcCursor + [ where gid=0 and (] + Substr(lcColoaneFiltru,4) + [) Into Cursor ] + lcCursorExport
Else
lcSelect = lcSelect + [ From ] + lcCursor + [ Into Cursor ] + lcCursorExport
Endif
&lcSelect
Endif
If Used(lcCursor)
Use In (lcCursor)
Endif
If Used(lcCursorExport)
lcFileName = strtranx([Raport bazat pe balante parteneri], "([^a-zA-Z0-9])", [_] )
export_xls(lcCursorExport, lcFileName)
Use In (lcCursorExport)
Else
amessagebox("Nu exista rezultate pentru export in Excel!",0+48,"Atentie")
Endif
ENDPROC
PROCEDURE But_start_criterii1.initform
Lparameters tlShowForm
DoDefault(tlShowForm)
Thisform.ed_explicatii_filtru.Refresh()
This.SetFocus()
ENDPROC
PROCEDURE But_start_criterii1.loadcriterii
Parameters tacriterii
External Array tacriterii
#Define crlf Chr(13)+Chr(10)
lcStringCriterii="Denumire\denumire\T\ID_PART\nom_parteneri" + crlf + ;
"Cont\cont\C\none\" + crlf + ;
"Analitic\acont\C\none\" + crlf + ;
"Perioada\an*12+luna\D1\none\"
DoDefault()
ENDPROC
ENDDEFINE
DEFINE CLASS frm_date_rapoarte_balpart AS frm_date_rapoarte_gen OF "..\comun\clase\orapoarte.vcx"
*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />
*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder
*< OBJECTDATA: ObjPath="Ct_selectie1.Ct_selectie_debit" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="Ct_selectie1.Ct_selectie_soldinit" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="Ct_selectie1.Ct_selectie_soldluna" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="Ct_selectie1.Ct_selectie_cod_fiscal" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="Ct_selectie1.Ct_selectie_denumire" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="Ct_selectie1.Ct_selectie_credit" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="Ct_selectie1.Ct_selectie_acont" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="Ct_selectie1.Ct_selectie_cont" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="Ct_selectie1.Ct_selectie_anluna" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="Ct_selectie1.Ct_selectie_soldfinal" UniqueID="" Timestamp="" />
*
BorderStyle = 1
ctitluraportinitial = Rapoarte bazate pe balante parteneri
DoCreate = .T.
Height = 572
Name = "frm_date_rapoarte_balpart"
nidformularraport = 3
Width = 696
_memberdata =
_shape1.Height = 29
_shape1.Left = 0
_shape1.Name = "_shape1"
_shape1.Top = 0
_shape1.Width = 696
_shape1.ZOrderSet = 2
_shape2.Height = 29
_shape2.Left = 604
_shape2.Name = "_shape2"
_shape2.Top = 0
_shape2.Width = 90
_shape2.ZOrderSet = 3
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 = 4
GRIDSORT1.Left = 480
GRIDSORT1.Name = "GRIDSORT1"
GRIDSORT1.Top = 36
BUT_TERMIN1.Name = "BUT_TERMIN1"
BUT_TERMIN1.TabIndex = 9
BUT_TERMIN1.ZOrderSet = 5
But_listare1.Name = "But_listare1"
But_listare1.TabIndex = 8
But_excel1.Name = "But_excel1"
But_excel1.TabIndex = 7
But_excel1.Visible = .T.
But_help1.Name = "But_help1"
But_help1.TabIndex = 2
But_cautare1.Name = "But_cautare1"
But_cautare1.TabIndex = 4
But_nou1.Name = "But_nou1"
But_nou1.TabIndex = 3
But_sterge1.Name = "But_sterge1"
But_sterge1.TabIndex = 6
Ct_selectie1.cnumetabela = vrapoarte_balpart
Ct_selectie1.Ct_grupare1.Height = 187
Ct_selectie1.Ct_grupare1.lblAtentie.Name = "lblAtentie"
Ct_selectie1.Ct_grupare1.lb_grupare.Name = "lb_grupare"
Ct_selectie1.Ct_grupare1.Left = 6
Ct_selectie1.Ct_grupare1.Name = "Ct_grupare1"
Ct_selectie1.Ct_grupare1.TabIndex = 9
Ct_selectie1.Ct_grupare1.Top = 331
Ct_selectie1.Ct_grupare1.Width = 360
Ct_selectie1.Ct_grupare1.ZOrderSet = 11
Ct_selectie1.Ct_grupare1._scrollcontainer1.But_jos1.Name = "But_jos1"
Ct_selectie1.Ct_grupare1._scrollcontainer1.But_sus1.Name = "But_sus1"
Ct_selectie1.Ct_grupare1._scrollcontainer1.Name = "_scrollcontainer1"
Ct_selectie1.Ct_ordonare1.Height = 176
Ct_selectie1.Ct_ordonare1.lb_ordonare.Name = "lb_ordonare"
Ct_selectie1.Ct_ordonare1.Left = 6
Ct_selectie1.Ct_ordonare1.Name = "Ct_ordonare1"
Ct_selectie1.Ct_ordonare1.TabIndex = 10
Ct_selectie1.Ct_ordonare1.Top = 156
Ct_selectie1.Ct_ordonare1.Width = 360
Ct_selectie1.Ct_ordonare1.ZOrderSet = 12
Ct_selectie1.Ct_ordonare1._scrollcontainer1.But_jos1.Name = "But_jos1"
Ct_selectie1.Ct_ordonare1._scrollcontainer1.But_sus1.Name = "But_sus1"
Ct_selectie1.Ct_ordonare1._scrollcontainer1.Name = "_scrollcontainer1"
Ct_selectie1.Height = 527
Ct_selectie1.lb_coloane.Name = "lb_coloane"
Ct_selectie1.lb_coloane.TabIndex = 11
Ct_selectie1.lb_coloane.ZOrderSet = 13
Ct_selectie1.Left = 12
Ct_selectie1.ltitlucoloanesuma = .T.
Ct_selectie1.Name = "Ct_selectie1"
Ct_selectie1.TabIndex = 1
Ct_selectie1.Top = 36
Ct_selectie1.Width = 372
ed_explicatii_filtru.Height = 500
ed_explicatii_filtru.Left = 396
ed_explicatii_filtru.Name = "ed_explicatii_filtru"
ed_explicatii_filtru.TabIndex = 11
ed_explicatii_filtru.Top = 63
ed_explicatii_filtru.Width = 288
But_salveaza1.lvizibil = .F.
But_salveaza1.Name = "But_salveaza1"
But_salveaza1.TabIndex = 5
But_reset2.Name = "But_reset2"
But_reset2.TabIndex = 10
LB_RAPORT_PREDEFINIT.Name = "LB_RAPORT_PREDEFINIT"
LB_RAPORT_PREDEFINIT.TabIndex = 13
But_start_criterii1.Name = "But_start_criterii1"
But_start_criterii1.TabIndex = 12
*
ADD OBJECT 'Ct_selectie1.Ct_selectie_acont' AS ct_selectie_camp WITH ;
ccamp = acont, ;
cnumecamp = Analitic, ;
Left = 2, ;
Name = "Ct_selectie_acont", ;
nid_container = 4, ;
TabIndex = 4, ;
Top = 56, ;
ZOrderSet = 9, ;
ck_camp.Alignment = 0, ;
ck_camp.Caption = "Analitic", ;
ck_camp.Name = "ck_camp"
*< END OBJECT: ClassLib="..\comun\clase\orapoarte.vcx" BaseClass="container" />
ADD OBJECT 'Ct_selectie1.Ct_selectie_anluna' AS ct_selectie_camp WITH ;
ccamp = anluna, ;
cidcamp = lunaan, ;
cnumecamp = Luna, ;
Height = 19, ;
Left = 2, ;
Name = "Ct_selectie_anluna", ;
nid_container = 5, ;
TabIndex = 5, ;
Top = 71, ;
Width = 140, ;
ZOrderSet = 20, ;
ck_camp.Alignment = 0, ;
ck_camp.Caption = "Luna", ;
ck_camp.Name = "ck_camp"
*< END OBJECT: ClassLib="..\comun\clase\orapoarte.vcx" BaseClass="container" />
ADD OBJECT 'Ct_selectie1.Ct_selectie_cod_fiscal' AS ct_selectie_camp WITH ;
ccamp = cod_fiscal, ;
cnumecamp = Cod fiscal, ;
Left = 2, ;
Name = "Ct_selectie_cod_fiscal", ;
nid_container = 2, ;
TabIndex = 2, ;
Top = 28, ;
ZOrderSet = 5, ;
ck_camp.Alignment = 0, ;
ck_camp.Caption = "Cod fiscal", ;
ck_camp.Name = "ck_camp"
*< END OBJECT: ClassLib="..\comun\clase\orapoarte.vcx" BaseClass="container" />
ADD OBJECT 'Ct_selectie1.Ct_selectie_cont' AS ct_selectie_camp WITH ;
ccamp = cont, ;
cnumecamp = Cont, ;
Height = 19, ;
Left = 2, ;
Name = "Ct_selectie_cont", ;
nid_container = 3, ;
TabIndex = 3, ;
Top = 42, ;
Width = 131, ;
ZOrderSet = 10, ;
ck_camp.Alignment = 0, ;
ck_camp.AutoSize = .T., ;
ck_camp.Caption = "Cont", ;
ck_camp.Name = "ck_camp"
*< END OBJECT: ClassLib="..\comun\clase\orapoarte.vcx" BaseClass="container" />
ADD OBJECT 'Ct_selectie1.Ct_selectie_credit' AS ct_selectie_camp WITH ;
ccamp = credit, ;
cnumecamp = Rulaj creditor, ;
Height = 19, ;
Left = 101, ;
lgrupare = .F., ;
lordine = .F., ;
lsuma = .T., ;
Name = "Ct_selectie_credit", ;
nid_container = 8, ;
TabIndex = 7, ;
Top = 42, ;
Width = 140, ;
ZOrderSet = 30, ;
ck_camp.Alignment = 0, ;
ck_camp.Caption = "Rulaj creditor", ;
ck_camp.Name = "ck_camp"
*< END OBJECT: ClassLib="..\comun\clase\orapoarte.vcx" BaseClass="container" />
ADD OBJECT 'Ct_selectie1.Ct_selectie_debit' AS ct_selectie_camp WITH ;
ccamp = debit, ;
cnumecamp = Rulaj debitor, ;
Height = 19, ;
Left = 101, ;
lgrupare = .F., ;
lordine = .F., ;
lsuma = .T., ;
Name = "Ct_selectie_debit", ;
nid_container = 7, ;
TabIndex = 6, ;
Top = 28, ;
Width = 140, ;
ZOrderSet = 0, ;
ck_camp.Alignment = 0, ;
ck_camp.Caption = "Rulaj debitor", ;
ck_camp.Name = "ck_camp"
*< END OBJECT: ClassLib="..\comun\clase\orapoarte.vcx" BaseClass="container" />
ADD OBJECT 'Ct_selectie1.Ct_selectie_denumire' AS ct_selectie_camp WITH ;
ccamp = denumire, ;
cnumecamp = Denumire, ;
Left = 2, ;
Name = "Ct_selectie_denumire", ;
nid_container = 1, ;
TabIndex = 1, ;
Top = 14, ;
ZOrderSet = 6, ;
ck_camp.Alignment = 0, ;
ck_camp.Caption = "Denumire", ;
ck_camp.Name = "ck_camp"
*< END OBJECT: ClassLib="..\comun\clase\orapoarte.vcx" BaseClass="container" />
ADD OBJECT 'Ct_selectie1.Ct_selectie_soldfinal' AS ct_selectie_camp WITH ;
ccamp = soldfinal, ;
cnumecamp = Sold final, ;
Height = 19, ;
Left = 101, ;
lgrupare = .F., ;
lordine = .F., ;
lsuma = .T., ;
Name = "Ct_selectie_soldfinal", ;
nid_container = 10, ;
TabIndex = 8, ;
Top = 71, ;
Width = 140, ;
ZOrderSet = 29, ;
ck_camp.Alignment = 0, ;
ck_camp.Caption = "Sold final", ;
ck_camp.Name = "ck_camp"
*< END OBJECT: ClassLib="..\comun\clase\orapoarte.vcx" BaseClass="container" />
ADD OBJECT 'Ct_selectie1.Ct_selectie_soldinit' AS ct_selectie_camp WITH ;
ccamp = soldinit, ;
cnumecamp = Sold initial, ;
Height = 19, ;
Left = 101, ;
lgrupare = .F., ;
lordine = .F., ;
lsuma = .T., ;
Name = "Ct_selectie_soldinit", ;
nid_container = 6, ;
TabIndex = 5, ;
Top = 14, ;
Width = 140, ;
ZOrderSet = 20, ;
ck_camp.Alignment = 0, ;
ck_camp.Caption = "Sold initial", ;
ck_camp.Name = "ck_camp"
*< END OBJECT: ClassLib="..\comun\clase\orapoarte.vcx" BaseClass="container" />
ADD OBJECT 'Ct_selectie1.Ct_selectie_soldluna' AS ct_selectie_camp WITH ;
ccamp = soldluna, ;
cnumecamp = Diferenta rulaje, ;
Height = 19, ;
Left = 101, ;
lgrupare = .F., ;
lordine = .F., ;
lsuma = .T., ;
Name = "Ct_selectie_soldluna", ;
nid_container = 9, ;
TabIndex = 8, ;
Top = 56, ;
Width = 140, ;
ZOrderSet = 29, ;
ck_camp.Alignment = 0, ;
ck_camp.Caption = "Diferenta rulaje", ;
ck_camp.Name = "ck_camp"
*< END OBJECT: ClassLib="..\comun\clase\orapoarte.vcx" BaseClass="container" />
PROCEDURE But_start_criterii1.loadcriterii
Parameters tacriterii
External Array tacriterii
#Define crlf Chr(13)+Chr(10)
lcStringCriterii="Denumire\denumire\T\ID_PART\nom_parteneri" + crlf + ;
"Cod fiscal\cod_fiscal\C\none\" + crlf + ;
"Cont\cont\C\none\" + crlf + ;
"Analitic\acont\C\none\"
DoDefault()
ENDPROC
ENDDEFINE