#13: formular de facturare unificat - etapa curenta
Squash al branch-ului de lucru plan13-s2. Clase: ofacturare (nucleul formularului unificat), ofacturare_comun, ferestre_cere_date, ocomenzi, caut_ora (lista de preturi in combo-urile de cautare), omodificari. Programe: ofacturare impartit - ofacturare_antet, ofacturare_rutare_scriere si ogrid_latimi sunt fisiere noi; oproceduri_facturare primeste discountul pe linie si cota standard de TVA cand articolul nu are cota pe politica. Documentatie: capcana SQLExec no_data_found, conventia de encoding, depanarea testelor VFP si regulile de lucru - conflictele cu modificarile venite din alte proiecte sunt rezolvate pastrand ambele parti. Loguri de rulare a testelor scoase din versionare; testele raman. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PkyjGyrV2S7932om4kfSiK
This commit is contained in:
925
programe/ofacturare_antet.prg
Normal file
925
programe/ofacturare_antet.prg
Normal file
@@ -0,0 +1,925 @@
|
||||
*!* 21.08.2026
|
||||
*!* marius.mutu
|
||||
*!* oAntetFacturare - logica de antet a formularului unificat frm_facturare_articole2, portata din frm_date_factura /
|
||||
*!* frm_date_aviz (ofacturare.vcx): cautarile (do_cauta_*), do_verifica, validarea antetului (valideaza_antet) si regulile
|
||||
*!* schimbarii felului de document (alege_tipdoc, schimba_tipdoc); formularul vine ca parametru toForm, ramura
|
||||
*!* factura/aviz se alege pe poDate.nIdTipDoc = poDate.nIdTipDocAvizExpeditie.
|
||||
|
||||
*!* 28.08.2026
|
||||
*!* marius.mutu
|
||||
*!* controalele grupului de contabilitate (Ct_clb_venchelt, Ct_clb_sectie, Ct_clb_lucrare, Ct_clb_responsabil,
|
||||
*!* Ct_clb_gestiune_init, Ed_tx_simplu1) au trecut in containerul ct_contabilitate al formularului, deci
|
||||
*!* referintele lor din acest fisier sunt prefixate cu containerul, inclusiv in expresiile Type().
|
||||
|
||||
Define Class oAntetFacturare As Custom
|
||||
|
||||
Function EsteAviz
|
||||
Return poDate.nIdTipDoc = poDate.nIdTipDocAvizExpeditie
|
||||
Endfunc
|
||||
|
||||
Procedure do_cauta_altele
|
||||
Lparameters toForm
|
||||
Local llAviz
|
||||
llAviz = This.EsteAviz()
|
||||
If m.llAviz
|
||||
Do Case
|
||||
Case Inlist(toForm.nid_tip,23,41)
|
||||
toForm.do_cauta_gestiune_dest()
|
||||
Case Inlist(toForm.nid_tip,21,25,28,42,47) && modificare v 2.0.93 : am adaugat 47
|
||||
toForm.do_cauta_comanda()
|
||||
Case toForm.nid_tip = 26
|
||||
toForm.do_cauta_contract()
|
||||
Case toForm.nid_tip = 24 && aviz retur
|
||||
toForm.do_cauta_avize()
|
||||
Endcase
|
||||
Else
|
||||
Do Case
|
||||
Case toForm.nid_tip=2
|
||||
toForm.do_cauta_contract()
|
||||
Case toForm.nid_tip=3
|
||||
toForm.do_cauta_comanda()
|
||||
Case toForm.nid_tip=4
|
||||
toForm.do_cauta_avize()
|
||||
*!* modificare v 2.0.46
|
||||
Case toForm.nid_tip=7
|
||||
toForm.do_cauta_factura()
|
||||
*!* modificare v 2.0.46 ^
|
||||
*!* modificare v 2.0.56
|
||||
Case Inlist(toForm.nid_tip,8,9)
|
||||
toForm.do_cauta_facturi()
|
||||
*!* modificare v 2.0.56 ^
|
||||
*!* modificare v 2.0.87
|
||||
Case toForm.nid_tip = 45
|
||||
toForm.do_cauta_locatii()
|
||||
*!* modificare v 2.0.87 ^
|
||||
Endcase
|
||||
Endif
|
||||
Endproc
|
||||
|
||||
Procedure do_cauta_avize
|
||||
Lparameters toForm
|
||||
Local lcXMLAvize
|
||||
If Empty(Nvl(poDate.id_client,0))
|
||||
amessagebox("Nu ati ales clientul!",0+48,"Atentie")
|
||||
toForm.ct_clb_nume_client.SetFocus()
|
||||
Else
|
||||
lcXMLAvize = caut_avize(poDate.id_client) && oproceduri_facturare.prg
|
||||
If !Empty(lcXMLAvize)
|
||||
Xmltocursor(lcXMLAvize, "crsAvizeTemp")
|
||||
*!* modificare v 2.0.44
|
||||
Select id_vanzare,id_comanda,;
|
||||
Padl(Iif(!Empty(Nvl(serie_act,[])),Alltrim(serie_act)+[ ],[])+Alltrim(Str(numar_act,20)),50,[ ]) As numar_act ;
|
||||
From crsAvizeTemp Into Cursor crsAvizeTemp
|
||||
*!* modificare v 2.0.44 ^
|
||||
lcIdVanzare = cursor2lista("crsAvizeTemp", "id_vanzare", ",")
|
||||
lcNumar_Act = cursor2lista("crsAvizeTemp", "numar_act", ",")
|
||||
|
||||
poDate.listaid = lcIdVanzare
|
||||
poDate.descriere = lcNumar_Act
|
||||
AddProperty(poDate,"id_comanda_aviz",0)
|
||||
Select crsAvizeTemp
|
||||
Locate For Not Empty(ID_COMANDA)
|
||||
If Found()
|
||||
poDate.id_comanda_aviz=ID_COMANDA
|
||||
Endif
|
||||
Use In crsAvizeTemp
|
||||
|
||||
toForm.ct_clb_altele.Refresh()
|
||||
If Type('toForm.ct_contabilitate.ct_clb_gestiune_init.visible')<>'U' && modificare v 2.0.41
|
||||
toForm.ct_contabilitate.ct_clb_gestiune_init.SetFocus()
|
||||
Else
|
||||
toForm.but_TERMIN1.SetFocus()
|
||||
Endif
|
||||
Endif
|
||||
Endif
|
||||
Endproc
|
||||
|
||||
Procedure do_cauta_client
|
||||
Lparameters toForm
|
||||
Local llAviz
|
||||
llAviz = This.EsteAviz()
|
||||
If m.llAviz
|
||||
Local loCauta
|
||||
Do Case
|
||||
Case poDate.tip = 23
|
||||
loCauta = caut_gestiune_sursa([2,4,5,6,7]) && modificare v 2.0.71 : am adaugat 2
|
||||
If !Isnull(loCauta) And !Empty(loCauta.id_gestiune)
|
||||
poDate.id_client = loCauta.id_gestiune
|
||||
poDate.nume_client = loCauta.nume_gestiune
|
||||
|
||||
poDate.listaid = []
|
||||
poDate.descriere = []
|
||||
Endif
|
||||
*!* modificare v 2.0.16
|
||||
Case poDate.tip = 41
|
||||
loCauta = caut_gestiune_sursa([2,4,5,6,7])
|
||||
If !Isnull(loCauta) And !Empty(loCauta.id_gestiune)
|
||||
poDate.id_client = loCauta.id_gestiune
|
||||
poDate.nume_client = loCauta.nume_gestiune
|
||||
|
||||
poDate.listaid = []
|
||||
poDate.descriere = []
|
||||
Endif
|
||||
*!* modificare v 2.0.16 ^
|
||||
Case poDate.tip = 25
|
||||
loCauta = caut_gestiune_dest()
|
||||
If !Isnull(loCauta) And !Empty(Nvl(loCauta.id_gestiune,0))
|
||||
poDate.id_client = loCauta.id_gestiune
|
||||
poDate.nume_client = loCauta.nume_gestiune
|
||||
|
||||
poDateGestiuneDest.id_gestiune = loCauta.id_gestiune
|
||||
poDateGestiuneDest.id_tipgest = loCauta.id_tipgest
|
||||
poDateGestiuneDest.Cont = Nvl(loCauta.Cont,[XXXX])
|
||||
poDateGestiuneDest.acont = Nvl(loCauta.acont,[XXXX])
|
||||
|
||||
lcSql = [begin ] + gcS + [.pack_facturare.cauta_date_comanda_gest(?poDate.id_client,?gnIdSucursala,] + ;
|
||||
[?poDate.dataact,?@poDate.listaid,?@poDate.descriere); end;]
|
||||
lnSucces = goExecutor.oExecute(lcSql)
|
||||
If lnSucces < 0
|
||||
amessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
|
||||
poDate.listaid = []
|
||||
poDate.descriere = []
|
||||
Endif
|
||||
|
||||
Endif
|
||||
Otherwise
|
||||
&& modificare v 2.0.93 : am adaugat 47
|
||||
loHash = GetHash([cTitlu=>Clienti??cCont=>]+Iif(INLIST(poDate.tip,42,47),[357],Iif(Inlist(poDate.tip,28,29),[461],Alltrim(gcCont411)))+[??lAdaugCorespondente=>1??lVerificaANAF=>1])
|
||||
loHash.SetValue('dDataDoc', Iif(Type('poDate.dataact') = 'D', poDate.dataact, {}))
|
||||
loCauta = CautPartenerContabilitate(loHash)
|
||||
If !Empty(Nvl(loCauta.id_part,0)) And !Empty(loCauta.denumire)
|
||||
poDate.id_client = loCauta.id_part
|
||||
poDate.nume_client = loCauta.denumire
|
||||
|
||||
If Inlist(poDate.tip,21,28,42,47) && modificare v 2.0.93 : am adaugat 47
|
||||
lcSql = [begin ] + gcS + [.pack_facturare.cauta_date_comanda(?poDate.id_client,?gnIdSucursala,] + ;
|
||||
[?poDate.dataact,?@poDate.listaid,?@poDate.descriere); end;]
|
||||
lnSucces = goExecutor.oExecute(lcSql)
|
||||
If lnSucces < 0
|
||||
amessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
|
||||
poDate.listaid = []
|
||||
poDate.descriere = []
|
||||
Endif
|
||||
Else
|
||||
poDate.listaid = []
|
||||
poDate.descriere = []
|
||||
Endif
|
||||
|
||||
Endif
|
||||
Endcase
|
||||
|
||||
*!* modificare v 2.0.70
|
||||
If Type('toForm.ct_clb_altele.visible')<>'U'
|
||||
toForm.ct_clb_altele.Refresh()
|
||||
Endif
|
||||
*!* modificare v 2.0.70 ^
|
||||
toForm.ct_clb_nume_client.Refresh()
|
||||
toForm.ct_contabilitate.ct_clb_lucrare.SetFocus()
|
||||
Else
|
||||
Local loCauta
|
||||
loHash = GetHash([cTitlu=>Clienti??cCont=>4111??lAdaugCorespondente=>1??lVerificaANAF=>1])
|
||||
loHash.SetValue('dDataDoc', Iif(Type('poDate.dataact') = 'D', poDate.dataact, {}))
|
||||
loCauta = CautPartenerContabilitate(loHash)
|
||||
If !Empty(Nvl(loCauta.id_part,0)) And !Empty(loCauta.denumire)
|
||||
If loCauta.id_part <> poDate.id_client
|
||||
poDate.listaid = []
|
||||
poDate.descriere = []
|
||||
poDate.text_aditional = []
|
||||
Endif
|
||||
poDate.id_client = loCauta.id_part
|
||||
poDate.nume_client = loCauta.denumire
|
||||
poDate.cod_fiscal = loCauta.cod_fiscal
|
||||
|
||||
If poDate.tip = 3
|
||||
lcSql = [begin ] + gcS + [.pack_facturare.cauta_date_comanda(?poDate.id_client,?gnIdSucursala,] + ;
|
||||
[?poDate.dataact,?@poDate.listaid,?@poDate.descriere); end;]
|
||||
lnSucces = goExecutor.oExecute(lcSql)
|
||||
If lnSucces < 0
|
||||
amessagebox(goExecutor.oPrelucrareEroare(),0+16,"Eroare")
|
||||
poDate.listaid = []
|
||||
poDate.descriere = []
|
||||
poDate.text_aditional = []
|
||||
Endif
|
||||
Endif
|
||||
|
||||
*!* If Type('toForm.ct_clb_altele.visible')<>'U'
|
||||
*!* toForm.ct_clb_altele.Refresh()
|
||||
*!* Endif
|
||||
|
||||
* Soldul curent
|
||||
loSoldClient = GetSoldClient(poDate.id_client)
|
||||
toForm.nSoldLei = loSoldClient.sold_lei
|
||||
toForm.nSoldValuta = loSoldClient.sold_valuta
|
||||
toForm.txtSoldLei.Refresh()
|
||||
|
||||
toForm.txtCodFiscal.Refresh()
|
||||
|
||||
toForm.ct_clb_nume_client.Refresh()
|
||||
toForm.ct_contabilitate.ct_clb_lucrare.SetFocus()
|
||||
|
||||
toForm.ct_clb_nume_client.clb_TX_CAUTARE.text_SIMPLU1.ToolTipText = 'Id client: ' + TRANSFORM(poDate.id_client)
|
||||
Else
|
||||
poDate.listaid = []
|
||||
poDate.descriere = []
|
||||
poDate.text_aditional = []
|
||||
|
||||
toForm.ct_clb_nume_client.clb_TX_CAUTARE.text_SIMPLU1.ToolTipText = ''
|
||||
|
||||
toForm.nSoldLei = 0
|
||||
toForm.nSoldValuta = 0
|
||||
toForm.txtSoldLei.Refresh()
|
||||
Endif
|
||||
*!* modificare v 2.0.70
|
||||
If Type('toForm.ct_clb_altele.visible')<>'U'
|
||||
toForm.ct_clb_altele.Refresh()
|
||||
ENDIF
|
||||
*!* modificare v 2.0.70 ^
|
||||
Endif
|
||||
Endproc
|
||||
|
||||
Procedure do_cauta_comanda
|
||||
Lparameters toForm
|
||||
Local llAviz
|
||||
llAviz = This.EsteAviz()
|
||||
If m.llAviz
|
||||
Local loCauta
|
||||
If Empty(Nvl(poDate.id_client,0))
|
||||
amessagebox("Nu ati ales " + Iif(poDate.tip = 25,[gestiunea destinatie],[clientul]) + " !",0+48,"Atentie")
|
||||
toForm.ct_clb_nume_client.SetFocus()
|
||||
Else
|
||||
If poDate.tip = 25
|
||||
loCauta = caut_comanda_gestiune(poDate.id_client)
|
||||
Else
|
||||
loCauta = caut_comanda_client(poDate.id_client)
|
||||
Endif
|
||||
If !Isnull(loCauta) And !Empty(Nvl(loCauta.id_comanda,0))
|
||||
poDate.listaid = loCauta.id_comanda
|
||||
poDate.descriere = ALLTRIM(loCauta.nr_comanda)
|
||||
toForm.ct_clb_altele.Refresh()
|
||||
If Type('toForm.ct_contabilitate.ct_clb_gestiune_init.visible')<>'U' && modificare v 2.0.41
|
||||
toForm.ct_contabilitate.ct_clb_gestiune_init.SetFocus()
|
||||
Else
|
||||
toForm.buT_TERMIN1.SetFocus()
|
||||
Endif
|
||||
Endif
|
||||
Endif
|
||||
Else
|
||||
* 12.03.2021
|
||||
* folosesc caut_comanda_clienti in loc de caut_comanda_client,
|
||||
* ca sa pot folosi un client diferit fata de comanda (ex: pers. fizica in loc de pers. juridica)
|
||||
Local loCauta
|
||||
If Empty(Nvl(poDate.id_client,0))
|
||||
amessagebox("Nu ati ales clientul!",0+48,"Atentie")
|
||||
toForm.ct_clb_nume_client.SetFocus()
|
||||
Else
|
||||
* loCauta = caut_comanda_client(poDate.id_client)
|
||||
loCauta = caut_comanda_clienti(poDate.id_client)
|
||||
If !Isnull(loCauta) And !Empty(loCauta.id_comanda)
|
||||
IF poDate.id_client <> loCauta.id_part
|
||||
AMESSAGEBOX('Comanda ' + ALLTRIM(TRANSFORM(loCauta.nr_comanda)) + ' (Client: ' + ALLTRIM(loCauta.nume) + ' Id: ' + ALLTRIM(TRANSFORM(loCauta.id_part)) + ')' + ;
|
||||
' nu apartine clientului ales (' + ALLTRIM(poDate.nume_client) + ' Id: ' + ALLTRIM(TRANSFORM(poDate.id_client)) + ')',0+48,_sCREEN.Caption)
|
||||
ENDIF
|
||||
poDate.listaid = loCauta.id_comanda
|
||||
poDate.descriere = loCauta.nr_comanda
|
||||
|
||||
toForm.ct_clb_altele.Refresh()
|
||||
If Type('toForm.ct_contabilitate.ct_clb_gestiune_init.visible')<>'U' && modificare v 2.0.41
|
||||
toForm.ct_contabilitate.ct_clb_gestiune_init.SetFocus()
|
||||
Else
|
||||
toForm.but_TERMIN1.SetFocus()
|
||||
Endif
|
||||
Endif
|
||||
Endif
|
||||
Endif
|
||||
Endproc
|
||||
|
||||
Procedure do_cauta_contract
|
||||
Lparameters toForm
|
||||
Local llAviz
|
||||
llAviz = This.EsteAviz()
|
||||
If m.llAviz
|
||||
Local loCauta
|
||||
If Empty(Nvl(poDate.id_client,0))
|
||||
amessagebox("Nu ati ales clientul!",0+48,"Atentie")
|
||||
toForm.ct_clb_nume_client.SetFocus()
|
||||
Else
|
||||
*!* modificare v 2.0.67
|
||||
*!* loCauta = caut_contract_facturare(poDate.id_client)
|
||||
*!* If !Isnull(loCauta) And !Empty(Nvl(loCauta.id_ctr,0))
|
||||
*!* poDate.listaid = loCauta.id_ctr
|
||||
*!* poDate.descriere = loCauta.contract
|
||||
*!* *!* If Inlist(loCauta.opt_facturare,3,4) And !Empty(loCauta.scadenta_incasare)
|
||||
*!* *!* poDate.datascad = poDate.dataact + loCauta.scadenta_incasare
|
||||
*!* *!* toForm.clb_data_scadenta.Refresh()
|
||||
*!* *!* *!* Else
|
||||
*!* *!* *!* poDate.datascad = Iif(gnScadentaAutomata=0,Gomonth(poDate.dataact,1),poDate.dataact+gnZileScadentaFact)
|
||||
*!* *!* Endif
|
||||
*!* toForm.ct_clb_altele.Refresh()
|
||||
*!* *!* modificare v 2.0.41
|
||||
*!* If Inlist(loCauta.opt_facturare,3,4)
|
||||
*!* If Type('toForm.ct_contabilitate.ct_clb_gestiune_init.visible')<>'U'
|
||||
*!* toForm.ct_contabilitate.ct_clb_gestiune_init.Visible = .T.
|
||||
*!* toForm.ct_contabilitate.ct_clb_gestiune_init.SetFocus()
|
||||
*!* Else
|
||||
*!* toForm.but_termin1.SetFocus()
|
||||
*!* Endif
|
||||
*!* Else
|
||||
*!* poDate.id_gestiune_init = Null
|
||||
*!* toForm.cgestiune_init = []
|
||||
*!* *!* If Type('toForm.ct_contabilitate.ct_clb_gestiune_init.visible')<>'U'
|
||||
*!* *!* toForm.ct_contabilitate.ct_clb_gestiune_init.Refresh()
|
||||
*!* *!* toForm.ct_contabilitate.ct_clb_gestiune_init.Visible = .F.
|
||||
*!* *!* Endif
|
||||
*!* *!* toForm.but_termin1.SetFocus()
|
||||
*!* amessagebox("Acest contract este in rate si nu se poate emite aviz pentru el!",48,"Atentie")
|
||||
*!* Endif
|
||||
*!* *!* modificare v 2.0.41 ^
|
||||
*!* *!* toForm.buT_TERMIN1.SetFocus()
|
||||
*!* Endif
|
||||
lcXMLContracte = caut_contract_facturare(poDate.id_client,[3,4])
|
||||
If !Empty(lcXMLContracte) And gnButon = 1
|
||||
Xmltocursor(lcXMLContracte, "crsCtrTemp")
|
||||
poDate.listaid = cursor2lista("crsCtrTemp", "id_ctr", ",")
|
||||
poDate.descriere = cursor2lista("crsCtrTemp", "contract", ",")
|
||||
toForm.ct_clb_altele.Refresh()
|
||||
If Type('toForm.ct_contabilitate.ct_clb_gestiune_init.visible')<>'U'
|
||||
toForm.ct_contabilitate.ct_clb_gestiune_init.Visible = .T.
|
||||
toForm.ct_contabilitate.ct_clb_gestiune_init.SetFocus()
|
||||
Else
|
||||
toForm.but_termin1.SetFocus()
|
||||
Endif
|
||||
*!* Use In crsCtrTemp
|
||||
Endif
|
||||
*!* modificare v 2.0.67 ^
|
||||
Endif
|
||||
Else
|
||||
Local loCauta,lcXMLContracte
|
||||
If Empty(Nvl(poDate.id_client,0))
|
||||
amessagebox("Nu ati ales clientul!",0+48,"Atentie")
|
||||
toForm.ct_clb_nume_client.SetFocus()
|
||||
Else
|
||||
*!* modificare v 2.0.67
|
||||
*!* loCauta = caut_contract_facturare(poDate.id_client)
|
||||
*!* If !Isnull(loCauta) And !Empty(loCauta.id_ctr)
|
||||
*!* poDate.listaid = loCauta.id_ctr
|
||||
*!* poDate.descriere = loCauta.contract
|
||||
*!* toForm.ct_clb_altele.Refresh()
|
||||
*!* If Inlist(loCauta.opt_facturare,3,4)
|
||||
*!* If !Empty(loCauta.scadenta_incasare)
|
||||
*!* poDate.datascad = poDate.dataact + loCauta.scadenta_incasare
|
||||
*!* toForm.clb_data_scadenta.Refresh()
|
||||
*!* Endif
|
||||
*!* *!* modificare v 2.0.41
|
||||
*!* If Type('toForm.ct_contabilitate.ct_clb_gestiune_init.visible')<>'U'
|
||||
*!* toForm.ct_contabilitate.ct_clb_gestiune_init.Visible = .T.
|
||||
*!* toForm.ct_contabilitate.ct_clb_gestiune_init.SetFocus()
|
||||
*!* Else
|
||||
*!* toForm.but_termin1.SetFocus()
|
||||
*!* Endif
|
||||
*!* *!* modificare v 2.0.41 ^
|
||||
*!* Else
|
||||
*!* *!* poDate.datascad = Iif(gnScadentaAutomata=0,Gomonth(poDate.dataact,1),poDate.dataact+gnZileScadentaFact)
|
||||
*!* *!* modificare v 2.0.41
|
||||
*!* poDate.id_gestiune_init = Null
|
||||
*!* toForm.cgestiune_init = []
|
||||
*!* If Type('toForm.ct_contabilitate.ct_clb_gestiune_init.visible')<>'U'
|
||||
*!* toForm.ct_contabilitate.ct_clb_gestiune_init.Refresh()
|
||||
*!* toForm.ct_contabilitate.ct_clb_gestiune_init.Visible = .F.
|
||||
*!* Endif
|
||||
*!* toForm.but_termin1.SetFocus()
|
||||
*!* Endif
|
||||
*!* *!* modificare v 2.0.41 ^
|
||||
lcXMLContracte = caut_contract_facturare(poDate.id_client)
|
||||
If !Empty(lcXMLContracte) And gnButon = 1
|
||||
Xmltocursor(lcXMLContracte, "crsCtrTemp")
|
||||
poDate.listaid = cursor2lista("crsCtrTemp", "id_ctr", ",")
|
||||
poDate.descriere = cursor2lista("crsCtrTemp", "contract", ",")
|
||||
toForm.ct_clb_altele.Refresh()
|
||||
Select crsCtrTemp
|
||||
Calculate Min(scadenta_incasare),MAX(afisare_scadenta) For Inlist(opt_facturare,3,4,0) To lnScadentaIncasare,lnAfisareScadenta
|
||||
If lnScadentaIncasare <> 0
|
||||
poDate.datascad = poDate.dataact + lnScadentaIncasare
|
||||
toForm.clb_data_scadenta.Refresh()
|
||||
Endif
|
||||
poDate.afisare_scadenta = lnAfisareScadenta && modificare ROACONTRACTE v 2.0.38
|
||||
If Type('toForm.ct_contabilitate.ct_clb_gestiune_init.visible')<>'U'
|
||||
toForm.ct_contabilitate.ct_clb_gestiune_init.Visible = .T.
|
||||
toForm.ct_contabilitate.ct_clb_gestiune_init.SetFocus()
|
||||
Else
|
||||
toForm.but_termin1.SetFocus()
|
||||
Endif
|
||||
*!* Use In crsCtrTemp
|
||||
*!* modificare v 2.0.67 ^
|
||||
Endif
|
||||
Endif
|
||||
Endif
|
||||
Endproc
|
||||
|
||||
Procedure do_cauta_factura
|
||||
Lparameters toForm
|
||||
*!* modificare v 2.0.46
|
||||
Local loCauta
|
||||
If Empty(Nvl(poDate.id_client,0))
|
||||
amessagebox("Nu ati ales clientul!",0+48,"Atentie")
|
||||
toForm.ct_clb_nume_client.SetFocus()
|
||||
Else
|
||||
loCauta = caut_facturi_client(poDate.id_client)
|
||||
If !Isnull(loCauta) And !Empty(loCauta.id_fact)
|
||||
poDate.descriere = Alltrim(Alltrim(Nvl(loCauta.serie_act,[]))+[ ]+Alltrim(Str(loCauta.nract,14,0)))
|
||||
poDate.text_aditional = [INVOICE ] + poDate.descriere
|
||||
toForm.ct_clb_altele.Refresh()
|
||||
toForm.buT_TERMIN1.SetFocus()
|
||||
Endif
|
||||
EndIf
|
||||
*!* modificare v 2.0.46 ^
|
||||
Endproc
|
||||
|
||||
Procedure do_cauta_facturi
|
||||
Lparameters toForm
|
||||
*!* modificare v 2.0.56
|
||||
Local loCauta
|
||||
Do Case
|
||||
Case Empty(Nvl(poDate.id_client,0))
|
||||
amessagebox("Nu ati ales clientul!",0+48,"Atentie")
|
||||
toForm.ct_clb_nume_client.SetFocus()
|
||||
Case Empty(Nvl(poDate.id_valuta,0)) And poDate.tip = 9
|
||||
amessagebox("Nu ati ales valuta!",0+48,"Atentie")
|
||||
toForm.ct_clb_valuta.SetFocus()
|
||||
OTHERWISE
|
||||
* 03.07.2020, marius
|
||||
* Nu stiu de ce se alegea o singura factura la retur.
|
||||
* Era si codul pentru mai multe facturi retur, dar era comentat
|
||||
|
||||
*!* loCauta = caut_facturi_multiple_client(poDate.id_client,poDate.in_valuta,poDate.id_valuta)
|
||||
*!* If gnButon = 1 and !Empty(Nvl(loCauta.id_vanzare,0))
|
||||
*!* poDate.listaid = Alltrim(Str(loCauta.id_vanzare))
|
||||
*!* poDate.descriere = Alltrim(Iif(!Empty(Nvl(loCauta.serie_act,[])),Alltrim(loCauta.serie_act)+[ ],[])+Alltrim(Str(loCauta.numar_act,20,0)))
|
||||
|
||||
* pentru mai multe facturi :
|
||||
lcXMLFacturi = caut_facturi_multiple_client(poDate.id_client,poDate.in_valuta,poDate.id_valuta,.T.)
|
||||
If !Empty(lcXMLFacturi) and gnButon = 1
|
||||
Xmltocursor(lcXMLFacturi, "crsFacturiTemp")
|
||||
Select id_vanzare,;
|
||||
Padl(Iif(!Empty(Nvl(serie_act,[])),Alltrim(serie_act)+[ ],[])+Alltrim(Str(numar_act,20,0)),50,[ ]) As numar_act ;
|
||||
From crsFacturiTemp Into Cursor crsFacturiTemp
|
||||
poDate.listaid = cursor2lista("crsFacturiTemp", "id_vanzare", ",")
|
||||
poDate.descriere = cursor2lista("crsFacturiTemp", "numar_act", ",")
|
||||
USE IN (SELECT('crsFacturiTemp'))
|
||||
|
||||
poDate.text_aditional = Iif(poDate.tip=8,[RETUR FACTURA ],[REFUND INVOICE FOR ]) + poDate.descriere
|
||||
|
||||
toForm.ct_clb_altele.Refresh()
|
||||
toForm.buT_TERMIN1.SetFocus()
|
||||
Endif
|
||||
Endcase
|
||||
*!* modificare v 2.0.56 ^
|
||||
Endproc
|
||||
|
||||
Procedure do_cauta_fdoc
|
||||
Lparameters toForm
|
||||
Local loCauta
|
||||
loCauta = caut_fdoc()
|
||||
If !Isnull(loCauta) And !Empty(loCauta.fel_document)
|
||||
poDate.id_fdoc = loCauta.id_fdoc
|
||||
poDate.fdoc = loCauta.fel_document
|
||||
|
||||
toForm.clb_fdoc.Refresh()
|
||||
toForm.clb_dataact.SetFocus()
|
||||
Endif
|
||||
Endproc
|
||||
|
||||
Procedure do_cauta_gestiune_dest
|
||||
Lparameters toForm
|
||||
Local loCauta
|
||||
If Empty(NVL(poDate.id_client,0))
|
||||
amessagebox("Nu ati ales gestiunea " + Iif(poDate.tip = 41,"de la care se face returul!","sursa!") ,0+48,"Atentie")
|
||||
toForm.ct_clb_nume_client.SetFocus()
|
||||
Else
|
||||
If poDate.tip = 41
|
||||
loCauta = caut_gestiune_dest(poDate.id_client,[2,4,5,6,7]) && modificare v 2.0.71 : am adaugat 2
|
||||
Else
|
||||
loCauta = caut_gestiune_dest(poDate.id_client)
|
||||
Endif
|
||||
If !Isnull(loCauta) And !Empty(NVL(loCauta.id_gestiune,0))
|
||||
poDate.listaid = loCauta.id_gestiune
|
||||
poDate.descriere = loCauta.nume_gestiune
|
||||
|
||||
poDateGestiuneDest.id_gestiune = loCauta.id_gestiune
|
||||
poDateGestiuneDest.id_tipgest = loCauta.id_tipgest
|
||||
poDateGestiuneDest.Cont = Nvl(loCauta.Cont,[XXXX])
|
||||
poDateGestiuneDest.acont = Nvl(loCauta.acont,[XXXX])
|
||||
|
||||
toForm.ct_clb_altele.Refresh()
|
||||
toForm.ct_clb_politici_preturi.SetFocus()
|
||||
Endif
|
||||
Endif
|
||||
Endproc
|
||||
|
||||
Procedure do_cauta_gestiune_init
|
||||
Lparameters toForm
|
||||
Local llAviz
|
||||
llAviz = This.EsteAviz()
|
||||
loCauta = caut_gestiune(0,gnIdUtil)
|
||||
If !Isnull(loCauta) And !Empty(loCauta.id_gestiune)
|
||||
poDate.id_gestiune_init = loCauta.id_gestiune
|
||||
toForm.cgestiune_init = loCauta.nume_gestiune
|
||||
Else
|
||||
poDate.id_gestiune_init = Null
|
||||
toForm.cgestiune_init = []
|
||||
Endif
|
||||
toForm.ct_contabilitate.ct_clb_gestiune_init.Refresh()
|
||||
If m.llAviz
|
||||
toForm.buT_TERMIN1.SetFocus()
|
||||
Else
|
||||
*!* modificare ROACONTRACTE v 2.0.42
|
||||
*!* toForm.buT_TERMIN1.SetFocus()
|
||||
toForm.ct_contabilitate.ed_tx_simplu1._edbase1.SetFocus()
|
||||
*!* modificare ROACONTRACTE v 2.0.42 ^
|
||||
Endif
|
||||
Endproc
|
||||
|
||||
Procedure do_cauta_locatii
|
||||
Lparameters toForm
|
||||
Local loCauta
|
||||
loCauta = caut_locatie_restaurant()
|
||||
If !Isnull(loCauta) And !Empty(loCauta.id_rest_locatie)
|
||||
poDate.listaid = loCauta.id_rest_locatie
|
||||
poDate.descriere = loCauta.locatie
|
||||
toForm.ct_clb_altele.Refresh()
|
||||
toForm.but_TERMIN1.SetFocus()
|
||||
Endif
|
||||
Endproc
|
||||
|
||||
Procedure do_cauta_lucrare
|
||||
Lparameters toForm
|
||||
Local llAviz
|
||||
llAviz = This.EsteAviz()
|
||||
Local loCauta
|
||||
LOCAL llToateIreg, llNou, lcFiltruOriginal
|
||||
llToateIreg = .F.
|
||||
llNou = .T.
|
||||
lcFiltruOriginal = ''
|
||||
|
||||
loCauta = caut_lucrare(m.llToateIreg, m.llNou, m.lcFiltruOriginal)
|
||||
If m.llAviz
|
||||
|
||||
If !Empty(Nvl(loCauta.id_lucrare,0))
|
||||
poDate.id_lucrare = loCauta.id_lucrare
|
||||
poDate.nrord = loCauta.nrord
|
||||
Else
|
||||
poDate.id_lucrare = Null
|
||||
poDate.nrord = []
|
||||
Endif
|
||||
toForm.ct_contabilitate.ct_clb_lucrare.Refresh()
|
||||
Else
|
||||
*!* modificare v 2.0.46
|
||||
*!* If !Empty(Nvl(loCauta.id_lucrare,0))
|
||||
*!* poDate.id_lucrare = loCauta.id_lucrare
|
||||
*!* poDate.nrord = loCauta.nrord
|
||||
|
||||
*!* toForm.ct_contabilitate.ct_clb_lucrare.Refresh()
|
||||
*!* Endif
|
||||
If gnButon = 1
|
||||
poDate.id_lucrare = loCauta.id_lucrare
|
||||
poDate.nrord = loCauta.nrord
|
||||
Else
|
||||
poDate.id_lucrare = Null
|
||||
poDate.nrord = []
|
||||
Endif
|
||||
*!* modificare v 2.0.46 ^
|
||||
Endif
|
||||
toForm.ct_contabilitate.ct_clb_sectie.SetFocus()
|
||||
Endproc
|
||||
|
||||
Procedure do_cauta_politica
|
||||
Lparameters toForm
|
||||
Local loCauta
|
||||
loCauta = caut_politici_curente_util()
|
||||
If !Isnull(loCauta) And !Empty(Nvl(loCauta.id_pol,0))
|
||||
poDate.id_pol = loCauta.id_pol
|
||||
poDate.nume_politica = loCauta.nume
|
||||
|
||||
toForm.ct_clb_politici_preturi.SetFocus()
|
||||
If Type('toForm.ct_contabilitate.ct_clb_gestiune_init.visible')<>'U' && modificare v 2.0.41
|
||||
toForm.ct_contabilitate.ct_clb_gestiune_init.SetFocus()
|
||||
Else
|
||||
toForm.buT_TERMIN1.SetFocus()
|
||||
Endif
|
||||
Endif
|
||||
Endproc
|
||||
|
||||
Procedure do_cauta_responsabil
|
||||
Lparameters toForm
|
||||
Local loCauta
|
||||
loCauta = CautPartenerContabilitate(GetHash([cTitlu=>Responsabili??cTipuriParteneri=>]+Alltrim(Str(gnIdTipResponsabili))+[??lAdaugCorespondente=>1]))
|
||||
If !Empty(Nvl(loCauta.id_part,0)) And !Empty(loCauta.denumire)
|
||||
poDate.id_responsabil = loCauta.id_part
|
||||
poDate.responsabil = loCauta.denumire
|
||||
Else
|
||||
poDate.id_responsabil = Null
|
||||
poDate.responsabil = []
|
||||
Endif
|
||||
toForm.ct_contabilitate.ct_clb_responsabil.Refresh()
|
||||
Do Case
|
||||
Case Type('toForm.ct_clb_altele.visible')<>'U'
|
||||
toForm.ct_clb_altele.SetFocus()
|
||||
Case Type('toForm.ct_contabilitate.ct_clb_gestiune_init.visible')<>'U' && modificare v 2.0.41
|
||||
toForm.ct_contabilitate.ct_clb_gestiune_init.SetFocus()
|
||||
Otherwise
|
||||
toForm.buT_TERMIN1.SetFocus()
|
||||
Endcase
|
||||
Endproc
|
||||
|
||||
Procedure do_cauta_sectie
|
||||
Lparameters toForm
|
||||
Local llAviz
|
||||
llAviz = This.EsteAviz()
|
||||
Local loCauta
|
||||
LOCAL lnPornire, llDesktop, llToateIreg, llNou, lcFiltruOriginal
|
||||
lnPornire = 0
|
||||
llDesktop = .F.
|
||||
llToateIreg = .F.
|
||||
llNou = .T.
|
||||
lcFiltruOriginal = ''
|
||||
|
||||
loCauta = caut_sectie(lnPornire, llDesktop, m.llToateIreg, m.llNou, m.lcFiltruOriginal)
|
||||
If m.llAviz
|
||||
If !Empty(Nvl(loCauta.id_sectie,0))
|
||||
poDate.id_sectie = loCauta.id_sectie
|
||||
poDate.sectie = loCauta.sectie
|
||||
Else
|
||||
poDate.id_sectie = Null
|
||||
poDate.sectie = []
|
||||
Endif
|
||||
toForm.ct_contabilitate.ct_clb_sectie.Refresh()
|
||||
Else
|
||||
*!* modificare v 2.0.46
|
||||
*!* If !Empty(Nvl(loCauta.id_sectie,0))
|
||||
*!* poDate.id_sectie = loCauta.id_sectie
|
||||
*!* poDate.sectie = loCauta.sectie
|
||||
*!* toForm.ct_contabilitate.ct_clb_sectie.Refresh()
|
||||
*!* Endif
|
||||
If gnButon = 1
|
||||
poDate.id_sectie = loCauta.id_sectie
|
||||
poDate.sectie = loCauta.sectie
|
||||
Else
|
||||
poDate.id_sectie = Null
|
||||
poDate.sectie = []
|
||||
Endif
|
||||
toForm.ct_contabilitate.ct_clb_sectie.Refresh()
|
||||
*!* modificare v 2.0.46 ^
|
||||
Endif
|
||||
Do Case
|
||||
*!* modificare v 2.0.46
|
||||
Case Type('toForm.ct_contabilitate.ct_clb_venchelt.visible')<>'U'
|
||||
toForm.ct_contabilitate.ct_clb_venchelt.SetFocus()
|
||||
*!* modificare v 2.0.46 ^
|
||||
Case Type('toForm.ct_contabilitate.ct_clb_responsabil.visible')<>'U'
|
||||
toForm.ct_contabilitate.ct_clb_responsabil.SetFocus()
|
||||
Case Type('toForm.ct_clb_altele.visible')<>'U'
|
||||
If m.llAviz
|
||||
toForm.ct_clb_altele.Refresh()
|
||||
Endif
|
||||
toForm.ct_clb_altele.SetFocus()
|
||||
Case Type('toForm.ct_contabilitate.ct_clb_gestiune_init.visible')<>'U' && modificare v 2.0.41
|
||||
toForm.ct_contabilitate.ct_clb_gestiune_init.SetFocus()
|
||||
Otherwise
|
||||
toForm.buT_TERMIN1.SetFocus()
|
||||
Endcase
|
||||
Endproc
|
||||
|
||||
Procedure do_cauta_valuta
|
||||
Lparameters toForm
|
||||
Local loCauta
|
||||
loCauta = caut_valuta(1,.F.,.T.)
|
||||
If !Isnull(loCauta) And !Empty(loCauta.id_valuta)
|
||||
poDate.id_valuta = loCauta.id_valuta
|
||||
poDate.nume_valuta = loCauta.nume_val
|
||||
|
||||
toForm.ct_clb_valuta.Refresh()
|
||||
If Type('toForm.clb_zi_curs.visible')<>'U'
|
||||
toForm.clb_zi_curs.SetFocus()
|
||||
Else
|
||||
toForm.clb_serie_act1.SetFocus()
|
||||
Endif
|
||||
Endif
|
||||
Endproc
|
||||
|
||||
Procedure do_cauta_venchelt
|
||||
Lparameters toForm
|
||||
Local llAviz
|
||||
llAviz = This.EsteAviz()
|
||||
Local loCauta
|
||||
LOCAL lnPornire, llDesktop, lnTip, lnId, llToateIreg, llNou, lcFiltruOriginal
|
||||
lnPornire = 0
|
||||
llDesktop = .F.
|
||||
lnTip = 2 && venituri
|
||||
lnId = 0
|
||||
llToateIreg = .F.
|
||||
llNou = .T.
|
||||
lcFiltruOriginal = ''
|
||||
loCauta = caut_venchelt(m.lnPornire, m.llDesktop, m.lnTip, m.lnId, m.llToateIreg, m.llNou, m.lcFiltruOriginal)
|
||||
|
||||
If gnButon = 1
|
||||
poDate.id_venchelt = loCauta.id_venchelt
|
||||
poDate.venchelt = loCauta.explicatie
|
||||
Else
|
||||
poDate.id_venchelt = Null
|
||||
poDate.venchelt = []
|
||||
Endif
|
||||
toForm.ct_contabilitate.ct_clb_venchelt.Refresh()
|
||||
Do Case
|
||||
Case Type('toForm.ct_contabilitate.ct_clb_responsabil.visible')<>'U'
|
||||
toForm.ct_contabilitate.ct_clb_responsabil.SetFocus()
|
||||
Case Type('toForm.ct_clb_altele.visible')<>'U'
|
||||
If m.llAviz
|
||||
toForm.ct_clb_altele.Refresh()
|
||||
Endif
|
||||
toForm.ct_clb_altele.SetFocus()
|
||||
Case Type('toForm.ct_contabilitate.ct_clb_gestiune_init.visible')<>'U'
|
||||
toForm.ct_contabilitate.ct_clb_gestiune_init.SetFocus()
|
||||
Otherwise
|
||||
toForm.buT_TERMIN1.SetFocus()
|
||||
Endcase
|
||||
Endproc
|
||||
|
||||
Procedure do_verifica
|
||||
Lparameters toForm
|
||||
Local loDate As "empty"
|
||||
Local lnOptiune, lnRaspuns, loPartener
|
||||
|
||||
lnOptiune = 1
|
||||
loPartener = Null
|
||||
loDate = Createobject("empty")
|
||||
|
||||
AddProperty(loDate, "denumire", poDate.nume_client)
|
||||
AddProperty(loDate, "cod_fiscal", poDate.cod_fiscal)
|
||||
AddProperty(loDate, "tip_verificare", "ANAF_SERVICIU_WEB")
|
||||
|
||||
lnRaspuns = VerificaCodFiscal(loDate, @lnOptiune, @loPartener)
|
||||
Endproc
|
||||
|
||||
Procedure valideaza_antet
|
||||
Lparameters toForm
|
||||
Local plReturn,lcFacturi_dublate, llCopiere, llAviz
|
||||
Store .T. To plReturn
|
||||
llAviz = This.EsteAviz()
|
||||
llCopiere = toForm.lCopiere && copiere factura/aviz
|
||||
|
||||
Do Case
|
||||
Case Empty(poDate.dataireg)
|
||||
amessagebox("Nu ati completat data inregistrarii!",48,"Atentie")
|
||||
toForm.clb_dataireg.SetFocus()
|
||||
plReturn = .F.
|
||||
Case Empty(poDate.dataact)
|
||||
amessagebox("Nu ati completat data documentului!",48,"Atentie")
|
||||
toForm.clb_dataact.SetFocus()
|
||||
plReturn = .F.
|
||||
Case !m.llAviz And Empty(poDate.datascad)
|
||||
amessagebox("Nu ati completat data scadenta!",48,"Atentie")
|
||||
toForm.clb_data_scadenta.SetFocus()
|
||||
plReturn = .F.
|
||||
Case Isnull(poDate.id_fdoc) Or Empty(poDate.id_fdoc)
|
||||
amessagebox("Nu ati ales felul documentului!",48,"Atentie")
|
||||
toForm.clb_fdoc.SetFocus()
|
||||
plReturn = .F.
|
||||
*!* modificare v 2.0.56
|
||||
Case !m.llAviz And poDate.in_valuta = 1 And Empty(Nvl(poDate.zi_curs,{})) And Type('toForm.clb_zi_curs.visible')<>'U'
|
||||
*!* Case poDate.in_valuta = 1 And Empty(Nvl(poDate.zi_curs,{}))
|
||||
*!* modificare v 2.0.56 ^
|
||||
amessagebox("Nu ati completat ziua cursului valutar!",48,"Atentie")
|
||||
toForm.clb_zi_curs.SetFocus()
|
||||
plReturn = .F.
|
||||
Case !m.llAviz And poDate.in_valuta = 1 And Empty(Nvl(poDate.id_valuta,0))
|
||||
amessagebox("Nu ati completat valuta!",48,"Atentie")
|
||||
toForm.ct_clb_valuta.SetFocus()
|
||||
plReturn = .F.
|
||||
Case Empty(poDate.nract)
|
||||
amessagebox("Nu ati completat numarul documentului!",48,"Atentie")
|
||||
toForm.clb_nract.SetFocus()
|
||||
plReturn = .F.
|
||||
Case !Between(poDate.dataireg,Date(gnAn,gnLuna,1),Gomonth(Date(gnAn,gnLuna,1),1)-1)
|
||||
amessagebox("Data inregistrarii trebuie sa fie din luna "+Alltrim(Str(gnLuna))+"/"+Alltrim(Str(gnAn))+" !",48,"Atentie")
|
||||
toForm.clb_dataireg.SetFocus()
|
||||
plReturn = .F.
|
||||
Case !m.llAviz And poDate.datascad<poDate.dataact
|
||||
amessagebox("Data scadenta trebuie sa fie mai mare sau egala cu data documentului!",48,"Atentie")
|
||||
toForm.clb_data_scadenta.SetFocus()
|
||||
plReturn = .F.
|
||||
Case poDate.dataact>poDate.dataireg
|
||||
amessagebox("Data documentului trebuie sa fie mai mica sau egala cu data inregistrarii!",48,"Atentie")
|
||||
toForm.clb_dataact.SetFocus()
|
||||
plReturn = .F.
|
||||
Case !m.llAviz And (Empty(poDate.id_client) Or Isnull(poDate.id_client)) && aviz: fara validare client
|
||||
amessagebox("Nu ati ales clientul!",48,"Atentie")
|
||||
toForm.ct_clb_nume_client.SetFocus()
|
||||
plReturn = .F.
|
||||
Case !m.llAviz And Empty(Nvl(poDate.descriere,[])) And poDate.tip = 7
|
||||
amessagebox("Nu ati ales factura!",48,"Atentie")
|
||||
toForm.ct_clb_altele.SetFocus()
|
||||
plReturn = .F.
|
||||
Case !m.llAviz And Empty(Nvl(poDate.descriere,[])) And m.llCopiere
|
||||
amessagebox("Nu ati ales factura de copiat!",48,"Atentie")
|
||||
toForm.ct_clb_altele.SetFocus()
|
||||
plReturn = .F.
|
||||
Case m.llAviz And Empty(Nvl(poDate.descriere,[])) And m.llCopiere
|
||||
amessagebox("Nu ati ales avizul de copiat!",48,"Atentie")
|
||||
toForm.ct_clb_altele.SetFocus()
|
||||
plReturn = .F.
|
||||
*!* modificare v 2.0.56
|
||||
Case !m.llAviz And Empty(Nvl(poDate.descriere,[])) And Inlist(poDate.tip,8,9)
|
||||
amessagebox("Nu ati ales factura/facturile pentru care se face returul!",48,"Atentie")
|
||||
toForm.ct_clb_altele.SetFocus()
|
||||
plReturn = .F.
|
||||
*!* modificare v 2.0.56 ^
|
||||
Case !m.llAviz And Empty(Nvl(poDate.listaid,[])) And !Inlist(poDate.tip,1,5,7,8,9,10,48,49) && modificare : am adaugat 10 ( v 2.0.56 ), 48 ( v 2.0.93 ), 49 ( v 2.0.95 )
|
||||
Do Case
|
||||
Case Inlist(poDate.tip, 2, 6, 52)
|
||||
lcMesaj = [Nu ati ales contractul!]
|
||||
Case poDate.tip = 3
|
||||
lcMesaj = [Nu ati ales comanda!]
|
||||
Case poDate.tip = 4
|
||||
lcMesaj = [Nu ati ales avizul!]
|
||||
Case poDate.tip = 45 && modificare v 2.0.87
|
||||
lcMesaj = [Nu ati ales locatia!]
|
||||
Endcase
|
||||
amessagebox(lcMesaj,48,"Atentie")
|
||||
toForm.ct_clb_altele.SetFocus()
|
||||
plReturn = .F.
|
||||
Case m.llAviz And Empty(Nvl(poDate.listaid,[])) And Inlist(poDate.tip,21,23,25,26,28,41,42,47) && modificare v 2.0.93 : am adaugat 47
|
||||
Do Case
|
||||
Case INLIST(poDate.tip,21,25,28,42,47) && modificare v 2.0.93 : am adaugat 47
|
||||
lcMesaj = [Nu ati ales comanda!]
|
||||
Case poDate.tip = 23
|
||||
lcMesaj = [Nu ati ales gestiunea destinatie!]
|
||||
*!* modificare v 2.0.16
|
||||
Case poDate.tip = 41
|
||||
lcMesaj = [Nu ati ales gestiunea catre care se face returul!]
|
||||
*!* modificare v 2.0.16 ^
|
||||
Case poDate.tip = 26
|
||||
lcMesaj = [Nu ati ales contractul!]
|
||||
Endcase
|
||||
amessagebox(lcMesaj,48,"Atentie")
|
||||
toForm.ct_clb_altele.SetFocus()
|
||||
plReturn = .F.
|
||||
Case m.llAviz And Empty(Nvl(poDate.id_pol,0)) And InList(poDate.tip,23,41)
|
||||
amessagebox("Nu ati ales politica de preturi!",48,"Atentie")
|
||||
toForm.ct_clb_politici_preturi.SetFocus()
|
||||
plReturn = .F.
|
||||
Otherwise
|
||||
*!* modificare v 2.0.46
|
||||
*!* plReturn = .T.
|
||||
lcFacturi_dublate = facturi_duplicate(Iif(m.llAviz,'418','4111'), 0, poDate.serie_act, poDate.nract, [])
|
||||
If !Empty(lcFacturi_dublate)
|
||||
lnRaspuns = amessagebox(lcFacturi_dublate + Chr(13)+"Doriti sa continuati?",4+32,Iif(m.llAviz,"Avize dublate","Facturi dublate"))
|
||||
plReturn = (m.lnRaspuns = 6)
|
||||
Endif
|
||||
*!* modificare v 2.0.46 ^
|
||||
|
||||
* Daca FACTURA si clientul se numeste "CLIENT"[I DIVERSI]
|
||||
* Atentionez ca ar trebui sa se aleaga "BON FISCAL" in loc de "FACTURA"
|
||||
IF poDate.nIdTipDoc = poDate.nIdTipDocFactura AND 'CLIENT'$UPPER(NVL(poDate.nume_client,''))
|
||||
lnRaspuns = amessagebox('Ati ales clientul ' + ALLTRIM(poDate.nume_client) + ' si Tip document = FACTURA in loc de BON FISCAL' + Chr(13)+"Doriti sa continuati?",4+32,"Bon Fiscal")
|
||||
plReturn = (m.lnRaspuns = 6)
|
||||
ENDIF
|
||||
Endcase
|
||||
Return plReturn
|
||||
Endproc
|
||||
|
||||
Function alege_tipdoc
|
||||
Lparameters tcTipDoc
|
||||
LOCAL lnIdTipDoc, lcTipDoc
|
||||
lcTipDoc = UPPER(m.tcTipDoc)
|
||||
|
||||
lnIdTipDoc = IIF(m.lcTipDoc = 'FACTURA', poDate.nIdTipDocFactura, ;
|
||||
IIF(m.lcTipDoc = 'PROFORMA', poDate.nIdTipDocProforma, ;
|
||||
IIF(m.lcTipDoc = 'BON FISCAL', poDate.nIdTipDocBonFiscal, ;
|
||||
IIF(m.lcTipDoc = 'AVIZ', poDate.nIdTipDocAvizExpeditie, poDate.nIdTipDocFactura))))
|
||||
|
||||
*!* poDate.nIdTipDocFactura = 5
|
||||
*!* poDate.nIdTipDocProforma = 23
|
||||
*!* poDate.nIdTipDocBonFiscal = 3
|
||||
*!* poDate.nIdTipDocAvizExpeditie = 6
|
||||
|
||||
*!* poDate.eProforma = IIF(m.lnIdTipDoc = poDate.nIdTipDocProforma, 1, 0)
|
||||
*!* poDate.eBonFiscal = IIF(m.lnIdTipDoc = poDate.nIdTipDocBonFiscal, 1, 0)
|
||||
poDate.initializeaza_setari_document(IIF(m.lnIdTipDoc = poDate.nIdTipDocBonFiscal, -101, IIF(m.lnIdTipDoc = poDate.nIdTipDocProforma, -102, poDate.Tip)))
|
||||
Return m.lnIdTipDoc
|
||||
Endfunc
|
||||
|
||||
Function schimba_tipdoc
|
||||
Lparameters tnIdTipDoc
|
||||
IF poDate.nIdTipDoc = m.tnIdTipDoc
|
||||
RETURN .F.
|
||||
ENDIF
|
||||
|
||||
poDate.nract = 0
|
||||
poDate.serie_act = ""
|
||||
|
||||
poGeneratorNumere.dezaloca_numar(poDate.nIdTipDoc)
|
||||
poDate.nIdTipDoc = m.tnIdTipDoc && se initializeaza automat si .eBonFiscal, .eProforma
|
||||
poDate.rezultat_serii = poGeneratorNumere.creeaza_cursor_serii(poDate.nIdTipDoc) && 1 = CU SERIE, 2 = FARA SERIE CU PLAJE, 3 = CU SERIE SI PLAJE
|
||||
Return .T.
|
||||
Endfunc
|
||||
|
||||
Enddefine
|
||||
Reference in New Issue
Block a user