Files
roafacturare/docs/diff_cont_discount_667_709.md
2026-09-17 11:19:50 +03:00

228 lines
10 KiB
Markdown

# Diff - conturi 667/709 + analitice pe articol (COMUN)
Data: 2026-09-17. Fisiere SVN de comis: `programe/ofacturare_comun.prg`, `clase/onom_articole.vcx` + `.vct` (regenerate din `.vc2` prin txt2vcx; write-back verificat byte-identic CRLF-normalizat).
```diff
diff --git a/clase/onom_articole.vc2 b/clase/onom_articole.vc2
index 613f562..a263fd3 100644
--- a/clase/onom_articole.vc2
+++ b/clase/onom_articole.vc2
@@ -712,7 +712,9 @@ DEFINE CLASS frm_catalog_articole_nou AS _frmbase OF "_frm_base.vcx"
*< OBJECTDATA: ObjPath="_pageframe1.Page3.Cb_tx_proc_tvav" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="_pageframe1.Page3.Cb_tx_venit" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="_pageframe1.Page3.Clb_tx_scd" UniqueID="" Timestamp="" />
+ *< OBJECTDATA: ObjPath="_pageframe1.Page3.Clb_tx_scd.Text1" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="_pageframe1.Page3.Clb_tx_scc" UniqueID="" Timestamp="" />
+ *< OBJECTDATA: ObjPath="_pageframe1.Page3.Clb_tx_scc.Text1" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="_pageframe1.Page3.Clb_tx_cont_dedus" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="_pageframe1.Page3.Lb_info_conturi" UniqueID="" Timestamp="" />
*< OBJECTDATA: ObjPath="Cus_odata_parteneri_articole_coduri" UniqueID="" Timestamp="" />
@@ -1586,6 +1588,18 @@ DEFINE CLASS frm_catalog_articole_nou AS _frmbase OF "_frm_base.vcx"
Lb_simplu1.Name = "Lb_simplu1"
*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />
+ ADD OBJECT '_pageframe1.Page3.Clb_tx_scc.Text1' AS textbox WITH ;
+ Format = "!k", ;
+ Height = 23, ;
+ Left = 302, ;
+ MaxLength = 4, ;
+ Name = "Text1", ;
+ TabIndex = 2, ;
+ ToolTipText = "Cont analitic (optional)", ;
+ Top = 3, ;
+ Width = 74
+ *< END OBJECT: BaseClass="textbox" />
+
ADD OBJECT '_pageframe1.Page3.Clb_tx_scd' AS clb_tx_simplu WITH ;
Height = 29, ;
Left = 9, ;
@@ -1604,6 +1618,18 @@ DEFINE CLASS frm_catalog_articole_nou AS _frmbase OF "_frm_base.vcx"
Lb_simplu1.Name = "Lb_simplu1"
*< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" />
+ ADD OBJECT '_pageframe1.Page3.Clb_tx_scd.Text1' AS textbox WITH ;
+ Format = "!k", ;
+ Height = 23, ;
+ Left = 302, ;
+ MaxLength = 4, ;
+ Name = "Text1", ;
+ TabIndex = 2, ;
+ ToolTipText = "Cont analitic (optional)", ;
+ Top = 3, ;
+ Width = 74
+ *< END OBJECT: BaseClass="textbox" />
+
ADD OBJECT '_pageframe1.Page3.Lb_info_conturi' AS _label WITH ;
Caption = "Necompletate: debit 4111, credit contul de venit al articolului", ;
Left = 9, ;
@@ -1934,6 +1960,8 @@ DEFINE CLASS frm_catalog_articole_nou AS _frmbase OF "_frm_base.vcx"
This._pageframe1.Page3.Clb_tx_pret_ctva.Text_simplu1.ControlSource = "Thisform.oPretNom.nPretCtva"
This._pageframe1.Page3.Clb_tx_scd.Text_simplu1.ControlSource = "Thisform.oPretNom.cScd"
This._pageframe1.Page3.Clb_tx_scc.Text_simplu1.ControlSource = "Thisform.oPretNom.cScc"
+ This._pageframe1.Page3.Clb_tx_scd.Text1.ControlSource = "Thisform.oPretNom.cAscd"
+ This._pageframe1.Page3.Clb_tx_scc.Text1.ControlSource = "Thisform.oPretNom.cAscc"
This._pageframe1.Page3.Clb_tx_cont_dedus.Text_simplu1.ControlSource = "Thisform.oPretNom.cContDedus"
If Used('crsvenchelt')
Use In crsvenchelt
diff --git a/programe/ofacturare_comun.prg b/programe/ofacturare_comun.prg
index 7b6b46b..efd2002 100644
--- a/programe/ofacturare_comun.prg
+++ b/programe/ofacturare_comun.prg
@@ -74,6 +74,10 @@
*!* marius.mutu
*!* + verifica_cont_venit_linie - verificare prietenoasa a contului de venit rezolvat pentru o linie
*!* de factura, la adaugarea articolului
+*!* 17.09.2026
+*!* agent
+*!* cus_pret_nomenclator: conturi analitice (cAscd/cAscc) in nota de vanzare a articolului;
+*!* apelul RPC devine pack_preturi.gaseste_creeaza_nota_vanzare (overload 6 arg cu analitice)
***************************************************************************************************************
**** Clase:
@@ -2375,6 +2379,8 @@ Define Class cus_pret_nomenclator As Custom
nIdNota = .NULL.
cScd = []
cScc = []
+ cAscd = []
+ cAscc = []
cContDedus = []
cEroare = []
@@ -2410,6 +2416,8 @@ Define Class cus_pret_nomenclator As Custom
This.nIdNota = .NULL.
This.cScd = []
This.cScc = []
+ This.cAscd = []
+ This.cAscc = []
This.cContDedus = []
If This.asigura_politica() <= 0
Return .F.
@@ -2450,7 +2458,7 @@ Define Class cus_pret_nomenclator As Custom
Use In crspolart
Endif
If !Isnull(This.nIdNota)
- lcSql = [select n.scd, n.scc from crm_note_vanzari v, note_contabile n ] + ;
+ lcSql = [select n.scd, n.ascd, n.scc, n.ascc from crm_note_vanzari v, note_contabile n ] + ;
[where v.id_nota = ] + Alltrim(Str(This.nIdNota)) + [ and n.id_set = v.id_set]
If Used('crsnotapol')
Use In crsnotapol
@@ -2459,6 +2467,8 @@ Define Class cus_pret_nomenclator As Custom
If lnSucces >= 0 And Reccount('crsnotapol') > 0
This.cScd = Alltrim(Nvl(crsnotapol.scd,[]))
This.cScc = Alltrim(Nvl(crsnotapol.scc,[]))
+ This.cAscd = Alltrim(Nvl(crsnotapol.ascd,[]))
+ This.cAscc = Alltrim(Nvl(crsnotapol.ascc,[]))
Endif
If Used('crsnotapol')
Use In crsnotapol
@@ -2482,11 +2492,20 @@ Define Class cus_pret_nomenclator As Custom
* valideaza conturile si pretul curente; mesaj + .F. la refuz
Procedure valideaza
This.cEroare = []
- If (!Empty(This.cScd) And Empty(This.cScc)) Or (Empty(This.cScd) And !Empty(This.cScc))
- This.cEroare = [Trebuie completate ambele conturi (debit si credit) sau niciunul.]
+ If !Empty(This.cAscd) And Empty(This.cScd)
+ This.cEroare = [Contul analitic debitor nu poate fi completat fara contul sintetic debitor.]
Else
- If This.nPretFtva < 0 Or This.nPretCtva < 0
- This.cEroare = [Pretul nu poate fi negativ.]
+ If !Empty(This.cAscc) And Empty(This.cScc)
+ This.cEroare = [Contul analitic creditor nu poate fi completat fara contul sintetic creditor.]
+ Endif
+ Endif
+ If Empty(This.cEroare)
+ If (!Empty(This.cScd) And Empty(This.cScc)) Or (Empty(This.cScd) And !Empty(This.cScc))
+ This.cEroare = [Trebuie completate ambele conturi (debit si credit) sau niciunul.]
+ Else
+ If This.nPretFtva < 0 Or This.nPretCtva < 0
+ This.cEroare = [Pretul nu poate fi negativ.]
+ Endif
Endif
Endif
If !Empty(This.cEroare)
@@ -2505,14 +2524,16 @@ Define Class cus_pret_nomenclator As Custom
Return .F.
Endif
If !Empty(This.cScd) And !Empty(This.cScc)
- Private pcScd, pcScc, pnIdUtil
+ Private pcScd, pcScc, pcAscd, pcAscc, pnIdUtil
pcScd = This.cScd
pcScc = This.cScc
+ pcAscd = This.cAscd
+ pcAscc = This.cAscc
pnIdUtil = gnIdUtil
pnIdNota = 0
- lcSql = [begin pack_preturi.gaseste_sau_creeaza_nota_vanzare(?pcScd,?pcScc,?pnIdUtil,?@pnIdNota); end;]
+ lcSql = [begin pack_preturi.gaseste_creeaza_nota_vanzare(?pcScd,?pcAscd,?pcScc,?pcAscc,?pnIdUtil,?@pnIdNota); end;]
lnSucces = goExecutor.oExecute(lcSql)
- Release pcScd, pcScc, pnIdUtil
+ Release pcScd, pcScc, pcAscd, pcAscc, pnIdUtil
If lnSucces < 0
AMESSAGEBOX(goExecutor.oPrelucrareEroare(),16,"Eroare")
Release pnIdArticol, pnPretFtva, pnPretCtva, pnProcTvav, pnIdVenchelt, pnIdNota, pnScrieNota
@@ -2555,7 +2576,9 @@ Define Class cus_pret_nomenclator As Custom
Local lcSql, lnSucces
This.cScd = []
This.cScc = []
- lcSql = [select n.scd, n.scc from crm_politici_preturi p, crm_note_vanzari v, note_contabile n ] + ;
+ This.cAscd = []
+ This.cAscc = []
+ lcSql = [select n.scd, n.ascd, n.scc, n.ascc from crm_politici_preturi p, crm_note_vanzari v, note_contabile n ] + ;
[where p.id_pol = ] + Alltrim(Str(tnIdPol)) + [ and v.id_nota = p.id_nota and n.id_set = v.id_set]
If Used('crsnotapolstoc')
Use In crsnotapolstoc
@@ -2564,6 +2587,8 @@ Define Class cus_pret_nomenclator As Custom
If lnSucces >= 0 And Reccount('crsnotapolstoc') > 0
This.cScd = Alltrim(Nvl(crsnotapolstoc.scd,[]))
This.cScc = Alltrim(Nvl(crsnotapolstoc.scc,[]))
+ This.cAscd = Alltrim(Nvl(crsnotapolstoc.ascd,[]))
+ This.cAscc = Alltrim(Nvl(crsnotapolstoc.ascc,[]))
Endif
If Used('crsnotapolstoc')
Use In crsnotapolstoc
@@ -2573,8 +2598,10 @@ Define Class cus_pret_nomenclator As Custom
* valideaza (ambele conturi sau niciunul) si scrie nota implicita a politicii date
Procedure salveaza_nota_politica
- Lparameters tnIdPol, tcScd, tcScc
+ Lparameters tnIdPol, tcScd, tcScc, tcAscd, tcAscc
Local lcSql, lnSucces
+ tcAscd = Iif(Type('tcAscd')='C', tcAscd, [])
+ tcAscc = Iif(Type('tcAscc')='C', tcAscc, [])
If (!Empty(tcScd) And Empty(tcScc)) Or (Empty(tcScd) And !Empty(tcScc))
This.cEroare = [Trebuie completate ambele conturi (debit si credit) sau niciunul.]
AMESSAGEBOX(This.cEroare,0+48,"Atentie")
@@ -2583,16 +2610,18 @@ Define Class cus_pret_nomenclator As Custom
If Empty(tcScd) And Empty(tcScc)
Return .T.
Endif
- Private pcScd, pcScc, pnIdUtil, pnIdNota, pnIdPol
+ Private pcScd, pcScc, pcAscd, pcAscc, pnIdUtil, pnIdNota, pnIdPol
pcScd = tcScd
pcScc = tcScc
+ pcAscd = tcAscd
+ pcAscc = tcAscc
pnIdUtil = gnIdUtil
pnIdNota = 0
- lcSql = [begin pack_preturi.gaseste_sau_creeaza_nota_vanzare(?pcScd,?pcScc,?pnIdUtil,?@pnIdNota); end;]
+ lcSql = [begin pack_preturi.gaseste_creeaza_nota_vanzare(?pcScd,?pcAscd,?pcScc,?pcAscc,?pnIdUtil,?@pnIdNota); end;]
lnSucces = goExecutor.oExecute(lcSql)
If lnSucces < 0
AMESSAGEBOX(goExecutor.oPrelucrareEroare(),16,"Eroare")
- Release pcScd, pcScc, pnIdUtil, pnIdNota, pnIdPol
+ Release pcScd, pcScc, pcAscd, pcAscc, pnIdUtil, pnIdNota, pnIdPol
Return .F.
Endif
pnIdPol = tnIdPol
@@ -2601,7 +2630,7 @@ Define Class cus_pret_nomenclator As Custom
If lnSucces < 0
AMESSAGEBOX(goExecutor.oPrelucrareEroare(),16,"Eroare")
Endif
- Release pcScd, pcScc, pnIdUtil, pnIdNota, pnIdPol
+ Release pcScd, pcScc, pcAscd, pcAscc, pnIdUtil, pnIdNota, pnIdPol
Return (lnSucces >= 0)
Endproc && salveaza_nota_politica
Enddefine
```