sync SVN r18004/r18007: #6 editare factura emisa - pagina de articole
ofacturare_editare.prg (nou): helpere comune - garda eFactura, cursoarele notei si ale rulajelor, randul de vanzare corespunzator notei si liniile de articole citite din view-ul VVANZARI_ARTICOLE. omodificari.vc2 (frm_modific2024): pagina noua de articole ale facturii, deocamdata doar afisare. Apare numai cand ofacturare_editare.prg e inregistrat si documentul are rand in VANZARI; in ROACONT si ROAGEST, unde fisierul nu e incarcat, pagina lipseste si registrul jurnal ramane neatins. Randul de vanzare al notei se cauta pe toate tripletele distincte (nract, serie_act, dataact) din nota, pentru ca primul rand poate fi o incasare. ofacturare_comun.vc2 (frm_facturi): do_editare_factura si butonul aferent, dupa modelul lui do_sterge, cu garzile de luna inchisa, luna curenta, document sters, referinte si eFactura. docs: comentariile se scriu strict necesar, si in cod si in scripturile de migrare - fara referinte la planuri, stories, decizii sau erori, istoricul doar in antetul fisierului. Plus regula zero (predarea contextului), capcanele de la testarea headless si completari pe fluxul text -> binar. utile/Teste: suita de regresie pentru editarea facturii si harness-ul watchdog (nu sunt in SVN, unde utile/Teste e ignorat). .gitignore ignora si capturile PNG si watchdog_out/, ramase din rulari. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SN8snvkk94KuhWwoXUUey3
This commit is contained in:
@@ -150,7 +150,7 @@ DEFINE CLASS frm_borderou_facturi AS _frmbase OF "_frm_base.vcx"
|
||||
|
||||
ADD OBJECT 'Cmd_executa1' AS cmd_executa WITH ;
|
||||
Anchor = 6, ;
|
||||
Caption = "Marcheaz<61> \<trimis", ;
|
||||
Caption = "Marcheaz<61> \<trimis", ;
|
||||
ForeColor = 0,128,0, ;
|
||||
Height = 27, ;
|
||||
Left = 140, ;
|
||||
@@ -1334,8 +1334,10 @@ DEFINE CLASS frm_facturi AS _frmbase OF "_frm_base.vcx"
|
||||
*< OBJECTDATA: ObjPath="But_attach1" UniqueID="" Timestamp="" />
|
||||
*< OBJECTDATA: ObjPath="But_listare1" UniqueID="" Timestamp="" />
|
||||
*< OBJECTDATA: ObjPath="But_verifica1" UniqueID="" Timestamp="" />
|
||||
*< OBJECTDATA: ObjPath="But_editare1" UniqueID="" Timestamp="" />
|
||||
|
||||
*<DefinedPropArrayMethod>
|
||||
*m: do_editare_factura
|
||||
*m: do_listare_cc
|
||||
*m: do_listare_centr
|
||||
*m: do_listare_document
|
||||
@@ -1350,7 +1352,7 @@ DEFINE CLASS frm_facturi AS _frmbase OF "_frm_base.vcx"
|
||||
*<PropValue>
|
||||
BorderStyle = 1
|
||||
cbuton2 = but_listare1;but_listare2;But_listare3
|
||||
cbuton3 = but_modifica1;but_modifica2
|
||||
cbuton3 = but_modifica1;but_modifica2;But_editare1
|
||||
cfiltru_initial =
|
||||
cgridsortlist = grid_facturi,grid_detalii
|
||||
DoCreate = .T.
|
||||
@@ -1410,6 +1412,17 @@ DEFINE CLASS frm_facturi AS _frmbase OF "_frm_base.vcx"
|
||||
Visible = .F.
|
||||
*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />
|
||||
|
||||
ADD OBJECT 'But_editare1' AS but_modifica WITH ;
|
||||
Anchor = 12, ;
|
||||
caction = do_editare_factura, ;
|
||||
Caption = "", ;
|
||||
Left = 650, ;
|
||||
Name = "But_editare1", ;
|
||||
TabIndex = 29, ;
|
||||
ToolTipText = "Editare factura (articole, cantitati, preturi)", ;
|
||||
Top = 341
|
||||
*< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" />
|
||||
|
||||
ADD OBJECT 'But_listare1' AS but_listare WITH ;
|
||||
Anchor = 8, ;
|
||||
Left = 698, ;
|
||||
@@ -3471,7 +3484,7 @@ DEFINE CLASS frm_facturi AS _frmbase OF "_frm_base.vcx"
|
||||
Anchor = 12, ;
|
||||
AutoSize = .T., ;
|
||||
BackStyle = 0, ;
|
||||
Caption = "Total <20>n valuta", ;
|
||||
Caption = "Total <20>n valuta", ;
|
||||
FontSize = 10, ;
|
||||
Height = 18, ;
|
||||
Left = 311, ;
|
||||
@@ -3711,6 +3724,150 @@ DEFINE CLASS frm_facturi AS _frmbase OF "_frm_base.vcx"
|
||||
This.do_cauta()
|
||||
ENDPROC
|
||||
|
||||
PROCEDURE do_editare_factura
|
||||
If !This.lactiv3
|
||||
Return
|
||||
Endif
|
||||
|
||||
If Reccount('crsfacturi') = 0
|
||||
amessagebox("Nu exista inregistrari pentru editare!",0+48,"Atentie")
|
||||
Return
|
||||
Endif
|
||||
|
||||
If glLunaInchisa
|
||||
Return
|
||||
Endif
|
||||
|
||||
Local lnSters, llEProforma, lnIdSet, lnIdFactD, lnSucces, Omodif, llGasitRand
|
||||
Private pnAn, pnLuna, lnCod, lnIdFact, lnIdVanzare
|
||||
Store 0 To pnAn, pnLuna, lnCod, lnIdFact, lnIdSet, lnIdFactD, lnIdVanzare
|
||||
|
||||
Select crsfacturi
|
||||
lnIdVanzare = id_vanzare
|
||||
lnCod = cod
|
||||
pnAn = Year(data_act)
|
||||
pnLuna = Month(data_act)
|
||||
lnSters = sters
|
||||
lnIdFact = id_fact
|
||||
llEProforma = (eproforma = 1)
|
||||
|
||||
If lnSters = 1
|
||||
amessagebox("Acest document este deja sters!",0+48,"Atentie")
|
||||
Return
|
||||
Endif
|
||||
|
||||
If llEProforma
|
||||
amessagebox("Proformele nu pot fi editate pe aceasta cale!",0+48,"Atentie")
|
||||
Return
|
||||
Endif
|
||||
|
||||
If (pnAn * 12) + pnLuna <> (gnAn * 12) + gnLuna
|
||||
amessagebox('Nu puteti edita decat inregistrari din luna curenta!',0,'Atentie!')
|
||||
Return
|
||||
Endif
|
||||
|
||||
*** verificare restrictie editare documente cu referinte (incasari/plati)
|
||||
If ReferinteDocumenteNota(pnAn, pnLuna, lnCod) && odocumente.prg
|
||||
amessagebox("Documentul are referinte (incasari/plati). Nu poate fi editat.", 0+48,"Editare")
|
||||
Return
|
||||
Endif
|
||||
|
||||
*** verificare restrictie editare facturi trimise in eFactura
|
||||
If EsteInEFactura(lnIdFact) && ofacturare_editare.prg
|
||||
amessagebox("Documentul a fost trimis in eFactura. Nu poate fi editat.", 0+48,"Editare")
|
||||
Return
|
||||
Endif
|
||||
|
||||
If IncarcaCursoareModificareNota(lnCod, pnAn, pnLuna, .F.) && ofacturare_editare.prg
|
||||
If Reccount('actactan') = 0
|
||||
amessagebox("Nu exista nota contabila pentru aceasta factura.",0+48,"Atentie")
|
||||
Else
|
||||
Select actactan
|
||||
llGasitRand = .F.
|
||||
If lnIdFact > 0
|
||||
Locate For Nvl(id_fact, 0) = lnIdFact
|
||||
llGasitRand = Found()
|
||||
Endif
|
||||
If !llGasitRand
|
||||
*** rezerva: nota nu contine id_fact-ul din vanzari (avize, transferuri, documente vechi)
|
||||
Go Top
|
||||
lnIdFact = id_fact
|
||||
Endif
|
||||
lnIdSet = id_set
|
||||
lnIdFactD = id_factd
|
||||
|
||||
Select a.*, Iif(Nvl(id_jtva_coloana,0)=0,0,1) As cu_Tva From tact a Into Cursor tact Readwrite
|
||||
|
||||
Select tact
|
||||
Omodif = Createobject([frm_modific2024], lnIdSet)
|
||||
Omodif.Show()
|
||||
|
||||
If buton = 1
|
||||
If Thisform.do_deschide_tranzactie()
|
||||
Select actactan
|
||||
lnSucces = OSCRIE_IN_FISIERE(2,.T.,.T.)
|
||||
If lnSucces > 0
|
||||
If Used('actactan')
|
||||
Use In actactan
|
||||
Endif
|
||||
Select tact
|
||||
Replace id_jtva_coloana With Null, proc_tva With 0 For cu_Tva = 0
|
||||
Select * From tact Into Cursor actactan Readwrite
|
||||
Replace All id_util With gnIdUtil, sters With 0
|
||||
If Used('rul_temp')
|
||||
Use In rul_temp
|
||||
Endif
|
||||
Select * From trul Into Cursor RUL_TEMP Readwrite
|
||||
Replace All id_util With gnIdUtil, sters With 0
|
||||
If Used('rul_temp_obinv')
|
||||
Use In rul_temp_obinv
|
||||
Endif
|
||||
Select * From trul_obinv Into Cursor RUL_TEMP_OBINV Readwrite
|
||||
Replace All id_util With gnIdUtil, sters With 0
|
||||
lnSucces = OSCRIE_IN_FISIERE(0,.T.,.T.)
|
||||
Endif
|
||||
If lnSucces > 0
|
||||
lcSql = [begin pack_contafin.finalizeaza_modificare_nota(?pnLuna,?pnAn,Null,] + Alltrim(Str(lnIdSet)) + [,] + ;
|
||||
Alltrim(Str(lnCod)) + [,] + Alltrim(Str(lnIdFact)) + [,] + Alltrim(Str(lnIdFactD)) + [,?gnIdUtil); end;]
|
||||
lnSucces = Iif(goExecutor.oExecuta(lcSql),1,-1)
|
||||
Endif
|
||||
If Thisform.do_inchide_tranzactie(Iif(lnSucces<0,2,1))
|
||||
If lnSucces > 0
|
||||
Thisform.do_cauta()
|
||||
Endif
|
||||
Endif
|
||||
Endif
|
||||
Endif
|
||||
Endif
|
||||
|
||||
If Used('actactan')
|
||||
Use In actactan
|
||||
Endif
|
||||
If Used('tact')
|
||||
Use In tact
|
||||
Endif
|
||||
If Used('rul_temp')
|
||||
Use In rul_temp
|
||||
Endif
|
||||
If Used('trul')
|
||||
Use In trul
|
||||
Endif
|
||||
If Used('rul_temp_obinv')
|
||||
Use In rul_temp_obinv
|
||||
Endif
|
||||
If Used('trul_obinv')
|
||||
Use In trul_obinv
|
||||
Endif
|
||||
Endif
|
||||
|
||||
Select crsfacturi
|
||||
Locate For id_vanzare = lnIdVanzare
|
||||
If !Found()
|
||||
Go Top
|
||||
Endif
|
||||
|
||||
ENDPROC
|
||||
|
||||
PROCEDURE do_listare
|
||||
*!* 26.11.2019
|
||||
*!* marius.mutu
|
||||
@@ -4988,7 +5145,7 @@ DEFINE CLASS frm_modifica_articol_factura AS frm_termin_renunt OF "_frm_child.vc
|
||||
_shape2.Top = 0
|
||||
_shape2.Width = 64
|
||||
_shape2.ZOrderSet = 2
|
||||
Lb_titlu_alb_b121.Caption = "Modific<69> explica<63>ie articol"
|
||||
Lb_titlu_alb_b121.Caption = "Modific<69> explica<63>ie articol"
|
||||
Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121"
|
||||
Lb_titlu_alb_b121.TabIndex = 5
|
||||
Lb_titlu_alb_b121.ZOrderSet = 3
|
||||
@@ -5046,7 +5203,7 @@ DEFINE CLASS frm_modifica_articol_factura AS frm_termin_renunt OF "_frm_child.vc
|
||||
_edbase1.Name = "_edbase1", ;
|
||||
_edbase1.Top = 23, ;
|
||||
_edbase1.Width = 325, ;
|
||||
_lbbase1.Caption = "Explica<63>ie", ;
|
||||
_lbbase1.Caption = "Explica<63>ie", ;
|
||||
_lbbase1.Name = "_lbbase1"
|
||||
*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />
|
||||
|
||||
@@ -5280,7 +5437,7 @@ DEFINE CLASS frm_modifica_factura AS frm_termin_renunt OF "_frm_child.vcx"
|
||||
Text_simplu1.Name = "Text_simplu1", ;
|
||||
Text_simplu1.Top = 3, ;
|
||||
Text_simplu1.Width = 177, ;
|
||||
Lb_simplu1.Caption = "Data <20>i ora expedierii", ;
|
||||
Lb_simplu1.Caption = "Data <20>i ora expedierii", ;
|
||||
Lb_simplu1.Name = "Lb_simplu1"
|
||||
*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />
|
||||
|
||||
@@ -5330,7 +5487,7 @@ DEFINE CLASS frm_modifica_factura AS frm_termin_renunt OF "_frm_child.vcx"
|
||||
Top = 128, ;
|
||||
ZOrderSet = 9, ;
|
||||
img_cautare.Name = "img_cautare", ;
|
||||
clb_tx_cautare.Lb_simplu1.Caption = "Ma<4D>ina", ;
|
||||
clb_tx_cautare.Lb_simplu1.Caption = "Ma<4D>ina", ;
|
||||
clb_tx_cautare.Lb_simplu1.Name = "Lb_simplu1", ;
|
||||
clb_tx_cautare.Name = "clb_tx_cautare", ;
|
||||
clb_tx_cautare.Text_simplu1.Left = 133, ;
|
||||
@@ -6820,7 +6977,7 @@ DEFINE CLASS frm_proforme AS _frmbase OF "_frm_base.vcx"
|
||||
Anchor = 12, ;
|
||||
AutoSize = .T., ;
|
||||
BackStyle = 0, ;
|
||||
Caption = "Total <20>n valuta", ;
|
||||
Caption = "Total <20>n valuta", ;
|
||||
FontSize = 10, ;
|
||||
Height = 18, ;
|
||||
Left = 311, ;
|
||||
@@ -6852,7 +7009,7 @@ DEFINE CLASS frm_proforme AS _frmbase OF "_frm_base.vcx"
|
||||
OPTION1.Top = 5, ;
|
||||
OPTION1.Value = 1, ;
|
||||
OPTION2.AutoSize = .T., ;
|
||||
OPTION2.Caption = "<22>n valuta", ;
|
||||
OPTION2.Caption = "<22>n valuta", ;
|
||||
OPTION2.FontCharSet = 238, ;
|
||||
OPTION2.FontSize = 10, ;
|
||||
OPTION2.Left = 55, ;
|
||||
@@ -6860,7 +7017,7 @@ DEFINE CLASS frm_proforme AS _frmbase OF "_frm_base.vcx"
|
||||
OPTION2.Top = 5, ;
|
||||
Option3.AutoSize = .T., ;
|
||||
Option3.BackStyle = 0, ;
|
||||
Option3.Caption = "<22>n RON", ;
|
||||
Option3.Caption = "<22>n RON", ;
|
||||
Option3.FontCharSet = 238, ;
|
||||
Option3.FontSize = 10, ;
|
||||
Option3.Height = 18, ;
|
||||
@@ -6891,7 +7048,7 @@ DEFINE CLASS frm_proforme AS _frmbase OF "_frm_base.vcx"
|
||||
OPTION1.Top = 5, ;
|
||||
OPTION1.Value = 0, ;
|
||||
OPTION2.AutoSize = .T., ;
|
||||
OPTION2.Caption = "<22>terse", ;
|
||||
OPTION2.Caption = "<22>terse", ;
|
||||
OPTION2.FontCharSet = 238, ;
|
||||
OPTION2.FontSize = 10, ;
|
||||
OPTION2.ForeColor = 255,0,0, ;
|
||||
@@ -6900,7 +7057,7 @@ DEFINE CLASS frm_proforme AS _frmbase OF "_frm_base.vcx"
|
||||
OPTION2.Top = 5, ;
|
||||
Option3.AutoSize = .T., ;
|
||||
Option3.BackStyle = 0, ;
|
||||
Option3.Caption = "Ne<4E>terse", ;
|
||||
Option3.Caption = "Ne<4E>terse", ;
|
||||
Option3.FontCharSet = 238, ;
|
||||
Option3.FontSize = 10, ;
|
||||
Option3.Height = 18, ;
|
||||
|
||||
Reference in New Issue
Block a user