From 75d8ded892af4fe9605d620a242e6b5f9b1ecde9 Mon Sep 17 00:00:00 2001 From: Marius Mutu Date: Sat, 25 Jul 2026 22:05:33 +0300 Subject: [PATCH] achizitie import: diferenta (randul D) doar din documentele participante la pret; randul D manual pastrat la resincronizare; test e2e; stergere clasa legacy import_nir + ajustari layout (IDE) Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01KXsyJZBek1e9RvyLAQkoCx --- clase/ointroduceri.vc2 | 1549 +---------------- .../test_runda11_diferenta_participa.prg | 765 ++++++++ .../test_runda11_diferenta_participa.ps1 | 10 + 3 files changed, 830 insertions(+), 1494 deletions(-) create mode 100644 utile/Teste/achizitie_import/test_runda11_diferenta_participa.prg create mode 100644 utile/Teste/achizitie_import/test_runda11_diferenta_participa.ps1 diff --git a/clase/ointroduceri.vc2 b/clase/ointroduceri.vc2 index 2884be7..2ba18cb 100644 --- a/clase/ointroduceri.vc2 +++ b/clase/ointroduceri.vc2 @@ -6428,1475 +6428,6 @@ DEFINE CLASS import_adauga_factura AS _frmbase OF "_frm_base.vcx" ENDDEFINE -DEFINE CLASS import_nir AS frm_termin_renunt OF "_frm_child.vcx" - *< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" /> - - *-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder - *< OBJECTDATA: ObjPath="Label3" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Cmd_executa1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Clb_leiftva" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Clb_leiadaos" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Clb_leitva" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Clb_valftva" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Clb_valadaos" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Clb_valtva" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="lblLei" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="lblValuta" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cDenumire.Header1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cDenumire.Text1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cCodMat.Header1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cCodMat.Text1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cCant.Header1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cCant.Text1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cPretFactura.Header1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cPretFactura.Text1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cPretValutaCalculat.Header1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cPretValutaCalculat.Text1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cPretLeiCalculat.Header1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cPretLeiCalculat.Text1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cValoareValutaFactura.Header1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cValoareValutaFactura.Text1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cValoareValutaCalculat.Header1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cValoareValutaCalculat.Text1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cValoareLeiCalculat.Header1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cValoareLeiCalculat.Text1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cCont.Header1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cCont.Text1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cAcont.Header1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cAcont.Text1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cSerie.Header1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cSerie.Text1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cLot.Header1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cLot.Text1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cAdata_expirare.Header1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.cAdata_expirare.Text1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.Column1.Header1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Grid1.Column1.Text1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Clb_diferente_lei" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="clb_diferente_valuta" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Cmd_adauga1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Cmd_adauga2" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="But_modiparam1" UniqueID="" Timestamp="" /> - - * - *m: assign_analitic - *m: do_calculeaza_diferente - *m: do_modiparam - *p: lintern && Achizitie din import (.F.) / din intern (.T.) - *p: nbaza_lei - *p: nbaza_val - *p: ncurs - *p: ndif_lei - *p: ndif_val - *p: ntva_lei - *p: ntva_val - *p: oact - *p: procent_lei - *p: procent_val - * - - * - BorderStyle = 1 - DoCreate = .T. - FontCharSet = 238 - Height = 432 - lintern = .F. - Name = "import_nir" - nbaza_lei = 0 - nbaza_val = 0 - ncurs = 0 - ndif_lei = 0 - ndif_val = 0 - ntva_lei = 0 - ntva_val = 0 - oact = .F. - procent_lei = 0 - procent_val = 0 - Width = 768 - _shape1.Anchor = 10 - _shape1.Height = 29 - _shape1.Left = -12 - _shape1.Name = "_shape1" - _shape1.Top = 0 - _shape1.Width = 797 - _shape2.Height = 29 - _shape2.Left = 673 - _shape2.Name = "_shape2" - _shape2.Top = 0 - _shape2.Visible = .F. - _shape2.Width = 194 - Lb_titlu_alb_b121.Caption = "INTRARE IN GESTIUNE MARFĂ/MATERIALE IMPORT" - Lb_titlu_alb_b121.FontSize = 11 - Lb_titlu_alb_b121.Name = "Lb_titlu_alb_b121" - Lb_titlu_alb_b121.TabIndex = 1 - BUT_TERMIN1.Anchor = 8 - BUT_TERMIN1.Left = 738 - BUT_TERMIN1.Name = "BUT_TERMIN1" - BUT_TERMIN1.TabIndex = 2 - BUT_TERMIN1.Top = 1 - Gridsort1.Name = "Gridsort1" - But_renunt1.Anchor = 8 - But_renunt1.Left = 707 - But_renunt1.Name = "But_renunt1" - But_renunt1.TabIndex = 3 - But_renunt1.Top = 1 - * - - ADD OBJECT 'But_modiparam1' AS but_modiparam WITH ; - Anchor = 8, ; - Left = 677, ; - Name = "But_modiparam1", ; - ToolTipText = "Import fisier XLS", ; - Top = 1 - *< END OBJECT: ClassLib="cmd_butoane.vcx" BaseClass="commandbutton" /> - - ADD OBJECT 'Clb_diferente_lei' AS clb_tx_simplu WITH ; - Anchor = 12, ; - Height = 29, ; - Left = 543, ; - Name = "Clb_diferente_lei", ; - TabIndex = 15, ; - TabStop = .F., ; - Top = 392, ; - Width = 219, ; - Text_simplu1.ControlSource = "thisform.ndif_lei", ; - Text_simplu1.DisabledBackColor = 230,242,255, ; - Text_simplu1.FontName = "Arial Narrow", ; - Text_simplu1.FontSize = 10, ; - Text_simplu1.Height = 23, ; - Text_simplu1.InputMask = (get_mask(10,gnPc)), ; - Text_simplu1.Left = 79, ; - Text_simplu1.Name = "Text_simplu1", ; - Text_simplu1.ReadOnly = .T., ; - Text_simplu1.Top = 3, ; - Text_simplu1.Width = 135, ; - Lb_simplu1.Caption = "Diferențe lei", ; - Lb_simplu1.Comment = "", ; - Lb_simplu1.Name = "Lb_simplu1" - *< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" /> - - ADD OBJECT 'clb_diferente_valuta' AS clb_tx_simplu WITH ; - Anchor = 12, ; - Height = 29, ; - Left = 318, ; - Name = "clb_diferente_valuta", ; - TabIndex = 16, ; - TabStop = .F., ; - Top = 392, ; - Width = 226, ; - Text_simplu1.ControlSource = "thisform.ndif_val", ; - Text_simplu1.DisabledBackColor = 240,248,255, ; - Text_simplu1.FontName = "Arial Narrow", ; - Text_simplu1.FontSize = 10, ; - Text_simplu1.Height = 23, ; - Text_simplu1.InputMask = (get_mask(10,gnPval)), ; - Text_simplu1.Left = 98, ; - Text_simplu1.Name = "Text_simplu1", ; - Text_simplu1.ReadOnly = .T., ; - Text_simplu1.Top = 3, ; - Text_simplu1.Width = 125, ; - Lb_simplu1.Caption = "Diferențe valută", ; - Lb_simplu1.Comment = "", ; - Lb_simplu1.Name = "Lb_simplu1" - *< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" /> - - ADD OBJECT 'Clb_leiadaos' AS clb_tx_simplu WITH ; - Height = 29, ; - Left = 615, ; - Name = "Clb_leiadaos", ; - TabIndex = 7, ; - TabStop = .F., ; - Top = 51, ; - Width = 146, ; - Text_simplu1.ControlSource = "thisform.procent_lei", ; - Text_simplu1.FontName = "Arial Narrow", ; - Text_simplu1.FontSize = 10, ; - Text_simplu1.Height = 23, ; - Text_simplu1.InputMask = "9999.99", ; - Text_simplu1.Left = 93, ; - Text_simplu1.Name = "Text_simplu1", ; - Text_simplu1.ReadOnly = .T., ; - Text_simplu1.Top = 3, ; - Text_simplu1.Width = 49, ; - Lb_simplu1.Caption = "Procent adaos", ; - Lb_simplu1.Name = "Lb_simplu1" - *< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" /> - - ADD OBJECT 'Clb_leiftva' AS clb_tx_simplu WITH ; - Height = 29, ; - Left = 69, ; - Name = "Clb_leiftva", ; - TabIndex = 6, ; - TabStop = .F., ; - Top = 51, ; - Width = 270, ; - Text_simplu1.ControlSource = "thisform.nbaza_lei", ; - Text_simplu1.FontName = "Arial Narrow", ; - Text_simplu1.FontSize = 10, ; - Text_simplu1.Height = 23, ; - Text_simplu1.InputMask = (get_mask(10,gnPc)), ; - Text_simplu1.Left = 131, ; - Text_simplu1.Name = "Text_simplu1", ; - Text_simplu1.ReadOnly = .T., ; - Text_simplu1.Top = 3, ; - Text_simplu1.Width = 135, ; - Lb_simplu1.Caption = "Total facturat fără TVA", ; - Lb_simplu1.Comment = "", ; - Lb_simplu1.Name = "Lb_simplu1" - *< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" /> - - ADD OBJECT 'Clb_leitva' AS clb_tx_simplu WITH ; - Height = 29, ; - Left = 342, ; - Name = "Clb_leitva", ; - TabIndex = 8, ; - TabStop = .F., ; - Top = 51, ; - Width = 270, ; - Text_simplu1.ControlSource = "thisform.ntva_lei", ; - Text_simplu1.FontName = "Arial Narrow", ; - Text_simplu1.FontSize = 10, ; - Text_simplu1.Height = 23, ; - Text_simplu1.InputMask = (get_mask(10,gnPc)), ; - Text_simplu1.Left = 131, ; - Text_simplu1.Name = "Text_simplu1", ; - Text_simplu1.ReadOnly = .T., ; - Text_simplu1.Top = 3, ; - Text_simplu1.Width = 135, ; - Lb_simplu1.Caption = "Total facturat TVA", ; - Lb_simplu1.Comment = "", ; - Lb_simplu1.Name = "Lb_simplu1" - *< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" /> - - ADD OBJECT 'Clb_valadaos' AS clb_tx_simplu WITH ; - Height = 29, ; - Left = 615, ; - Name = "Clb_valadaos", ; - TabIndex = 10, ; - TabStop = .F., ; - Top = 79, ; - Width = 146, ; - Text_simplu1.ControlSource = "thisform.procent_val", ; - Text_simplu1.FontName = "Arial Narrow", ; - Text_simplu1.FontSize = 10, ; - Text_simplu1.Height = 23, ; - Text_simplu1.InputMask = "9999.99", ; - Text_simplu1.Left = 93, ; - Text_simplu1.Name = "Text_simplu1", ; - Text_simplu1.ReadOnly = .T., ; - Text_simplu1.Top = 3, ; - Text_simplu1.Width = 49, ; - Lb_simplu1.Caption = "Procent adaos", ; - Lb_simplu1.Name = "Lb_simplu1" - *< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" /> - - ADD OBJECT 'Clb_valftva' AS clb_tx_simplu WITH ; - Height = 29, ; - Left = 69, ; - Name = "Clb_valftva", ; - TabIndex = 9, ; - TabStop = .F., ; - Top = 79, ; - Width = 270, ; - Text_simplu1.ControlSource = "thisform.nbaza_val", ; - Text_simplu1.FontName = "Arial Narrow", ; - Text_simplu1.FontSize = 10, ; - Text_simplu1.Height = 23, ; - Text_simplu1.InputMask = (get_mask(10,gnPval)), ; - Text_simplu1.Left = 131, ; - Text_simplu1.Name = "Text_simplu1", ; - Text_simplu1.ReadOnly = .T., ; - Text_simplu1.Top = 3, ; - Text_simplu1.Width = 135, ; - Lb_simplu1.Caption = "Total facturat fără TVA", ; - Lb_simplu1.Comment = "", ; - Lb_simplu1.Name = "Lb_simplu1" - *< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" /> - - ADD OBJECT 'Clb_valtva' AS clb_tx_simplu WITH ; - Height = 29, ; - Left = 342, ; - Name = "Clb_valtva", ; - TabIndex = 11, ; - TabStop = .F., ; - Top = 79, ; - Width = 270, ; - Text_simplu1.ControlSource = "thisform.ntva_val", ; - Text_simplu1.FontName = "Arial Narrow", ; - Text_simplu1.FontSize = 10, ; - Text_simplu1.Height = 23, ; - Text_simplu1.InputMask = (get_mask(10,gnPval)), ; - Text_simplu1.Left = 131, ; - Text_simplu1.Name = "Text_simplu1", ; - Text_simplu1.ReadOnly = .T., ; - Text_simplu1.Top = 3, ; - Text_simplu1.Width = 135, ; - Lb_simplu1.Caption = "Total facturat TVA", ; - Lb_simplu1.Comment = "", ; - Lb_simplu1.Name = "Lb_simplu1" - *< END OBJECT: ClassLib="lb_tx.vcx" BaseClass="container" /> - - ADD OBJECT 'Cmd_adauga1' AS cmd_adauga WITH ; - Anchor = 4, ; - Caption = "\ - - ADD OBJECT 'Cmd_adauga2' AS cmd_adauga WITH ; - Anchor = 4, ; - caction = do_copie, ; - Caption = "\ - - ADD OBJECT 'Cmd_executa1' AS cmd_executa WITH ; - Anchor = 4, ; - caction = do_Reface, ; - Caption = "\ - - ADD OBJECT 'Grid1' AS grid WITH ; - Anchor = 15, ; - ColumnCount = 15, ; - FontSize = 10, ; - Height = 273, ; - Left = 7, ; - Name = "Grid1", ; - Panel = 1, ; - RecordSource = "rul_temp", ; - RowHeight = 19, ; - TabIndex = 14, ; - Top = 115, ; - Width = 756, ; - Column1.ControlSource = "denumire", ; - Column1.FontName = "Arial", ; - Column1.FontSize = 10, ; - Column1.Name = "cDenumire", ; - Column1.ReadOnly = .T., ; - Column1.Width = 181, ; - Column2.ControlSource = "codmat", ; - Column2.FontName = "Arial", ; - Column2.FontSize = 10, ; - Column2.Name = "cCodMat", ; - Column2.ReadOnly = .T., ; - Column2.Width = 84, ; - Column3.BackColor = 240,248,255, ; - Column3.ColumnOrder = 6, ; - Column3.ControlSource = "cant", ; - Column3.FontName = "Arial", ; - Column3.FontSize = 10, ; - Column3.InputMask = (get_mask(10,gnPcant)), ; - Column3.Name = "cCant", ; - Column3.Width = 67, ; - Column4.BackColor = 230,242,255, ; - Column4.ColumnOrder = 7, ; - Column4.ControlSource = "pret_val", ; - Column4.FontName = "Arial", ; - Column4.FontSize = 10, ; - Column4.InputMask = (get_mask(10,gnPpretval)), ; - Column4.Name = "cPretFactura", ; - Column4.Width = 108, ; - Column5.BackColor = 240,248,255, ; - Column5.ColumnOrder = 9, ; - Column5.ControlSource = "pretd", ; - Column5.FontName = "Arial", ; - Column5.FontSize = 10, ; - Column5.InputMask = (get_mask(10,gnPPretval)), ; - Column5.Name = "cPretValutaCalculat", ; - Column5.Width = 114, ; - Column6.BackColor = 230,242,255, ; - Column6.ColumnOrder = 10, ; - Column6.ControlSource = "pret", ; - Column6.FontName = "Arial", ; - Column6.FontSize = 10, ; - Column6.InputMask = (get_mask(10,gnPpret)), ; - Column6.Name = "cPretLeiCalculat", ; - Column6.Width = 83, ; - Column7.Bound = .F., ; - Column7.ColumnOrder = 11, ; - Column7.ControlSource = "round(pret_val*cant, gnPval)", ; - Column7.FontName = "Arial", ; - Column7.FontSize = 10, ; - Column7.InputMask = (get_mask(16,gnPval)), ; - Column7.Name = "cValoareValutaFactura", ; - Column7.Width = 128, ; - Column8.Bound = .F., ; - Column8.ColumnOrder = 12, ; - Column8.ControlSource = "round(pretd*cant, gnPval)", ; - Column8.FontName = "Arial", ; - Column8.FontSize = 10, ; - Column8.InputMask = (get_mask(16,gnPval)), ; - Column8.Name = "cValoareValutaCalculat", ; - Column8.Width = 97, ; - Column9.Bound = .F., ; - Column9.ColumnOrder = 13, ; - Column9.ControlSource = "round(pret*cant, gnPc)", ; - Column9.FontName = "Arial", ; - Column9.FontSize = 10, ; - Column9.InputMask = (get_mask(10,gnPc)), ; - Column9.Name = "cValoareLeiCalculat", ; - Column9.Width = 104, ; - Column10.BackColor = 240,248,255, ; - Column10.ColumnOrder = 4, ; - Column10.ControlSource = "cont", ; - Column10.FontName = "Arial", ; - Column10.FontSize = 10, ; - Column10.Name = "cCont", ; - Column10.ReadOnly = .F., ; - Column10.Width = 43, ; - Column11.BackColor = 240,248,255, ; - Column11.ColumnOrder = 5, ; - Column11.ControlSource = "acont", ; - Column11.FontName = "Arial", ; - Column11.FontSize = 10, ; - Column11.Name = "cAcont", ; - Column11.ReadOnly = .F., ; - Column11.Width = 47, ; - Column12.BackColor = 240,248,255, ; - Column12.ColumnOrder = 3, ; - Column12.ControlSource = "serie", ; - Column12.FontName = "Arial", ; - Column12.FontSize = 10, ; - Column12.Format = "!K", ; - Column12.Name = "cSerie", ; - Column12.Width = 123, ; - Column13.BackColor = 240,248,255, ; - Column13.ColumnOrder = 14, ; - Column13.ControlSource = "lot", ; - Column13.FontName = "Arial", ; - Column13.FontSize = 10, ; - Column13.Name = "cLot", ; - Column14.BackColor = 240,248,255, ; - Column14.ColumnOrder = 15, ; - Column14.ControlSource = "adata_expirare", ; - Column14.FontName = "Arial", ; - Column14.FontSize = 10, ; - Column14.Name = "cAdata_expirare", ; - Column14.Width = 79, ; - Column15.BackColor = 240,248,255, ; - Column15.ColumnOrder = 8, ; - Column15.ControlSource = "proc_disc", ; - Column15.FontName = "Arial", ; - Column15.FontSize = 10, ; - Column15.InputMask = (get_mask(3,2)), ; - Column15.Name = "Column1", ; - Column15.Width = 50 - *< END OBJECT: BaseClass="grid" /> - - ADD OBJECT 'Grid1.cAcont.Header1' AS header WITH ; - Alignment = 2, ; - Caption = "Analitic", ; - FontName = "Arial", ; - FontSize = 10, ; - Name = "Header1" - *< END OBJECT: BaseClass="header" /> - - ADD OBJECT 'Grid1.cAcont.Text1' AS textbox WITH ; - BackColor = 240,248,255, ; - BorderStyle = 0, ; - FontName = "Arial", ; - FontSize = 10, ; - ForeColor = 0,0,0, ; - Margin = 0, ; - Name = "Text1", ; - ReadOnly = .F. - *< END OBJECT: BaseClass="textbox" /> - - ADD OBJECT 'Grid1.cAdata_expirare.Header1' AS header WITH ; - Alignment = 2, ; - Caption = "Data expirare", ; - FontName = "Arial", ; - FontSize = 10, ; - Name = "Header1" - *< END OBJECT: BaseClass="header" /> - - ADD OBJECT 'Grid1.cAdata_expirare.Text1' AS textbox WITH ; - BackColor = 240,248,255, ; - BorderStyle = 0, ; - FontName = "Arial", ; - FontSize = 10, ; - ForeColor = 0,0,0, ; - Margin = 0, ; - Name = "Text1" - *< END OBJECT: BaseClass="textbox" /> - - ADD OBJECT 'Grid1.cCant.Header1' AS header WITH ; - Alignment = 2, ; - Caption = "Cantitate", ; - FontName = "Arial", ; - FontSize = 10, ; - Name = "Header1" - *< END OBJECT: BaseClass="header" /> - - ADD OBJECT 'Grid1.cCant.Text1' AS textbox WITH ; - BackColor = 240,248,255, ; - BorderStyle = 0, ; - FontName = "Arial", ; - FontSize = 10, ; - ForeColor = 0,0,0, ; - Margin = 0, ; - Name = "Text1" - *< END OBJECT: BaseClass="textbox" /> - - ADD OBJECT 'Grid1.cCodMat.Header1' AS header WITH ; - Alignment = 2, ; - Caption = "Cod material", ; - FontName = "Arial", ; - FontSize = 10, ; - Name = "Header1" - *< END OBJECT: BaseClass="header" /> - - ADD OBJECT 'Grid1.cCodMat.Text1' AS textbox WITH ; - BackColor = 255,255,255, ; - BorderStyle = 0, ; - FontName = "Arial", ; - FontSize = 10, ; - ForeColor = 0,0,0, ; - Margin = 0, ; - Name = "Text1", ; - ReadOnly = .T. - *< END OBJECT: BaseClass="textbox" /> - - ADD OBJECT 'Grid1.cCont.Header1' AS header WITH ; - Alignment = 2, ; - Caption = "Cont", ; - FontName = "Arial", ; - FontSize = 10, ; - Name = "Header1" - *< END OBJECT: BaseClass="header" /> - - ADD OBJECT 'Grid1.cCont.Text1' AS textbox WITH ; - BackColor = 240,248,255, ; - BorderStyle = 0, ; - FontName = "Arial", ; - FontSize = 10, ; - ForeColor = 0,0,0, ; - Margin = 0, ; - Name = "Text1", ; - ReadOnly = .F. - *< END OBJECT: BaseClass="textbox" /> - - ADD OBJECT 'Grid1.cDenumire.Header1' AS header WITH ; - Alignment = 2, ; - Caption = "Denumire", ; - FontName = "Arial", ; - FontSize = 10, ; - Name = "Header1" - *< END OBJECT: BaseClass="header" /> - - ADD OBJECT 'Grid1.cDenumire.Text1' AS textbox WITH ; - BackColor = 255,255,255, ; - BorderStyle = 0, ; - FontName = "Arial", ; - FontSize = 10, ; - ForeColor = 0,0,0, ; - Margin = 0, ; - Name = "Text1", ; - ReadOnly = .T. - *< END OBJECT: BaseClass="textbox" /> - - ADD OBJECT 'Grid1.cLot.Header1' AS header WITH ; - Alignment = 2, ; - Caption = "Lot", ; - FontName = "Arial", ; - FontSize = 10, ; - Name = "Header1" - *< END OBJECT: BaseClass="header" /> - - ADD OBJECT 'Grid1.cLot.Text1' AS textbox WITH ; - BackColor = 240,248,255, ; - BorderStyle = 0, ; - FontName = "Arial", ; - FontSize = 10, ; - ForeColor = 0,0,0, ; - Margin = 0, ; - Name = "Text1" - *< END OBJECT: BaseClass="textbox" /> - - ADD OBJECT 'Grid1.Column1.Header1' AS header WITH ; - Caption = "Disc. %", ; - FontName = "Arial", ; - FontSize = 10, ; - Name = "Header1" - *< END OBJECT: BaseClass="header" /> - - ADD OBJECT 'Grid1.Column1.Text1' AS textbox WITH ; - BackColor = 240,248,255, ; - BorderStyle = 0, ; - FontName = "Arial", ; - FontSize = 10, ; - ForeColor = 0,0,0, ; - Margin = 0, ; - Name = "Text1" - *< END OBJECT: BaseClass="textbox" /> - - ADD OBJECT 'Grid1.cPretFactura.Header1' AS header WITH ; - Alignment = 2, ; - Caption = "Pret valuta factura", ; - FontName = "Arial", ; - FontSize = 10, ; - Name = "Header1" - *< END OBJECT: BaseClass="header" /> - - ADD OBJECT 'Grid1.cPretFactura.Text1' AS textbox WITH ; - BackColor = 230,242,255, ; - BorderStyle = 0, ; - FontName = "Arial", ; - FontSize = 10, ; - ForeColor = 0,0,0, ; - Margin = 0, ; - Name = "Text1" - *< END OBJECT: BaseClass="textbox" /> - - ADD OBJECT 'Grid1.cPretLeiCalculat.Header1' AS header WITH ; - Alignment = 2, ; - Caption = "Pret unitar", ; - FontName = "Arial", ; - FontSize = 10, ; - Name = "Header1" - *< END OBJECT: BaseClass="header" /> - - ADD OBJECT 'Grid1.cPretLeiCalculat.Text1' AS textbox WITH ; - BackColor = 230,242,255, ; - BorderStyle = 0, ; - FontName = "Arial", ; - FontSize = 10, ; - ForeColor = 0,0,0, ; - Margin = 0, ; - Name = "Text1" - *< END OBJECT: BaseClass="textbox" /> - - ADD OBJECT 'Grid1.cPretValutaCalculat.Header1' AS header WITH ; - Alignment = 2, ; - Caption = "Pret valuta calculat", ; - FontName = "Arial", ; - FontSize = 10, ; - Name = "Header1" - *< END OBJECT: BaseClass="header" /> - - ADD OBJECT 'Grid1.cPretValutaCalculat.Text1' AS textbox WITH ; - BackColor = 240,248,255, ; - BorderStyle = 0, ; - FontName = "Arial", ; - FontSize = 10, ; - ForeColor = 0,0,0, ; - Margin = 0, ; - Name = "Text1" - *< END OBJECT: BaseClass="textbox" /> - - ADD OBJECT 'Grid1.cSerie.Header1' AS header WITH ; - Alignment = 2, ; - Caption = "Serie", ; - FontName = "Arial", ; - FontSize = 10, ; - Name = "Header1" - *< END OBJECT: BaseClass="header" /> - - ADD OBJECT 'Grid1.cSerie.Text1' AS textbox WITH ; - BackColor = 240,248,255, ; - BorderStyle = 0, ; - FontName = "Arial", ; - FontSize = 10, ; - ForeColor = 0,0,0, ; - Margin = 0, ; - Name = "Text1" - *< END OBJECT: BaseClass="textbox" /> - - ADD OBJECT 'Grid1.cValoareLeiCalculat.Header1' AS header WITH ; - Alignment = 2, ; - Caption = "Valoare", ; - FontName = "Arial", ; - FontSize = 10, ; - Name = "Header1" - *< END OBJECT: BaseClass="header" /> - - ADD OBJECT 'Grid1.cValoareLeiCalculat.Text1' AS textbox WITH ; - BackColor = 255,255,255, ; - BorderStyle = 0, ; - FontName = "Arial", ; - FontSize = 10, ; - ForeColor = 0,0,0, ; - Margin = 0, ; - Name = "Text1" - *< END OBJECT: BaseClass="textbox" /> - - ADD OBJECT 'Grid1.cValoareValutaCalculat.Header1' AS header WITH ; - Alignment = 2, ; - Caption = "Valoare valuta", ; - FontName = "Arial", ; - FontSize = 10, ; - Name = "Header1" - *< END OBJECT: BaseClass="header" /> - - ADD OBJECT 'Grid1.cValoareValutaCalculat.Text1' AS textbox WITH ; - BackColor = 255,255,255, ; - BorderStyle = 0, ; - FontName = "Arial", ; - FontSize = 10, ; - ForeColor = 0,0,0, ; - Margin = 0, ; - Name = "Text1" - *< END OBJECT: BaseClass="textbox" /> - - ADD OBJECT 'Grid1.cValoareValutaFactura.Header1' AS header WITH ; - Alignment = 2, ; - Caption = "Valoare valuta factura", ; - FontName = "Arial", ; - FontSize = 10, ; - Name = "Header1" - *< END OBJECT: BaseClass="header" /> - - ADD OBJECT 'Grid1.cValoareValutaFactura.Text1' AS textbox WITH ; - BackColor = 255,255,255, ; - BorderStyle = 0, ; - FontName = "Arial", ; - FontSize = 10, ; - ForeColor = 0,0,0, ; - Margin = 0, ; - Name = "Text1" - *< END OBJECT: BaseClass="textbox" /> - - ADD OBJECT 'Label3' AS label WITH ; - AutoSize = .T., ; - BackStyle = 0, ; - Caption = "Moneda", ; - FontBold = .T., ; - Height = 17, ; - Left = 7, ; - Name = "Label3", ; - TabIndex = 4, ; - Top = 35, ; - Width = 45, ; - WordWrap = .T. - *< END OBJECT: BaseClass="label" /> - - ADD OBJECT 'lblLei' AS label WITH ; - AutoSize = .T., ; - BackStyle = 0, ; - Caption = "Națională", ; - FontCharSet = 238, ; - Height = 17, ; - Left = 12, ; - Name = "lblLei", ; - TabIndex = 12, ; - Top = 57, ; - Width = 53, ; - WordWrap = .T. - *< END OBJECT: BaseClass="label" /> - - ADD OBJECT 'lblValuta' AS label WITH ; - AutoSize = .T., ; - BackStyle = 0, ; - Caption = "Valută", ; - FontCharSet = 238, ; - Height = 17, ; - Left = 12, ; - Name = "lblValuta", ; - TabIndex = 13, ; - Top = 85, ; - Width = 33, ; - WordWrap = .T. - *< END OBJECT: BaseClass="label" /> - - PROCEDURE assign_analitic - PARAMETERS tcCont,pcAct,pcRul - - PRIVATE pcCont,pcAct,pcRul,pParamP,pParamS - STORE 0 TO pParamP,pParamS - lcAnalitic = '' - lcAlias = ALIAS() - - pcCont = ALLTRIM(tcCont) - - lcSel = [SELECT * from ] + gcs + [.config_analitice WHERE cont = ?pcCont] - lcCursor = 'crs_cfg_ana' - lnSucces = goExecutor.oExecute(lcSel,lcCursor) - IF lnSucces < 0 - aMESSAGEBOX(goExecutor.cEroare,0+16,"Eroare") - RETURN - ENDIF - - IF lnSucces > 0 - IF RECCOUNT('crs_cfg_ana')=0 - USE IN crs_cfg_ana - lnSucces = -1 - ENDIF - ENDIF - - IF lnSucces > 0 - SELECT crs_cfg_ana - SCATTER NAME ocfg - lcCampPrefix = NVL(ALLTRIM(ocfg.camp_leg_prefix),'') - lcCampSufix = NVL(ALLTRIM(ocfg.camp_leg_sufix),'') - - IF !EMPTY(lcCampPrefix) - IF TYPE('&pcRul..'+lcCampPrefix) # 'U' - pParamP = &pcRul..&lcCampPrefix - ELSE - IF TYPE('&pcAct..'+lcCampPrefix) # 'U' - pParamP = &pcAct..&lcCampPrefix - ENDIF - ENDIF - ENDIF - - IF !EMPTY(lcCampSufix) - IF TYPE('&pcRul..'+lcCampSufix) # 'U' - pParamS = &pcRul..&lcCampSufix - ELSE - IF TYPE('&pcAct..'+lcCampSufix) # 'U' - pParamS = &pcAct..&lcCampSufix - ENDIF - ENDIF - ENDIF - - lcSel = [{call fconturi_analitice(?gcs,?pcCont,0,?pParamP,?pParamS)}] - lcCursor = 'crs_analitice' - lnSucces = goExecutor.oExecute(lcSel,lcCursor) - - IF lnSucces < 0 - amessagebox(goExecutor.cEroare,0+16,"Eroare") - ENDIF - ENDIF - - && iau Primul Simbol Analitic din Tabel - ordonat pt ca e selectat cu Distinct - IF lnSucces > 0 - SELECT crs_analitice - GO top - lcAnalitic = ALLTRIM(acont) - ENDIF - - && verificare analiticului cu Planul de Conturi - IF lnSucces > 0 - lcSel = [SELECT cont,acont from ] + gcs + [.vplcont_analitic WHERE cont = ?pcCont and acont = ?lcAnalitic and an = ?gnAn ] - lcCursor = 'crs_verific' - lnSucces = goExecutor.oExecute(lcSel,lcCursor) - IF lnSucces < 0 - amessagebox(goExecutor.cEroare,0+16,"Eroare") - ENDIF - ENDIF - - IF lnSucces > 0 - IF RECCOUNT('crs_verific')=0 - lnSucces = -1 - ENDIF - ENDIF - - IF USED('crs_cfg_ana') - USE IN crs_cfg_ana - ENDIF - IF USED('crs_verific') - USE IN crs_verific - ENDIF - IF USED('crs_analitice') - USE IN crs_analitice - ENDIF - IF USED('crs_verific') - USE IN crs_verific - ENDIF - - IF lnSucces < 0 - lcAnalitic = '' - ENDIF - - SELECT (lcAlias) - RETURN lcAnalitic - **** - - ENDPROC - - PROCEDURE do_adauga - lcLista = ['-1'] - SELECT DISTINCT scd FROM actactan WHERE suma <> 0 INTO CURSOR tconturi - SELECT tconturi - SCAN - lcLista = lcLista + [,'] + ALLTRIM(scd) + ['] - ENDSCAN - - LOCAL lcXMLArticole, lcFiltru, lcCrsArt, lcCrsNir - lcFiltru = [a.cont in (] + lcLista + [)] - lcXMLArticole = cauta_nom_articole(lcFiltru) && ocautare.prg - selectie multipla (click/SPACE); adauga singura a.inactiv = 0 - - IF gnButon = 1 AND !EMPTY(lcXMLArticole) - lcCrsArt = [crsArtAlese] - XMLTOCURSOR(lcXMLArticole, lcCrsArt) - - lcCrsNir = THIS.grid1.RECORDSOURCE - loAct = THIS.oact - - SELECT (lcCrsArt) - SCAN - SCATTER NAME loArt - SELECT (lcCrsNir) - APPEND BLANK - GATHER NAME loAct - GATHER NAME loArt - REPLACE id_gestiune WITH loAct.id_gestin - SCATTER NAME lorul && pentru id_gestiune - lcAcont = THISFORM.assign_analitic(lorul.CONT,THISFORM.oact,'lorul') - SELECT (lcCrsNir) - REPLACE acont WITH lcAcont, tva WITH ROUND(pret * (proc_tva-1), gnPpret) - SELECT (lcCrsArt) - ENDSCAN - USE IN (lcCrsArt) - - THIS.grid1.REFRESH - ENDIF - - THIS.GRid1.cserie.SetFocus() - ENDPROC - - PROCEDURE do_calculeaza_diferente - PARAMETERS tnRecNo, tcCursor && modificare v 2.1.3 : am adaugat tcCursor - *!* modificare v 2.1.3 - *!* lcSel = Thisform.grid1.RecordSource - If Empty(tcCursor) - lcSel = Thisform.grid1.RecordSource - Else - lcSel = tcCursor - Endif - *!* modificare v 2.1.3 ^ - SELECT (lcSel) - SUM ROUND(Pret*cant,gnPc) TO lnLeiTot - SUM ROUND(Pretd*cant,gnPval) TO lnValTot - - thisform.ndif_lei = thisform.nbaza_lei - lnLeiTot - thisform.ndif_val = thisform.nbaza_val - lnValTot - thisform.clb_diferente_lei.Refresh - thisform.clb_diferente_valuta.Refresh - - SELECT (lcSel) - IF tnRecNo = 1 - LOCATE - ELSE - TRY - GO tnRecNo - CATCH - GO TOP - ENDTRY - ENDIF - - ENDPROC - - PROCEDURE do_copie - lcSelect = this.grid1.RecordSource - SELECT (lcSelect) - SCATTER NAME loRec - - INSERT INTO (lcSelect) FROM NAME loRec - this.do_reface() - this.grid1.SetFocus() - - ENDPROC - - PROCEDURE do_executa - PARAMETERS tnNivel, tRecNo, tnValue, tcCursor && modificare v 2.1.3 : am adaugat tcCursor - *!* DEBUG - *!* SUSPEND - *!* modificare v 2.1.3 - *!* lcSel = Thisform.grid1.RecordSource - If Empty(tcCursor) - lcSel = Thisform.grid1.RecordSource - Else - lcSel = tcCursor - Endif - *!* modificare v 2.1.3 ^ - SELECT (lcSel) - IF tnNivel <= 2 - *WAIT WINDOW STR(tnValue,16,4) - IF this.lIntern - IF tnNivel <= 1 - lnPretLei = ROUND(tnValue*thisform.procent_lei/100,gnPPret) && modificare v 2.1.39 : gnPPret in loc de gnPVal - ELSE - lnPretLei = tnValue - ENDIF - && modificare v 2.1.39 : gnPPret in loc de gnPVal - lnPretLei = ROUND(lnPretLei - (lnPretLei * proc_disc/100 ),gnPPret) && modificare v 2.1.37 - REPLACE pret WITH lnPretLei - ELSE - IF tnNivel <= 1 - lnPretVal = ROUND(tnValue*thisform.procent_val/100,gnPPretval) && modificare v 2.1.39 : gnPPretval in loc de gnPVal - ELSE - lnPretval = tnValue - ENDIF - lnPretVal = ROUND(lnPretVal - (lnPretVal * proc_disc/100 ),gnPPretval) && modificare v 2.1.39 : gnPPretval in loc de gnPVal - REPLACE pretd WITH lnPretval - - lnPretLei = ROUND(ROUND(lnPretval*thisform.ncurs,gnPpret)*thisform.procent_lei/100,gnPpret) - REPLACE pret WITH lnPretLei - ENDIF - ENDIF - - this.do_calculeaza_diferente(tRecNo,tcCursor) && modificare v 2.1.3 : am adaugat tcCursor - ENDPROC - - PROCEDURE do_modiparam - Local lcSelect, lcFisier, lnIdArticol, lcCursor, lcCont, loAct, lnInregistrari - LOCAL loEx as Exception - Local lcAcont, lcDenumire, lcSelect2, lcSql, llSucces, lnSucces, loArticol - Local lcMesaj - Local lnRec - Local lnInStoc - Private pnIdArticol, lorul - loAct = This.oact - - CALCULATE CNT() FOR !DELETED() TO lnInregistrari IN rul_temp - - If m.lnInregistrari > 0 - IF AMESSAGEBOX('Doriti sa stergeti reperele deja existente?',4+32,_screen.Caption) = 6 - SELECT rul_temp - DELETE ALL - ENDIF - *!* amessagebox("Nu puteti face import daca ati adaugat deja repere pe nir!",48,"Atentie") - *!* Return - Endif - amessagebox("Fisierul XLS trebuie sa contina campurile (in aceasta ordine si fara capul de tabel): " + CHR(13) + CHR(10) + ; - [COD PRODUS, DENUMIRE, UM, CANTITATE, PRET IN VALUTA FARA TVA (de pe factura)] + Chr(13) + Chr(10) + Chr(13) + Chr(10) + ; - [Fisierul trebuie sa fie salvat cu formatul "Microsoft Excel 5.0/95 Workbook (*.xls)"] ,48,"Atentie") - - lcFisier = Getfile("xls","Fisier factura","Alegeti",0,"Import fisier factura - format XLS") - If Empty(m.lcFisier) Or !File(m.lcFisier) - Return - ENDIF - lcSelect = "rul_temp" - llSucces = .F. - TRY - SELECT 0 - Import From (lcFisier) Type Xls - lcSelect2 = Alias() - SELECT ALLTRIM(UPPER(TRANSFORM(a))) as codmat, UPPER(ALLTRIM(TRANSFORM(b))) as denumire, UPPER(ALLTRIM(TRANSFORM(c))) as um, ROUND(d,6) as cant, ROUND(e,6) as pret_val ; - FROM &lcSelect2 ; - INTO CURSOR crsImport - llSucces = .T. - Catch To loEx - lcMesaj = 'Fisierul ' + m.lcFisier + ' nu a putut fi importat.' + Chr(13) + Chr(10) + TRANSFORM(loEx.ErrorNo) + " " - IF loEx.ErrorNo = 1661 - lcMesaj = m.lcMesaj + [Salvati fisierul in formatul "Microsoft Excel 5.0/95 Workbook (*.xls)"] - ELSE - lcMesaj = m.lcMesaj + loEx.Message - ENDIF - amessagebox(m.lcMesaj, 0+48, _Screen.Caption) - ENDTRY - IF !m.llSucces - RETURN - ENDIF - USE IN (SELECT(m.lcSelect2)) - lcSelect2 = "crsImport" - *!* A = codmat - *!* B = denumire - *!* C = um - *!* D = cantitate - *!* E = pret achizitie in valuta - - - save_grid_tag(Thisform.grid1) - - Select Distinct scd From actactan Where Inlist(Left(Alltrim(scd),1),'2','3') And suma <> 0 Into Cursor tconturi - If Reccount('tconturi') = 1 - Select tconturi - lcCont = Alltrim(scd) - Else - lcCont = [] - Endif - Use In tconturi - - If Reccount(m.lcSelect2) > 0 - lcCursor = [crstmpimpart] - Select (lcSelect2) - Scan - Scatter Name loArticol - If !Empty(Nvl(loArticol.cant,0)) - pnIdArticol = 0 - lcSql = [select id_articol,denumire,in_stoc,cont from nom_articole where UPPER(codmat) = '] + loArticol.codmat + [' and sters = 0] - If !goExecutor.oExecuta(lcSql,lcCursor) - amessagebox("A fost inregistrata o eroare la cautarea articolului " + loArticol.denumire + " pe nir!" + crlf + ; - "Iesiti din acest nir si reincercati operatia de preluare a fisierului!",48,"Atentie") - Exit - Else - Select (lcCursor) - If Reccount(lcCursor) > 0 - Locate For Upper(Alltrim(denumire)) = loArticol.denumire - If !Found() - Go Top - Endif - lcDenumire = Upper(Alltrim(denumire)) - If lcDenumire <> loArticol.denumire - If amessagebox("Articolul " + loArticol.denumire + " a fost gasit in baza de date dupa cod material, dar are denumirea de "+; - lcDenumire + ".Doriti sa pastrati denumirea din baza de date?" + crlf + ; - "( Daca apasati nu, atunci se va crea un articol nou cu denumirea din fisier )",4+32,"Denumire diferita") = 6 - lnIdArticol = id_articol - lnInStoc = Nvl(in_stoc,1) - loArticol.denumire = m.lcDenumire - Else - *!*adauga_articol - If Empty(m.lcCont) - lcCont = Inputbox("Introduceti contul pentru articolul " + loArticol.denumire, "Cont articol ", m.lcCont, 5000,[371],[371]) - Endif - lcSql = [begin pack_preturi.adauga_articol(?gnAn,'] + loArticol.codmat + [',NULL,NULL,] + ; - ['] + loArticol.denumire + [','] + loArticol.um + [',] + ; - ['] + Upper(Alltrim(m.lcCont)) + [',Null,0,0,NULL,NULL,0,NULL,1,0,0,?gnIdUtil,] + ; - ALLTRIM(Str(loAct.id_partc)) + [,0,0,?@pnIdArticol); end;] - goExecutor.oExecuta(lcSql) - lnIdArticol = m.pnIdArticol - lnInStoc = 1 - Endif - Else - lnIdArticol = id_articol - lnInStoc = Nvl(in_stoc,1) - Endif - Else - *!* adauga articol - If Empty(m.lcCont) - lcCont = Inputbox("Introduceti contul pentru articolul " + loArticol.denumire, "Cont articol ", m.lcCont, 5000,[371],[371]) - Endif - lcSql = [begin pack_preturi.adauga_articol(?gnAn,'] + loArticol.codmat + [',NULL,NULL,] + ; - ['] + loArticol.denumire + [','] + loArticol.um + [',] + ; - ['] + Upper(Alltrim(m.lcCont)) + [',Null,0,0,NULL,NULL,0,NULL,1,0,0,?gnIdUtil,] + ; - ALLTRIM(Str(loAct.id_partc)) + [,0,0,?@pnIdArticol); end;] - goExecutor.oExecuta(lcSql) - lnIdArticol = m.pnIdArticol - lnInStoc = 1 - Endif - If lnIdArticol = 0 - amessagebox("A fost inregistrata o eroare la adaugarea articolului " + loArticol.denumire + " pe NIR!" + crlf + ; - "Iesiti din acest nir si reincercati operatia de preluare a fisierului!",48,"Atentie") - Exit - Use In (lcCursor) - Else - *!* completez in rul_temp - Select (lcSelect) - Append Blank - Gather Name loAct - Replace Cont With m.lcCont, id_gestiune With loAct.id_gestin, id_articol With m.lnIdArticol,; - denumire With loArticol.denumire, codmat With loArticol.codmat,; - um With loArticol.um, cant With loArticol.cant, pret_val With loArticol.pret_val,; - in_stoc With m.lnInStoc - Scatter Name lorul - lcAcont = Thisform.assign_analitic(lorul.Cont, Thisform.oact, 'lorul') - Select (m.lcSelect) - Replace acont With m.lcAcont, tva With Round(Pret * (proc_tva-1), m.gnPpret) - Thisform.do_executa(1, Recno(), pret_val, m.lcSelect) - Use In (m.lcCursor) - Endif - Endif - Endif - Select (m.lcSelect2) - Endscan - Endif - Use In (select(lcSelect2)) - - Select (lcSelect) - GO TOP - lnRec = RECNO() - thisform.Do_calculeaza_diferente(m.lnRec, m.lcSelect) - - restore_grid_tag(Thisform.grid1) - this.grid1.SetFocus() - - ENDPROC - - PROCEDURE do_reface - lcSel = Thisform.grid1.RecordSource - Select (lcSel) - lnNrIreg = Reccount(lcSel) - lnRec = Recno() - lnLeiTot = 0 - lnValTot = 0 - - i = 0 - Scan - i = i + 1 - Scatter Name orul - *!* modificare v 2.1.37 - *!* lnPretval = Round(orul.pret_val*Thisform.procent_val/100,gnPval) - *!* lnPretval = Round(lnPretval - (lnPretval * orul.proc_disc/100 ),gnPval) - *!* lnPretLei = Round(Round(lnPretval*Thisform.ncurs,gnPpret)*Thisform.procent_lei/100,gnPpret) - If Thisform.lIntern - lnPretlei = Round(orul.pret_lei*Thisform.procent_lei/100,gnPPret) && modificare v 2.1.39 : gnPPret in loc de gnPVal - lnPretlei = Round(lnPretlei - (lnPretlei * orul.proc_disc/100 ),gnPPret) && modificare v 2.1.39 : gnPPret in loc de gnPVal - lnPretval = 0 - Else - lnPretval = Round(orul.pret_val*Thisform.procent_val/100,gnPPretVal) && modificare v 2.1.39 : gnPPretVal in loc de gnPVal - lnPretval = Round(lnPretval - (lnPretval * orul.proc_disc/100 ),gnPPretVal) && modificare v 2.1.39 : gnPPretVal in loc de gnPVal - lnPretlei = Round(Round(lnPretval*Thisform.ncurs,gnPpret)*Thisform.procent_lei/100,gnPpret) - Endif - *!* modificare v 2.1.37 ^ - Replace pretd With lnPretval - Replace Pret With lnPretlei - lnLeiTot = lnLeiTot + Round(lnPretlei*cant,gnPc) - lnValTot = lnValTot + Round(lnPretval*cant,gnPval) - *!* IF i = lnNrIreg - *!* REPLACE pret WITH pret + (thisform.nbaza_lei - lnPretTot) - *!* ENDIF - - Endscan - - - Thisform.Do_calculeaza_diferente(lnRec) - - *GO lnRec - ENDPROC - - PROCEDURE inainte_de_do_termin - *** copiez actactan sa pot sa il restaurez pentru cazul in care se apasa butonul in formularul de verificare - Local lcScd, lcScd1, lcSerieAct, lnIdpartd, lnNnir, lnNract, lnSucces, lnDiferenta - Local lnRec - - SELECT rul_temp - lnRec = RECNO() - thisform.Do_calculeaza_diferente(m.lnRec, "rul_temp") - && calcularea diferentelor - Select * From actactan Into Cursor crsActactanTemp READWRITE NOFILTER - - lnDiferenta = This.ndif_lei - If lnDiferenta <> 0 - Select actactan - locate - lcScd = scd - lnIdpartd = actactan.id_partd - Append Blank - *!* modificare migrare v 1.0 > v 2.0 - *!* Gather Name poact Fields Except Curs, pretd, nume_val, id_valuta, nnir, proc_tva - Gather Name poAct Fields Except Curs, pretd, nume_val, id_valuta, nnir, proc_tva - *!* modificare migrare v 1.0 > v 2.0 ^ - If Substr(lcScd,1,2)='34' - *!* modificare migrare v 1.0 > v 2.0 - *!* Replace suma With lnDiferenta, ; - *!* scd With '711', scc With lcScd, explicatia With 'DIFERENTE' - Replace suma With lnDiferenta, ; - scd With '711', scc With lcScd, explicatia With 'DIFERENTE',ID_JTVA_coloana With Null - *!* modificare migrare v 1.0 > v 2.0 ^ - Else - lcScd = Alltrim(lcScd) - Do Case - Case lcScd = "371" - lcScd1 = "607" - Case Inlist(lcScd, "381", "388") - lcScd1 = "608" - Otherwise - lcScd1 = '60' + Substr(lcScd,3,2) - Endcase - *!* modificare migrare v 1.0 > v 2.0 - *!* Replace suma With lnDiferenta, ; - *!* scd With lcScd1, scc With lcScd, explicatia With 'DIFERENTE' - Replace suma With lnDiferenta, ; - scd With lcScd1, scc With lcScd,id_partc With lnIdpartd, explicatia With 'DIFERENTE',ID_JTVA_coloana With Null - *!* modificare migrare v 1.0 > v 2.0 ^ - Endif - Endif - - Select actactan - Locate - - Do Form verificare With .T. , .T. - - If gnButon = 2 - Use In (Select('actactan')) - Select * From crsActactanTemp Into Cursor actactan READWRITE NOFILTER - Use In (Select('crsActactanTemp')) - RETURN .F. - Else - Use In (Select('crsActactanTemp')) - - *!* modificare v 2.1.41 - Select actactan - Go Top - lnNrAct = nract - lcSerieAct = serie_act - * completex TVA si TAXCODE cu datele de pe prima factura - lnIdJtvaColoana = id_jtva_coloana - lnTaxCode = taxcode - - If Used('rul_temp') - Select rul_temp - Replace ALL nract With lnNrAct,serie_act With lcSerieAct, id_jtva_coloana WITH m.lnIdJtvaColoana, taxcode WITH m.lnTaxCode - Endif - If Used('rul_temp_obinv') - Select rul_temp_obinv - Replace ALL nract With lnNrAct,serie_act With lcSerieAct - Endif - *!* Select Distinct serie_Act,nract,nnir From actactan Where nract <> nnir Into Cursor crsRulComplet - *!* If Used('rul_temp') - *!* Select crsRulComplet - *!* Scan - *!* lnNnir = nnir - *!* lnNract = nract - *!* lcSerieAct = serie_Act - *!* Select rul_temp - *!* Replace nract With lnNract,serie_Act With lcSerieAct For nnir = lnNnir - *!* Select crsRulComplet - *!* Endscan - *!* Endif - *!* If Used('rul_temp_obinv') - *!* Select crsRulComplet - *!* Scan - *!* lnNnir = nnir - *!* lnNract = nract - *!* lcSerieAct = serie_Act - *!* Select rul_temp_obinv - *!* Replace nract With lnNract,serie_Act With lcSerieAct For nnir = lnNnir - *!* Select crsRulComplet - *!* Endscan - *!* Endif - *!* If Used('crsRulComplet') - *!* Use In crsRulComplet - *!* Endif - *!* modificare v 2.1.41 ^ - *!* modificare 13.08.2007 ^ - ***** articolele negestionabile nu intra in rulaje/stoc (acelasi model ca la NIR normal) - * le pastrez intr-un cursor temporar ca sa le pot readauga daca scrierea esueaza - Select * From rul_temp Where Nvl(in_stoc,1) = 0 And !Deleted() Into Cursor crsNegest NOFILTER Readwrite - Delete From rul_temp Where Nvl(in_stoc,1) = 0 - - lnSucces = oscrie_in_fisiere(0,.F.,.T.) - If lnSucces > 0 - Use In (Select('crsNegest')) - this.AlwaysOnTop = .F. - Do listare_nir With poAct.nnir, gnTipGest In oproceduri_listari - this.AlwaysOnTop = .T. - RETURN .T. - Else - * scrierea a esuat - readaug articolele negestionabile, ca grila sa ramana completa la reincercare - Select rul_temp - Append From Dbf('crsNegest') - Use In (Select('crsNegest')) - Endif - Endif - - - ENDPROC - - PROCEDURE Init - Lparameters tlIntern - - This.lIntern = tlIntern - - If This.lIntern - This.grid1.cPretFactura.ControlSource = "pret_lei" - This.grid1.cPretFactura.Header1.Caption = "Pret lei factura" - *!* modificare v 2.1.39 - This.grid1.cPretFactura.InputMask = get_mask(10,gnPPret) - *!* modificare v 2.1.39 ^ - This.grid1.cPretValutaCalculat.Visible = .F. - This.grid1.cValoareValutaFactura.Visible = .F. - This.grid1.cValoareValutaCalculat.Visible = .F. - This.clb_diferente_valuta.Visible = .F. - *!* modificare v 2.1.3 - Thisform.but_modiparam1.Visible = .F. - Thisform._shape2.Left = Thisform.but_renunt1.Left - (Thisform.but_modiparam1.Left - Thisform._shape2.Left) - *!* modificare v 2.1.3 ^ - ENDIF - this.WindowState = 2 - DoDefault() - ENDPROC - - PROCEDURE Show - LPARAMETERS nStyle - this.do_reface - ENDPROC - - PROCEDURE Grid1.cCant.Text1.InteractiveChange - DODEFAULT() - this.LostFocus(.T.) - - ENDPROC - - PROCEDURE Grid1.cCant.Text1.LostFocus - PARAMETERS tlCalcul - - IF tlCalcul - REPLACE cant WITH this.Value - lnRec = RECNO() - thisform.do_executa(3,lnRec,this.value) - ENDIF - ENDPROC - - PROCEDURE Grid1.Column1.Text1.LostFocus - Parameters tlCalcul - - *IF tlCalcul - - * REPLACE pret_val WITH this.Value - lnRec = Recno() - *!* thisform.do_executa(3,lnRec,this.Value) - *!* modificare v 2.1.37 - *!* thisform.do_executa(1,lnRec,pret_val) - If Thisform.lIntern - Thisform.do_executa(1,lnRec,pret_lei) - Else - Thisform.do_executa(1,lnRec,pret_val) - Endif - *!* modificare v 2.1.37 ^ - *ENDIF - ENDPROC - - PROCEDURE Grid1.cPretFactura.Text1.InteractiveChange - *!* DODEFAULT() - *!* this.LostFocus(.t.) - - ENDPROC - - PROCEDURE Grid1.cPretFactura.Text1.LostFocus - PARAMETERS tlCalcul - - *IF tlCalcul - - * REPLACE pret_val WITH this.Value - lnRec = RECNO() - thisform.do_executa(1,lnRec,this.Value) - *ENDIF - ENDPROC - - PROCEDURE Grid1.cPretLeiCalculat.Text1.InteractiveChange - DODEFAULT() - this.LostFocus(.t.) - ENDPROC - - PROCEDURE Grid1.cPretLeiCalculat.Text1.LostFocus - PARAMETERS tlCalcul - - IF tlCalcul - REPLACE pret WITH this.Value - lnRec = RECNO() - thisform.do_executa(3,lnRec,this.Value) - ENDIF - ENDPROC - - PROCEDURE Grid1.cPretValutaCalculat.Text1.InteractiveChange - DODEFAULT() - this.LostFocus(.t.) - ENDPROC - - PROCEDURE Grid1.cPretValutaCalculat.Text1.LostFocus - PARAMETERS tlCalcul - - IF tlCalcul - lnRec = RECNO() - thisform.do_executa(2,lnRec,this.value) - ENDIF - ENDPROC - -ENDDEFINE - DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" *< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" /> @@ -7953,13 +6484,13 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" *< OBJECTDATA: ObjPath="Grid1.cTip.Header1" UniqueID="" Timestamp="" /> *< OBJECTDATA: ObjPath="Grid1.cTip.Text1" UniqueID="" Timestamp="" /> *< OBJECTDATA: ObjPath="Text2" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="TxtFtvaVal" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="LblFtvaVal" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="LblFtvaLei" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Label3" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="Label1" UniqueID="" Timestamp="" /> - *< OBJECTDATA: ObjPath="TxtFtvaLei" UniqueID="" Timestamp="" /> *< OBJECTDATA: ObjPath="Text3" UniqueID="" Timestamp="" /> + *< OBJECTDATA: ObjPath="TxtFtvaLei" UniqueID="" Timestamp="" /> + *< OBJECTDATA: ObjPath="TxtFtvaVal" UniqueID="" Timestamp="" /> + *< OBJECTDATA: ObjPath="Label1" UniqueID="" Timestamp="" /> + *< OBJECTDATA: ObjPath="Label3" UniqueID="" Timestamp="" /> + *< OBJECTDATA: ObjPath="LblFtvaLei" UniqueID="" Timestamp="" /> + *< OBJECTDATA: ObjPath="LblFtvaVal" UniqueID="" Timestamp="" /> *< OBJECTDATA: ObjPath="Cmd_executa1" UniqueID="" Timestamp="" /> *< OBJECTDATA: ObjPath="But_nou1" UniqueID="" Timestamp="" /> *< OBJECTDATA: ObjPath="But_sterge1" UniqueID="" Timestamp="" /> @@ -8749,7 +7280,7 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" ADD OBJECT 'Grid1.cParticipaValuta.Header1' AS header WITH ; Alignment = 2, ; - Caption = "Participa la pret valuta", ; + Caption = "Participa la pret", ; FontBold = .T., ; FontName = "Arial", ; FontSize = 10, ; @@ -9013,7 +7544,7 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" Column4.Name = "cPretFactura", ; Column4.Width = 108, ; Column5.BackColor = 240,248,255, ; - Column5.ColumnOrder = 9, ; + Column5.ColumnOrder = 8, ; Column5.ControlSource = "pretd", ; Column5.FontName = "Arial", ; Column5.FontSize = 10, ; @@ -9021,13 +7552,13 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" Column5.Name = "cPretValutaCalculat", ; Column5.Width = 114, ; Column6.BackColor = 230,242,255, ; - Column6.ColumnOrder = 10, ; + Column6.ColumnOrder = 9, ; Column6.ControlSource = "pret", ; Column6.FontName = "Arial", ; Column6.FontSize = 10, ; Column6.InputMask = (get_mask(10,gnPpret)), ; Column6.Name = "cPretLeiCalculat", ; - Column6.Width = 83, ; + Column6.Width = 100, ; Column7.Bound = .F., ; Column7.ColumnOrder = 11, ; Column7.ControlSource = "round(pret_val*cant, gnPval)", ; @@ -9043,7 +7574,7 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" Column8.FontSize = 10, ; Column8.InputMask = (get_mask(16,gnPval)), ; Column8.Name = "cValoareValutaCalculat", ; - Column8.Width = 97, ; + Column8.Width = 130, ; Column9.Bound = .F., ; Column9.ColumnOrder = 13, ; Column9.ControlSource = "round(pret*cant, gnPc)", ; @@ -9051,7 +7582,7 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" Column9.FontSize = 10, ; Column9.InputMask = (get_mask(10,gnPc)), ; Column9.Name = "cValoareLeiCalculat", ; - Column9.Width = 104, ; + Column9.Width = 110, ; Column10.BackColor = 240,248,255, ; Column10.ColumnOrder = 4, ; Column10.ControlSource = "cont", ; @@ -9090,7 +7621,7 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" Column14.Name = "cAdata_expirare", ; Column14.Width = 79, ; Column15.BackColor = 240,248,255, ; - Column15.ColumnOrder = 8, ; + Column15.ColumnOrder = 10, ; Column15.ControlSource = "proc_disc", ; Column15.FontName = "Arial", ; Column15.FontSize = 10, ; @@ -9292,7 +7823,7 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" ADD OBJECT 'GridArt.cPretLeiCalculat.Header1' AS header WITH ; Alignment = 2, ; - Caption = "Pret unitar", ; + Caption = "Pret lei calculat", ; FontName = "Arial", ; FontSize = 10, ; Name = "Header1" @@ -9346,7 +7877,7 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" ADD OBJECT 'GridArt.cValoareLeiCalculat.Header1' AS header WITH ; Alignment = 2, ; - Caption = "Valoare", ; + Caption = "Valoare lei calculat", ; FontName = "Arial", ; FontSize = 10, ; Name = "Header1" @@ -9364,7 +7895,7 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" ADD OBJECT 'GridArt.cValoareValutaCalculat.Header1' AS header WITH ; Alignment = 2, ; - Caption = "Valoare valuta", ; + Caption = "Valoare valuta calculat", ; FontName = "Arial", ; FontSize = 10, ; Name = "Header1" @@ -10241,7 +8772,27 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" SUM ROUND(Pret*cant,gnPc) TO lnLeiTot SUM ROUND(Pretd*cant,gnPval) TO lnValTot - thisform.ndif_lei = thisform.nbaza_lei - lnLeiTot + *!* 25.07.2026 claude - baza doar din documentele participante la pret + respecta randul D manual (ca recalc_diferente) + If Used('introdc') + lnRecIntr = Iif(Eof('introdc') Or Bof('introdc'), 0, Recno('introdc')) + Select introdc + Locate For tip_rand == 'D' And Nvl(mod_manual,0) = 1 + If Found() + thisform.ndif_lei = suma + Else + Sum suma For Inlist(tip_rand,'B','S') And !Inlist(scd,'4426','4428') And !Empty(id_jtva_coloana) And participa_valuta To lnBazaParticipa + thisform.ndif_lei = Round(lnBazaParticipa - lnLeiTot, gnPc) + Endif + If lnRecIntr > 0 + Try + Go lnRecIntr In introdc + Catch + Go Top In introdc + Endtry + Endif + Else + thisform.ndif_lei = thisform.nbaza_lei - lnLeiTot + Endif thisform.ndif_val = 0 && diferenta doar in lei (randul D fara valuta) thisform.TxtDifLei.Refresh thisform.TxtDifVal.Refresh @@ -11121,8 +9672,6 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" Replace All suma_val With 0, in_valuta With 0 Go Top && modificare v 2.1.37 This.grid1.cInValuta.Visible = .F. - This.grid1.cParticipaValuta.Visible = .F. - && this.grid1.cParticipaValuta.Header1.Caption = "Participa la pret lei" This.grid1.cSumaVal.Visible = .F. This.grid1.cExplicatia5.Visible = .F. This.lb_titlu_alb_b121.Caption = "ACHIZIȚIE INTERNĂ MARFĂ/MATERIALE" @@ -11247,7 +9796,7 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" If This.lIntern This.procent_lei = Iif(lnBazaPrincipalaLei <> 0, 100 * lnBazaLei / lnBazaPrincipalaLei, 100) Else - *!* 25.07.2026 claude - debifat participa_valuta = exclus complet din pret; diferenta merge pe randul D + *!* 25.07.2026 claude - debifat participa_valuta = exclus complet din pret si din diferenta (randul D) This.procent_lei = 100 Endif This.procent_val = Iif(lnBazaPrincipalaVal <> 0, 100 * lnBazaVal / lnBazaPrincipalaVal, 100) @@ -11256,12 +9805,12 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" PROCEDURE recalc_diferente *!* 16.07.2026b claude (C5 - corectii T2) - randul D unic (doc_key='', nr_doc=99999999): - *!* diferenta = baza TOTALA (This.nbaza_lei/val, dupa recalculeaza) - Suma(pret*cant) cu + *!* diferenta = baza documentelor participante la pret (participa_valuta) - Suma(pret*cant) cu *!* pretul INCARCAT (do_reface-adjusted, ca vechiul do_calculeaza_diferente), NU suma_doc *!* a principalei si NU pretul de factura (pret_lei/pret_val). Cont dominant = clasa 3 cu *!* baza (aceeasi formula) ABS maxima (dec.9+E5); fara clasa 3 -> dominant clasa 2, cont fix 6588. *!* Diferenta se determina si se scrie DOAR in lei (fara valuta). E3: D mosteneste antetul documentului principal. - Local lcSel, lnMinNrDoc, lnTotalLei, lnTotalVal + Local lcSel, lnMinNrDoc, lnTotalLei, lnTotalVal, lnBazaParticipa Local lcContDominant, lnBazaDominantaAbs, lcScd1, lnDiferentaLei, lnDiferentaVal, lcExplicatie Local llGasitClasa3, loAntet lcSel = Select() @@ -11269,8 +9818,9 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" If !Used('rul_temp') Or Reccount('rul_temp') = 0 *!* E7: fara articole - nimic de calculat; sterg D-ul ramas orfan, daca exista Select introdc - Delete For tip_rand == 'D' - This.ndif_lei = 0 + Delete For tip_rand == 'D' And Nvl(mod_manual,0) <> 1 + Locate For tip_rand == 'D' + This.ndif_lei = Iif(Found(), suma, 0) This.ndif_val = 0 Select (lcSel) Return @@ -11285,6 +9835,17 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" Return Endif + *!* 25.07.2026 claude - randul D modificat manual (mod_manual=1) nu se rescrie/sterge, ca randurile T + Locate For tip_rand == 'D' + If Found() And Nvl(mod_manual,0) = 1 + This.ndif_lei = suma + This.ndif_val = 0 + Select (lcSel) + Return + Endif + + Sum suma For Inlist(tip_rand,'B','S') And !Inlist(scd,'4426','4428') And !Empty(id_jtva_coloana) And participa_valuta To lnBazaParticipa + Select Sum(Round(pret*cant,gnPc)) As tot_lei, Sum(Round(pretd*cant,gnPval)) As tot_val ; From rul_temp Where !Deleted() Into Cursor crsTotArt NOFILTER lnTotalLei = Nvl(crsTotArt.tot_lei, 0) @@ -11318,7 +9879,7 @@ DEFINE CLASS import_nota AS frm_termin_renunt OF "_frm_child.vcx" Endif Use In crsGrupDom - lnDiferentaLei = Round(This.nbaza_lei - lnTotalLei, gnPc) + lnDiferentaLei = Round(lnBazaParticipa - lnTotalLei, gnPc) This.ndif_lei = lnDiferentaLei This.ndif_val = 0 diff --git a/utile/Teste/achizitie_import/test_runda11_diferenta_participa.prg b/utile/Teste/achizitie_import/test_runda11_diferenta_participa.prg new file mode 100644 index 0000000..f6fc6d9 --- /dev/null +++ b/utile/Teste/achizitie_import/test_runda11_diferenta_participa.prg @@ -0,0 +1,765 @@ +* test_runda11_diferenta_participa.prg +* Verifica RUNDA 11 (COMUN\clase\ointroduceri.vcx, clasa import_nota) - vezi +* docs\diff_runda11_diferenta_participa_la_pret.patch: +* 1. recalc_diferente/do_calculeaza_diferente: baza pt. randul D = SUMA randurilor B/S care +* PARTICIPA la pret (participa_valuta, excluzand 4426/4428 si randurile fara explicatie TVA), +* NU mai e nbaza_lei (totalul TUTUROR documentelor). O secundara debifata "Participa la pret" +* nu mai intra in diferenta. +* 2. Randul D cu mod_manual=1 (suma editata manual in grid) nu se mai rescrie/sterge la +* sincronizare (ca randurile T manuale). +* +* Scenariul lui Marius: FACTURA 1000 EUR curs 5.23 (5230 lei), TVA 21%, participa la pret + +* DVI (BIROUL VAMAL) 500 lei, "Participa la pret" DEBIFAT + UN articol cant=1, pret valuta +* factura 1000 EUR (flux real: do_adauga_articol, apoi GridArt.cCant/cPretFactura ca la tastare). +* +* Rulare: +* powershell -ExecutionPolicy Bypass -File test_runda11_diferenta_participa.ps1 + +SET SAFETY OFF +SET TALK OFF +SET DELETED ON +SET EXACT ON +SET CENTURY ON +SET DATE DMY +SET DECIMALS TO 4 +SET NULLDISPLAY TO '' +CLOSE DATABASES + +PUBLIC gcUILog, gcSyncDir +gcUILog = "D:\ROA\ROAGEST\COMUN\utile\Teste\achizitie_import\test_runda11_diferenta_participa_log.txt" +gcSyncDir = "D:\ROA\ROAGEST\COMUN\utile\Teste\achizitie_import\uisync_runda11\" +STRTOFILE("START " + TTOC(DATETIME()) + CHR(13)+CHR(10), gcUILog) + +ON ERROR DO R11Err WITH ERROR(), MESSAGE(), PROGRAM(), LINENO() +ON SHUTDOWN QUIT + +TRY + LOCAL gcAppPath, lcPath + gcAppPath = "D:\ROA\ROAGEST\" + SET DEFAULT TO (gcAppPath) + + lcPath = gcAppPath + 'Date;' + gcAppPath + 'Include;' + gcAppPath + 'FERESTRE;' + ; + gcAppPath + 'GRAFICE;' + gcAppPath + 'CLASE;' + gcAppPath + 'MENIURI;' + ; + gcAppPath + 'PROGRAME;' + gcAppPath + 'RAPOARTE;' + gcAppPath + 'COMUN;' + ; + gcAppPath + 'COMUN\CLASE;' + gcAppPath + 'COMUN\FERESTRE;' + gcAppPath + 'COMUN\PROGRAME;' + ; + gcAppPath + 'COMUN\GRAFICE;' + gcAppPath + 'COMUN\RAPOARTE;' + gcAppPath + 'COMUN\MENIURI;' + ; + gcAppPath + 'COMUN\UTILE\GRIDEXTRAS;' + gcAppPath + 'COMUN\UTILE\CTL32;' + ; + gcAppPath + 'COMUN\UTILE\HPDF;' + gcAppPath + 'COMUN\UTILE\HPDF\REPORTOUTPUT;' + ; + gcAppPath + 'COMUN\UTILE\WEB;' + gcAppPath + 'COMUN\UTILE\EXCEL;' + ; + ADDBS(SUBSTR(gcAppPath,1,RAT([\],gcAppPath,2)))+[COMUNROA\] + SET PATH TO &lcPath ADDITIVE + DO R11Log WITH 'SET PATH OK' + + *----- CLASE ----- + SET CLASSLIB TO (gcAppPath + "comun\clase\appwiz") ADDITIVE + SET CLASSLIB TO GESTIUNI ADDITIVE + SET CLASSLIB TO CAUT ADDITIVE + SET CLASSLIB TO BAZA ADDITIVE + SET CLASSLIB TO comun ADDITIVE + SET CLASSLIB TO accessibility.vcx ADDITIVE + SET CLASSLIB TO messagebox ADDITIVE + SET CLASSLIB TO registry ADDITIVE + SET CLASSLIB TO cauta_alfa_forms.vcx ADDITIVE + SET CLASSLIB TO DECABAZA ADDITIVE + SET CLASSLIB TO onomenclatoare ADDITIVE + SET CLASSLIB TO stocuri.vcx ADDITIVE + SET CLASSLIB TO rulaje.vcx ADDITIVE + SET CLASSLIB TO ointroduceri ADDITIVE + SET CLASSLIB TO ointroduceri_web ADDITIVE + SET CLASSLIB TO ointroduceri_depozit ADDITIVE + SET CLASSLIB TO overificari ADDITIVE + SET CLASSLIB TO ferestre_oracle ADDITIVE + SET CLASSLIB TO ferestre_cere_date.vcx ADDITIVE + SET CLASSLIB TO configurare.vcx ADDITIVE + SET CLASSLIB TO serii_numere.vcx ADDITIVE + SET CLASSLIB TO omodificari.vcx ADDITIVE + SET CLASSLIB TO ocompensari.vcx ADDITIVE + SET CLASSLIB TO caut_ora ADDITIVE + SET CLASSLIB TO onote_contabile ADDITIVE + SET CLASSLIB TO otoolbar ADDITIVE + SET CLASSLIB TO bon_fisc ADDITIVE + SET CLASSLIB TO onom_articole ADDITIVE + SET CLASSLIB TO onom_retete ADDITIVE + SET CLASSLIB TO orapoarte ADDITIVE + SET CLASSLIB TO orapoarte_gestiuni ADDITIVE + SET CLASSLIB TO orapoarte_parametri ADDITIVE + SET CLASSLIB TO ONOM_CURS ADDITIVE + SET CLASSLIB TO ctl32_statusbar_fals.vcx ADDITIVE + SET CLASSLIB TO ctl32_common.vcx ADDITIVE + SET CLASSLIB TO ctl32_structs.vcx ADDITIVE + SET CLASSLIB TO ctl32_progressbar.vcx ADDITIVE + SET CLASSLIB TO ctl32_balloontip.vcx ADDITIVE + SET CLASSLIB TO ocriterii.vcx ADDITIVE + SET CLASSLIB TO oavize.vcx ADDITIVE + SET CLASSLIB TO onomenclatoare2 ADDITIVE + SET CLASSLIB TO wwdialogs.vcx ADDITIVE + SET CLASSLIB TO oimportxml.vcx ADDITIVE + SET CLASSLIB TO excelxml.vcx ADDITIVE + SET CLASSLIB TO orapoarte_obinv.vcx ADDITIVE + DO R11Log WITH 'SET CLASSLIB OK' + + *----- PROCEDURI (mock amessagebox + mock cauta_nom_articole PRIMELE, ui_harness la final) ----- + SET PROCEDURE TO PROCEDURI + SET PROCEDURE TO "D:\ROA\ROAGEST\COMUN\utile\Teste\mock_amessagebox.prg" ADDITIVE + SET PROCEDURE TO "D:\ROA\ROAGEST\COMUN\utile\Teste\mock_cauta_nom_articole.prg" ADDITIVE + SET PROCEDURE TO acces_meniu ADDITIVE + SET PROCEDURE TO cauta_alfa ADDITIVE + SET PROCEDURE TO pmenu ADDITIVE + SET PROCEDURE TO proceduri_comune ADDITIVE + SET PROCEDURE TO quitapp ADDITIVE + SET PROCEDURE TO init_program ADDITIVE + SET PROCEDURE TO oproceduri_listari.prg ADDITIVE + SET PROCEDURE TO oproceduri_configurare.prg ADDITIVE + SET PROCEDURE TO oproceduri_articole.prg ADDITIVE + SET PROCEDURE TO oproceduri_retete.prg ADDITIVE + SET PROCEDURE TO orapoarte.prg ADDITIVE + SET PROCEDURE TO mesaje ADDITIVE + SET PROCEDURE TO oserii_numere.prg ADDITIVE + SET PROCEDURE TO oexport.prg ADDITIVE + SET PROCEDURE TO wwConfig.prg ADDITIVE + SET PROCEDURE TO proceduri_rapoarte.prg ADDITIVE + SET PROCEDURE TO OPROCEDURI_CURS.PRG ADDITIVE + SET PROCEDURE TO validare.prg ADDITIVE + SET PROCEDURE TO GENCURSOR.PRG ADDITIVE + SET PROCEDURE TO OPROCEDURI_COMUNE.PRG ADDITIVE + SET PROCEDURE TO OINIT_OPTIUNI.PRG ADDITIVE + SET PROCEDURE TO updateserver.prg ADDITIVE + SET PROCEDURE TO oinainte_de.prg ADDITIVE + SET PROCEDURE TO ooperatii_comune.prg ADDITIVE + SET PROCEDURE TO Ocompensari.PRG ADDITIVE + SET PROCEDURE TO OPROCEDURI_aMS.PRG ADDITIVE + SET PROCEDURE TO oproceduri_rulaje ADDITIVE + SET PROCEDURE TO oproceduri_stocuri ADDITIVE + SET PROCEDURE TO OINTRODUCERI ADDITIVE + SET PROCEDURE TO oHeader.prg ADDITIVE + SET PROCEDURE TO proceduri_excel.PRG ADDITIVE + SET PROCEDURE TO onomenclatoare.PRG ADDITIVE + SET PROCEDURE TO osecurity ADDITIVE + SET PROCEDURE TO ocautare ADDITIVE + SET PROCEDURE TO orefaceri ADDITIVE + SET PROCEDURE TO ofacturare_comun.PRG ADDITIVE + SET PROCEDURE TO ofacturare_stoc.PRG ADDITIVE + SET PROCEDURE TO oproceduri_casademarcat ADDITIVE + SET PROCEDURE TO oproceduri_casa_marcat_e500 ADDITIVE + SET PROCEDURE TO oproceduri_casa_marcat_mp500 ADDITIVE + SET PROCEDURE TO oproceduri_util.prg ADDITIVE + SET PROCEDURE TO wwxmlhttp.prg ADDITIVE + SET PROCEDURE TO ini.prg ADDITIVE + SET PROCEDURE TO odocumente.prg ADDITIVE + SET PROCEDURE TO regex.prg ADDITIVE + SET PROCEDURE TO wwutils.prg ADDITIVE + SET PROCEDURE TO inchidere_k ADDITIVE + SET PROCEDURE TO iniacces.prg ADDITIVE + SET PROCEDURE TO oupdate.prg ADDITIVE + SET PROCEDURE TO procese.prg ADDITIVE + SET PROCEDURE TO version.prg ADDITIVE + SET PROCEDURE TO xmlaccess.prg ADDITIVE + SET PROCEDURE TO xmlparser.prg ADDITIVE + SET PROCEDURE TO filebringer.prg ADDITIVE + SET PROCEDURE TO wwcodeupdate.prg ADDITIVE + SET PROCEDURE TO wwhttp.prg ADDITIVE + SET PROCEDURE TO xdate.prg ADDITIVE + SET PROCEDURE TO ofacturare.prg ADDITIVE + SET PROCEDURE TO oproceduri_obinv.prg ADDITIVE + SET PROCEDURE TO oproceduri_facturare.prg ADDITIVE + SET PROCEDURE TO email.prg ADDITIVE + SET PROCEDURE TO "D:\ROA\ROAGEST\COMUN\utile\Teste\ui_harness.prg" ADDITIVE + DO R11Log WITH 'SET PROCEDURE OK' + + *----- Globale ----- + PUBLIC gnPc, gnPval, gnPcant, gnPpret, gnPPretval, gnPCurs, gnPVal, gnPPretV, gnPPretVal + STORE 2 TO gnPc, gnPval, gnPVal + gnPcant = 3 + STORE 4 TO gnPpret, gnPPretval, gnPPretVal, gnPPretV, gnPCurs + PUBLIC gl406, gcS, gnAn, gnLuna, gnIdFirma, gnIdSucursala, gcAcces, gcFirma + gl406 = .T. + gcS = 'CONTAFIN' + gnAn = YEAR(DATE()) + gnLuna = MONTH(DATE()) + gnIdFirma = 110 + gnIdSucursala = 110 + gcAcces = "1;2;3;4;5;6;7;8;" + gcFirma = gcS + PUBLIC nror(65000) + + PUBLIC gnButon + STORE 2 TO gnButon + PUBLIC gcMockArtCodmat + gcMockArtCodmat = '' + + PUBLIC goExecutor, goApp + goExecutor = CREATEOBJECT('dummyexecutor') + goApp = CREATEOBJECT('dummyapp') + + *----- poAct: antetul notei; dialogul mosteneste din el la Init ----- + PUBLIC poAct + poAct = CREATEOBJECT('Custom') + poAct.AddProperty('nume_val', '') + poAct.AddProperty('curs', 5.23) + poAct.AddProperty('proc_tva', 1.21) + poAct.AddProperty('nnir', 0) + poAct.AddProperty('id_valuta', 978) + poAct.AddProperty('id_fdoc', 1) + poAct.AddProperty('fdoc', 'Factura') + poAct.AddProperty('id_partc', 500) + poAct.AddProperty('partc', 'FURNIZOR ANTET SRL') + poAct.AddProperty('serie_act', '') + poAct.AddProperty('dataact', DATE()) + poAct.AddProperty('tva_incasare', 0) + poAct.AddProperty('id_set', 1) + poAct.AddProperty('id_gestin', 1) + + *----- jtva_coloane2 / saft_taxtable: perechi reale 21% (ca in test_runda7_diferente). ----- + IF USED('jtva_coloane2') + USE IN ('jtva_coloane2') + ENDIF + CREATE CURSOR jtva_coloane2 (ordine N(8), id_jtva_coloana N(14), denumire C(100), ; + jc N(1), jv N(1), afisat N(1), coloana_jc C(20), coloana_jv C(20), cota_tva N(6,2), id_tva N(14)) + INSERT INTO jtva_coloane2 VALUES (0, 0, '', 0, 0, 1, '', '', 0, 0) + INSERT INTO jtva_coloane2 VALUES (1, 208, 'ACH. INT. 21%', 1, 0, 1, 'RO21B', 'RO21T', 21, 209) + INSERT INTO jtva_coloane2 VALUES (2, 209, 'TVA ACH. INT. 21%', 1, 0, 1, 'RO21T', '', 21, 0) + INSERT INTO jtva_coloane2 VALUES (3, 220, 'ACH. IMP. 21%', 1, 0, 1, 'FO21B', 'FO21T', 21, 221) + INSERT INTO jtva_coloane2 VALUES (4, 221, 'TVA ACH. IMP. 21%', 1, 0, 1, 'FO21T', '', 21, 0) + + IF USED('saft_taxtable') + USE IN ('saft_taxtable') + ENDIF + CREATE CURSOR saft_taxtable (taxname C(250) NULL, typename C(250) NULL, taxcode N(6) NULL, ; + taxtype N(3) NULL, descriere C(250) NULL, tip C(100) NULL, descriere_tip C(250) NULL, ; + procent_taxa N(7,2) NULL, procent_prorata N(7,2) NULL, inactiv N(1) NULL, tva N(1) NULL, ; + wht N(1) NULL, tva_achizitii N(1) NULL, tva_livrari N(1) NULL) + INDEX ON taxcode TAG taxcode + INSERT INTO saft_taxtable (taxname, taxcode, descriere, procent_taxa, tva, wht, tva_achizitii, tva_livrari) ; + VALUES ('', 0, '', 0, 1, 1, 1, 1) + INSERT INTO saft_taxtable (taxname, taxcode, descriere, procent_taxa, tva, wht, tva_achizitii, tva_livrari) ; + VALUES ('301104-Achizitii de bunuri si servicii taxabile cu cota de 21%, altele decat importurile si cele supuse masurilor de simplificare', 301104, '', 21, 1, 0, 1, 0) + INSERT INTO saft_taxtable (taxname, taxcode, descriere, procent_taxa, tva, wht, tva_achizitii, tva_livrari) ; + VALUES ('301204-Import de bunuri cota 21%', 301204, '', 21, 1, 0, 1, 0) + + DO CreeazaIntrodc WITH 'introdc' + DO CreeazaIntrodc WITH 'introdc_sablon' + INSERT INTO introdc_sablon (scd, scc, cu_tva, ordine, id_set, participa_valuta, tip_rand, ; + id_jtva_coloana, ptva, explicatie_tva) ; + VALUES ('371', '401', 1, 1, 1, .T., 'B', 208, 21, 'ACH. INT. 21%') + INSERT INTO introdc_sablon (scd, scc, cu_tva, ordine, id_set, participa_valuta, tip_rand, ; + id_jtva_coloana, ptva, explicatie_tva) ; + VALUES ('4426', '401', 1, 2, 1, .T., 'T', 209, 21, 'TVA ACH. INT. 21%') + GO TOP IN introdc_sablon + + DO CreeazaRulTemp + INSERT INTO rul_temp (denumire, codmat, cant, pret, pret_lei, cont, cota_tva) ; + VALUES ('PLACEHOLDER', 'PH', 1, 1, 1, '371', 21) + + *-- F1 (ointroduceri.prg): index ord_doc INAINTE de CREATEOBJECT - vezi docs/testare-ui-vfp.md capcana p. + SELECT introdc + INDEX ON Str(Nvl(nr_doc,0),8) + Icase(tip_rand='B','1', tip_rand='S','2', tip_rand='T','3', tip_rand='D','4', '5') + Padr(Nvl(scd,''),10) TAG ord_doc + SET ORDER TO ord_doc + + DO R11Log WITH 'cursoare pregatite, CREATEOBJECT(import_nota, .F.) - lIntern=.F. (import)' + PUBLIC goObj + goObj = CREATEOBJECT('IMPORT_nota', .F.) + IF VARTYPE(goObj) <> 'O' + DO R11Log WITH 'FAIL: instantiere import_nota' + DO HarnessDone WITH 'done-error' + QUIT + ENDIF + goObj.lDialogAratat = .T. + goObj.oact = poAct + goObj.WindowType = 0 + goObj.Visible = .T. + goObj.Show() + goObj.WindowState = 2 + DOEVENTS FORCE + + SELECT rul_temp + ZAP + goObj.gridart.Refresh() + DOEVENTS FORCE + + *========================= DOC 1 (principal, participa) + DOC 2 (DVI, NU participa) ========================= + PUBLIC goDlg, goT + DO AdaugaDocPrincipal + DO AdaugaDocSecundarNeparticipant + + DO R11Log WITH 'dump introdc dupa cele 2 documente:' + DO DumpIntrodc + + DO HarnessStep WITH 0, 'dupa 2 documente (FACTURA participa + DVI NU participa): introdc=' + TRANSFORM(RECCOUNT_ACTIVE('introdc')) + ' randuri' + + *========================= ARTICOL (flux real: do_adauga_articol + tastare cant/pret in grid) ========================= + gcMockArtCodmat = 'ART-BULD-212' + TRY + goObj.do_adauga_articol() + CATCH TO loExcAdd + DO R11Log WITH 'EROARE do_adauga_articol ' + TRANSFORM(loExcAdd.ErrorNo) + ' [' + loExcAdd.Message + '] in ' + loExcAdd.Procedure + ':' + TRANSFORM(loExcAdd.LineNo) + ENDTRY + DOEVENTS FORCE + + LOCAL lnRecArt + SELECT rul_temp + LOCATE FOR ALLTRIM(codmat) == 'ART-BULD-212' + IF !FOUND() + DO R11Log WITH 'FAIL: BULDOEXCAVATOR nu a fost adaugat de do_adauga_articol()' + ELSE + lnRecArt = RECNO() + *-- do_adauga_articol() nu completeaza cant/pret (ramane in seama utilizatorului, tastate + *-- in grid) - REPLACE direct, ca in restul suitei (test_scenariu_dvi_complet, test_runda7_diferente): + *-- apelul direct al metodelor de grid GotFocus/LostFocus e nefiabil headless (Thisform.nOldVal + *-- ramane netipizat fara focus real -> eroare 107 la comparatia de tip in LostFocus). + REPLACE cant WITH 1, pret_val WITH 1000, pretd WITH 1000, ; + pret WITH ROUND(1000*5.23,4), pret_lei WITH ROUND(1000*5.23,4) + DO R11Log WITH 'BULDOEXCAVATOR: cant=1, pret valuta factura=1000 EUR (pret asteptat 5230 lei la curs 5.23)' + ENDIF + goObj.gridart.Refresh() + DOEVENTS FORCE + + DO HarnessStep WITH 1, 'dupa introducere articol (cant=1, pret valuta=1000): rul_temp=' + TRANSFORM(RECCOUNT_ACTIVE('rul_temp')) + + *========================= SINCRONIZARE ========================= + LOCAL llEroareSync + llEroareSync = .F. + TRY + goObj.sincronizeaza() + CATCH TO loExcSync + llEroareSync = .T. + DO R11Log WITH 'EROARE la sincronizeaza() ' + TRANSFORM(loExcSync.ErrorNo) + ' [' + loExcSync.Message + '] in ' + loExcSync.Procedure + ':' + TRANSFORM(loExcSync.LineNo) + ' (' + loExcSync.LineContents + ')' + ENDTRY + DOEVENTS FORCE + goObj.grid1.Refresh() + IF !llEroareSync + DO R11Log WITH 'PASS sincronizare: sincronizeaza() fara eroare' + ELSE + DO R11Log WITH 'FAIL sincronizare: sincronizeaza() a aruncat eroare' + ENDIF + DO R11Log WITH 'dump introdc dupa sincronizare:' + DO DumpIntrodc + + *========================= ASSERT 1: pretul articolului = 5230 lei (1000 EUR x 5.23) ========================= + *-- verific SI goObj.procent_lei == 100 (mecanismul real, runda11: pe import procent_lei e fix 100, + *-- indiferent de participa_valuta al secundarelor) - nu doar valoarea pretului (care a fost introdusa + *-- de test), ca sa confirm ca DVI-ul neparticipant nu a influentat procentul de incarcare a pretului. + IF ABS(goObj.procent_lei - 100) < 0.01 + DO R11Log WITH 'PASS assert1-procent_lei: goObj.procent_lei=' + TRANSFORM(goObj.procent_lei) + ' (asteptat 100 - secundara DVI neparticipanta nu influenteaza incarcarea pretului)' + ELSE + DO R11Log WITH 'FAIL assert1-procent_lei: goObj.procent_lei=' + TRANSFORM(goObj.procent_lei) + ' (asteptat 100)' + ENDIF + SELECT rul_temp + LOCATE FOR ALLTRIM(codmat) == 'ART-BULD-212' + IF FOUND() + LOCAL lnPretArt, lnPretdArt + lnPretArt = pret + lnPretdArt = pretd + IF ABS(lnPretArt - 5230) < 0.01 AND ABS(lnPretdArt - 1000) < 0.01 + DO R11Log WITH 'PASS assert1-pret_articol: pret=' + TRANSFORM(lnPretArt) + ' pretd=' + TRANSFORM(lnPretdArt) + ' (asteptat pret=5230.00, pretd=1000.00 - secundara NU a incarcat pretul)' + ELSE + DO R11Log WITH 'FAIL assert1-pret_articol: pret=' + TRANSFORM(lnPretArt) + ' pretd=' + TRANSFORM(lnPretdArt) + ' (asteptat pret=5230.00, pretd=1000.00)' + ENDIF + ELSE + DO R11Log WITH 'FAIL assert1-pret_articol: articolul BULDOEXCAVATOR nu mai exista in rul_temp' + ENDIF + + *========================= ASSERT 2: randul D lipseste SAU are suma 0 ========================= + SELECT introdc + LOCATE FOR tip_rand == 'D' + IF !FOUND() + DO R11Log WITH 'PASS assert2-randD: nu exista rand D dupa sincronizare (diferenta participante-articole = 0, ca asteptat)' + ELSE + IF ABS(suma) < 0.01 + DO R11Log WITH 'PASS assert2-randD: exista rand D dar cu suma=' + TRANSFORM(suma) + ' (~0, acceptat)' + ELSE + DO R11Log WITH 'FAIL assert2-randD: exista rand D cu suma=' + TRANSFORM(suma) + ' (asteptat lipsa sau 0 - secundara DVI NU trebuia sa intre in diferenta)' + ENDIF + ENDIF + + DO HarnessStep WITH 2, 'assert1+assert2 verificate - vezi log pentru PASS/FAIL' + + *========================= ASSERT 3: diferenta REALA + editare manuala randul D nu se suprascrie ========================= + *-- creez o diferenta reala: cantitatea articolului devine 2 (flux real GridArt.cCant), articolele + *-- (2x5230=10460) nu mai coincid cu baza participanta (5230) -> diferenta = 5230-10460 = -5230. + SELECT rul_temp + LOCATE FOR ALLTRIM(codmat) == 'ART-BULD-212' + IF FOUND() + lnRecArt = RECNO() + *-- REPLACE direct (vezi motivul la introducerea pretului mai sus) - GridArt.cCant.Text1.LostFocus + *-- ar face acelasi REPLACE cant WITH this.Value, apoi doar recalculeaza diferenta (nivel 3). + REPLACE cant WITH 2 + DOEVENTS FORCE + DO R11Log WITH 'cant articol schimbat la 2 - astept diferenta reala pe randul D' + ELSE + DO R11Log WITH 'FAIL setup-assert3: articolul BULDOEXCAVATOR nu mai exista in rul_temp' + ENDIF + + LOCAL llEroareSync2 + llEroareSync2 = .F. + TRY + goObj.sincronizeaza() + CATCH TO loExcSync2 + llEroareSync2 = .T. + DO R11Log WITH 'EROARE la sincronizeaza() (dupa cant=2) ' + TRANSFORM(loExcSync2.ErrorNo) + ' [' + loExcSync2.Message + ']' + ENDTRY + DOEVENTS FORCE + goObj.grid1.Refresh() + DOEVENTS FORCE + DO R11Log WITH 'dump introdc dupa cant=2 + sincronizare:' + DO DumpIntrodc + + LOCAL lnSumaDInainteManual, llGasitDInainteManual + SELECT introdc + LOCATE FOR tip_rand == 'D' + llGasitDInainteManual = FOUND() + IF llGasitDInainteManual + lnSumaDInainteManual = suma + IF ABS(lnSumaDInainteManual) > 0.01 + DO R11Log WITH 'PASS setup-assert3: rand D real aparut, suma=' + TRANSFORM(lnSumaDInainteManual) + ' (diferenta nenula, ca asteptat)' + ELSE + DO R11Log WITH 'FAIL setup-assert3: rand D exista dar suma~0 (asteptam diferenta reala nenula)' + ENDIF + ELSE + DO R11Log WITH 'FAIL setup-assert3: nu exista rand D dupa cant=2 (asteptam o diferenta reala)' + ENDIF + + *-- editare manuala a sumei pe randul D, prin metoda reala Grid1.cSuma.Text1.Valid() (marcheaza + *-- mod_manual=1) - Thisform.nOldVal se seteaza DIRECT (ca in test_runda7_diferente.VerificaGuardValid), + *-- nu prin GotFocus(): apelul GotFocus() direct, in afara unui focus real de grid, lasa nOldVal + *-- netipizat si Valid()/LostFocus arunca eroare 107 la comparatia de tip (vezi mai sus, articol). + LOCAL lnValoareManuala, llEroareEditManual + lnValoareManuala = 123.45 + llEroareEditManual = .F. + IF llGasitDInainteManual + SELECT introdc + LOCATE FOR tip_rand == 'D' + goObj.nOldVal = lnSumaDInainteManual + goObj.Grid1.cSuma.Text1.Value = lnValoareManuala + TRY + goObj.Grid1.cSuma.Text1.Valid() + CATCH TO loExcEdit + llEroareEditManual = .T. + DO R11Log WITH 'EROARE Grid1.cSuma.Text1.Valid() ' + TRANSFORM(loExcEdit.ErrorNo) + ' [' + loExcEdit.Message + '] in ' + loExcEdit.Procedure + ':' + TRANSFORM(loExcEdit.LineNo) + ENDTRY + DOEVENTS FORCE + + IF llEroareEditManual + *-- fallback: scriu direct campurile pe care Valid() le-ar fi scris (suma prin binding, + *-- mod_manual explicit), ca sa pot totusi verifica pastrarea la resincronizare (assert3b/c) + SELECT introdc + LOCATE FOR tip_rand == 'D' + IF FOUND() + REPLACE suma WITH lnValoareManuala, mod_manual WITH 1 + ENDIF + DO R11Log WITH 'INFO assert3a-editare_manuala: Valid() a esuat headless - suma/mod_manual scrise direct ca fallback (comportamentul de PASTRARE la resincronizare tot se testeaza mai jos)' + ENDIF + + SELECT introdc + LOCATE FOR tip_rand == 'D' + IF FOUND() AND ABS(suma - lnValoareManuala) < 0.01 AND mod_manual = 1 + DO R11Log WITH 'PASS assert3a-editare_manuala: rand D suma=' + TRANSFORM(suma) + ' mod_manual=' + TRANSFORM(mod_manual) + ' (asteptat suma=123.45, mod_manual=1)' + ELSE + DO R11Log WITH 'FAIL assert3a-editare_manuala: rand D suma=' + TRANSFORM(IIF(FOUND(),suma,-99999)) + ' mod_manual=' + TRANSFORM(IIF(FOUND(),mod_manual,-1)) + ' (asteptat suma=123.45, mod_manual=1)' + ENDIF + ELSE + DO R11Log WITH 'FAIL assert3a-editare_manuala: nu am gasit rand D de editat (setup esuat)' + ENDIF + + *-- resincronizare (F5) - randul D marcat manual NU trebuie rescris/sters. + LOCAL llEroareSync3 + llEroareSync3 = .F. + TRY + goObj.sincronizeaza() + CATCH TO loExcSync3 + llEroareSync3 = .T. + DO R11Log WITH 'EROARE la sincronizeaza() (resincronizare post-editare manuala) ' + TRANSFORM(loExcSync3.ErrorNo) + ' [' + loExcSync3.Message + ']' + ENDTRY + DOEVENTS FORCE + goObj.grid1.Refresh() + DOEVENTS FORCE + DO R11Log WITH 'dump introdc dupa resincronizare (post-editare manuala randul D):' + DO DumpIntrodc + + SELECT introdc + LOCATE FOR tip_rand == 'D' + IF FOUND() AND ABS(suma - lnValoareManuala) < 0.01 AND mod_manual = 1 + DO R11Log WITH 'PASS assert3b-resincronizare: rand D pastreaza suma=' + TRANSFORM(suma) + ' mod_manual=' + TRANSFORM(mod_manual) + ' dupa resincronizare (NU a fost suprascris)' + ELSE + DO R11Log WITH 'FAIL assert3b-resincronizare: rand D suma=' + TRANSFORM(IIF(FOUND(),suma,-99999)) + ' mod_manual=' + TRANSFORM(IIF(FOUND(),mod_manual,-1)) + ' (asteptat suma=123.45, mod_manual=1, neschimbat)' + ENDIF + + *-- marcaj vizual D* in grid (Column24.ControlSource: tip_rand + Iif(mod_manual=1,'*',' ')) + SELECT introdc + LOCATE FOR tip_rand == 'D' + IF FOUND() + LOCAL lcMarcaj + lcMarcaj = ALLTRIM(tip_rand) + IIF(mod_manual=1,'*',' ') + IF ALLTRIM(lcMarcaj) == 'D*' + DO R11Log WITH 'PASS assert3c-marcaj: coloana randului arata [' + lcMarcaj + '] (D*)' + ELSE + DO R11Log WITH 'FAIL assert3c-marcaj: coloana randului arata [' + lcMarcaj + '] (asteptat D*)' + ENDIF + ENDIF + + DO HarnessStep WITH 3, 'final assert3 (diferenta reala + editare manuala + resincronizare) - vezi log pentru PASS/FAIL' + DO HarnessDone WITH 'done' + +CATCH TO loExc + DO R11Log WITH 'CATCH ErrorNo=' + TRANSFORM(loExc.ErrorNo) + ' Message=' + loExc.Message + ' Proc=' + loExc.Procedure + ' Line=' + TRANSFORM(loExc.LineNo) + ' [' + loExc.LineContents + ']' + DO HarnessDone WITH 'done-error' +ENDTRY + +QUIT + +*================================================================================== +PROCEDURE AdaugaDocPrincipal + *-- FACTURA 1000 EUR curs 5.23 (5230 lei), RAJA, participa la pret BIFAT, TVA 21% normal (F). + goDlg = CREATEOBJECT('import_adauga_factura', goObj) + goDlg.cFelDoc = 'Factura' + goDlg.nIdFdoc = 1 + goDlg.nNract = 200 + goDlg.dDataAct = DATE() + goDlg.nIdPartener = 601 + goDlg.cPartener = 'RAJA' + goDlg.cExplicatia = 'Import marfa RAJA' + goDlg.nSuma = 1000 + goDlg.nSumaLei = 0 + goDlg.nCurs = 5.23 + goDlg.nIdValuta = 978 + goDlg.cValuta = 'EUR' + goDlg.nIdExplicatieTva = 220 + goDlg.cExplicatieTva = 'ACH. IMP. 21%' + goDlg.optTipTva.Value = 1 && F = furnizor (normal) + goDlg.chkInValutaCont.Value = 1 + goDlg.chkParticipaValuta.Value = 1 && PARTICIPA la pret - BIFAT + goDlg.WindowType = 0 + goDlg.Visible = .T. + goDlg.Show() + DOEVENTS FORCE + DO R11Log WITH 'DOC1(principal): valideaza = ' + TRANSFORM(goDlg.valideaza()) + DO ConstruiesteToDlg + DO R11Log WITH 'DOC1(principal): do_adauga_factura = ' + TRANSFORM(goObj.do_adauga_factura(goT)) + ' (suma calculata=' + TRANSFORM(goT.suma) + ' lei, participa_valuta=' + TRANSFORM(goT.participa_valuta) + ')' + goDlg.Hide() + DOEVENTS FORCE +ENDPROC + +PROCEDURE AdaugaDocSecundarNeparticipant + *-- DVI 500 lei, BIROUL VAMAL, participa la pret DEBIFAT (chkParticipaValuta.Value=0) - NU + *-- trebuie sa intre in baza diferentei (recalc_diferente/do_calculeaza_diferente, runda11). + goDlg = CREATEOBJECT('import_adauga_factura', goObj) + goDlg.cFelDoc = 'DVI' + goDlg.nIdFdoc = 2 + goDlg.nNract = 300 + goDlg.dDataAct = DATE() + goDlg.nIdPartener = 900 + goDlg.cPartener = 'BIROUL VAMAL' + goDlg.cExplicatia = 'Taxe vamale DVI' + goDlg.nSuma = 500 + goDlg.nSumaLei = 0 + goDlg.nCurs = 0 + goDlg.nIdExplicatieTva = 220 + goDlg.cExplicatieTva = 'ACH. IMP. 21%' + goDlg.optTipTva.Value = 1 && F = furnizor (normal) + goDlg.chkInValutaCont.Value = 0 + goDlg.chkParticipaValuta.Value = 0 && NU PARTICIPA la pret - DEBIFAT (miezul testului) + goDlg.WindowType = 0 + goDlg.Visible = .T. + goDlg.Show() + DOEVENTS FORCE + DO R11Log WITH 'DOC2(DVI, secundar, NU participa): valideaza = ' + TRANSFORM(goDlg.valideaza()) + DO ConstruiesteToDlg + DO R11Log WITH 'DOC2(DVI, secundar, NU participa): do_adauga_factura = ' + TRANSFORM(goObj.do_adauga_factura(goT)) + ' (suma calculata=' + TRANSFORM(goT.suma) + ' lei, participa_valuta=' + TRANSFORM(goT.participa_valuta) + ')' + goDlg.Hide() + DOEVENTS FORCE +ENDPROC + +PROCEDURE ConstruiesteToDlg + *-- toDlg construit INLINE in programul PRINCIPAL (vezi docs/testare-ui-vfp.md capcana l). + goT = CREATEOBJECT('Empty') + =ADDPROPERTY(goT,'serie_act',ALLTRIM(NVL(goDlg.cSerieAct,''))) + =ADDPROPERTY(goT,'nract',goDlg.nNract) + =ADDPROPERTY(goT,'dataact',goDlg.dDataAct) + =ADDPROPERTY(goT,'fdoc',goDlg.cFelDoc) + =ADDPROPERTY(goT,'id_fdoc',goDlg.nIdFdoc) + =ADDPROPERTY(goT,'id_partc',goDlg.nIdPartener) + =ADDPROPERTY(goT,'partc',goDlg.cPartener) + =ADDPROPERTY(goT,'explicatia',ALLTRIM(NVL(goDlg.cExplicatia,''))) + =ADDPROPERTY(goT,'suma',IIF(goDlg.chkInValutaCont.Value=1 AND goDlg.nCurs<>0,IIF(goDlg.nSumaLei<>0,goDlg.nSumaLei,ROUND(goDlg.nSuma*goDlg.nCurs,gnPC)),goDlg.nSuma)) + =ADDPROPERTY(goT,'suma_val',IIF(goDlg.chkInValutaCont.Value=1 AND goDlg.nCurs<>0,goDlg.nSuma,0)) + =ADDPROPERTY(goT,'in_valuta',goDlg.chkInValutaCont.Value) + =ADDPROPERTY(goT,'participa_valuta',(goDlg.chkParticipaValuta.Value=1)) + =ADDPROPERTY(goT,'id_valuta',IIF(goDlg.chkInValutaCont.Value=1,goDlg.nIdValuta,0)) + =ADDPROPERTY(goT,'curs',IIF(goDlg.chkInValutaCont.Value=1,goDlg.nCurs,0)) + =ADDPROPERTY(goT,'nume_val',IIF(goDlg.chkInValutaCont.Value=1,ALLTRIM(NVL(goDlg.cValuta,'')),'')) + =ADDPROPERTY(goT,'cTipTva',IIF(goDlg.optTipTva.Value=1,'F',IIF(goDlg.optTipTva.Value=2,'D','N'))) + =ADDPROPERTY(goT,'id_jtva_coloana',goDlg.nIdExplicatieTva) + =ADDPROPERTY(goT,'dvi_serie',CHRTRAN(ALLTRIM(NVL(goDlg.cSerieDvi,'')),CHR(34),'')) + =ADDPROPERTY(goT,'dvi_nract',goDlg.nNractDvi) + =ADDPROPERTY(goT,'dvi_dataact',goDlg.dDviData) + =ADDPROPERTY(goT,'dvi_id_fdoc',goDlg.nIdFdocDVI) + =ADDPROPERTY(goT,'dvi_fdoc',goDlg.cFelDocDvi) + =ADDPROPERTY(goT,'dvi_id_partc',goDlg.nDviIdPartener) + =ADDPROPERTY(goT,'dvi_partc',goDlg.cDviPartener) + =ADDPROPERTY(goT,'dvi_scc','401') + =ADDPROPERTY(goT,'dvi_tva_lei',goDlg.nDviTvaLei) + =ADDPROPERTY(goT,'dvi_tva_val',goDlg.nDviTvaVal) +ENDPROC + +PROCEDURE CreeazaRulTemp + *-- structura reala rul_temp (vezi test_adauga_repere_212.prg / ointroduceri.vc2:11030). + IF USED('rul_temp') + USE IN ('rul_temp') + ENDIF + CREATE CURSOR rul_temp ( ; + id_rul N(20,0), an N(4,0), luna N(2,0), cod N(20,0); + , serie C(100), nnir N(20,0), id_articol N(10,0), denumire C(100); + , codmat C(50), codmatf C(50), codbare C(50), um C(20); + , id_gestiune N(5,0), nume_gestiune C(50), cgest C(20), nr_pag N(2,0); + , gestionar C(50), comisie_receptie1 C(50), comisie_receptie2 C(50), comisie_receptie3 C(50); + , cant N(14,3), cante N(14,3), cont C(10), acont C(20); + , pret N(18,4), tva N(18,4), valoare N(18,4), valtva N(18,4); + , proc_tva N(5,2), pretv N(18,4), pretvtva N(18,4), tvav N(18,4); + , valoarev N(18,4), valtvav N(18,4), proc_tvav N(5,2), adaos N(18,4); + , adaos_tva N(18,4), valoare_adaos N(18,4), valtva_adaos N(18,4), procent N(10,3); + , discunitar N(18,4), discount_tva N(18,4), valoare_discount N(18,4), valtva_discount N(18,4); + , proc_disc N(7,3), pretd N(14,4), curs N(18,4), id_valuta N(10,0); + , nume_val C(20), id_lucrare N(20,0), nrord C(100), id_responsabil N(10,0); + , nresp C(100), resp_marca N(18,4), dataact T, id_util N(5,0); + , util C(30), dataora T, id_sectie N(5,0), sectie C(50); + , csectie C(10), alcooltutun N(1,0), datain T, dataout T; + , id_fact N(20,0), id_gestiunec N(10,0), nume_gestiunec C(50), cgestc C(20); + , id_responsabilc N(5,0), id_reteta N(10,0), reteta C(50), nrespc C(100); + , respc_marca N(18,4), id_set N(20,0), id_tip_rulaj N(10,0), tip_rulaj C(50); + , id_obiect_depozit N(10,0), id_rul_aux N(10,0), nract N(20,0), serie_act C(10); + , dataoras T, id_utils N(10,0), lot C(30), adata_expirare T; + , id_sucursala N(5,0), sucursala C(250), id_part_rez N(10,0), part_rez C(100); + , id_lucrare_rez N(10,0), nrord_rez C(100), subgrupa C(100), grupa C(100); + , id_subgrupa N(5,0), id_grupa N(5,0), in_stoc N(1,0), in_crm N(1,0); + , id_furnizor N(10,0), furnizor C(100), id_jtva_coloana N(4,0), explicatie_tva C(100); + , taxcode N(6,0), taxname C(254), saft_procent N(18,4), codnc8 C(20); + , id_tara_origine N(4,0), cod_tara_origine C(5), tara_origine C(50), greutate N(12,4); + , fdoc C(30), id_fdoc N(18,4); + , pret_lei N(18,4), pret_val N(14,4), cota_tva N(6,2)) +ENDPROC + +PROCEDURE CreeazaIntrodc + LPARAMETERS tcAlias + IF USED(tcAlias) + USE IN (tcAlias) + ENDIF + CREATE CURSOR (tcAlias) ( ; + id_note N(14), explicatia C(100), scd C(10), ascd C(20), scc C(10), ascc C(20), ; + cu_tva N(1), id_set N(14), ordine N(8), in_valuta N(1), id_jtva_coloana N(14) NULL, ; + ptva N(6,2), explicatie_tva C(50), tipjurnal C(2), taxcode N(6), paymentcode C(9), ; + suma N(18,4), suma_val N(18,4), id_partd N(14), id_partc N(14), partd C(100), partc C(100), ; + id_fact N(14), id_factd N(14), id_factc N(14), pereched N(14), perechec N(14), ; + nract N(14), serie_act C(10), explicatia4 C(50), explicatia5 C(50), participa_valuta L, ; + id_valuta N(14), curs N(14,4), nume_val C(10), dataact D, fdoc C(50), id_fdoc N(14), ; + se_scrie N(1), tva_incasare N(1), doc_color N(10), doc_label C(10), tip_rand C(1), ; + doc_key C(80), nr_doc N(8), suma_doc N(18,4), suma_doc_val N(18,4), mod_manual N(1), ; + scd_orig C(20), ascd_orig C(20)) +ENDPROC + +PROCEDURE DumpIntrodc + LOCAL lnSel + lnSel = SELECT() + SELECT introdc + SCAN + DO R11Log WITH ' recno=' + TRANSFORM(RECNO()) + ' nract=' + TRANSFORM(nract) + ' tip_rand=' + tip_rand + ; + ' scd=' + ALLTRIM(scd) + ' scc=' + ALLTRIM(scc) + ' suma=' + TRANSFORM(suma) + ' suma_val=' + TRANSFORM(suma_val) + ; + ' participa_valuta=' + TRANSFORM(participa_valuta) + ' mod_manual=' + TRANSFORM(mod_manual) + ; + ' explicatia=[' + ALLTRIM(NVL(explicatia,'')) + '] partc=[' + ALLTRIM(NVL(partc,'')) + '] doc_key=[' + ALLTRIM(doc_key) + ']' + ENDSCAN + SELECT (lnSel) +ENDPROC + +FUNCTION RECCOUNT_ACTIVE + LPARAMETERS tcAlias + LOCAL lnSel, lnCnt + lnSel = SELECT() + SELECT (tcAlias) + COUNT TO lnCnt FOR !DELETED() + SELECT (lnSel) + RETURN lnCnt +ENDFUNC + +PROCEDURE R11Err + LPARAMETERS tnErr, tcMsg, tcProg, tnLine + DO R11Log WITH 'ON ERROR ' + TRANSFORM(tnErr) + ' [' + tcProg + ':' + TRANSFORM(tnLine) + '] ' + tcMsg +ENDPROC + +PROCEDURE R11Log + LPARAMETERS tcMsg + SET SAFETY OFF + LOCAL lcL + lcL = IIF(FILE(gcUILog), FILETOSTR(gcUILog), '') + STRTOFILE(lcL + tcMsg + CHR(13)+CHR(10), gcUILog) +ENDPROC + +DEFINE CLASS dummyapp AS Custom + PROCEDURE ReadIni + LPARAMETERS tcSection, tcKey + RETURN '' + ENDPROC + PROCEDURE WriteIni + LPARAMETERS tcSection, tcKey, tcValue + RETURN .T. + ENDPROC +ENDDEFINE + +DEFINE CLASS dummyexecutor AS Custom + cEroare = '' + PROCEDURE oExecute + LPARAMETERS tcSql, tcCursor + IF USED(m.tcCursor) + USE IN (m.tcCursor) + ENDIF + IF 'VJTVA_COLOANE' $ UPPER(m.tcSql) + DO CreeazaJtvaColoaneView WITH m.tcCursor + RETURN 1 + ENDIF + IF UPPER(ALLTRIM(m.tcCursor)) == 'RUL_TEMP' + DO CreeazaRulTemp + ELSE + CREATE CURSOR (m.tcCursor) (id_temp N(1)) + ENDIF + RETURN 1 + ENDPROC + PROCEDURE oExecuta + LPARAMETERS tcSql, tcCursor + IF !EMPTY(m.tcCursor) + IF USED(m.tcCursor) + USE IN (m.tcCursor) + ENDIF + IF UPPER(m.tcCursor) == 'CJTVACOL4427' + CREATE CURSOR (m.tcCursor) (id_jtva_coloana N(14)) + ELSE + CREATE CURSOR (m.tcCursor) (id_temp N(1)) + ENDIF + ENDIF + RETURN .T. + ENDPROC + PROCEDURE oSelect2Value + LPARAMETERS tcSql, toValue + toValue = '' + RETURN 1 + ENDPROC + PROCEDURE oReset + ENDPROC +ENDDEFINE + +PROCEDURE CreeazaJtvaColoaneView + LPARAMETERS tcCursor + IF USED(m.tcCursor) + USE IN (m.tcCursor) + ENDIF + CREATE CURSOR (m.tcCursor) (id_jtva_coloana N(14), denumire C(100), jc N(1), jv N(1), ; + coloana_jc C(20), coloana_jv C(20), cota_tva N(6,2), id_tva N(14) NULL, afisat N(1), ; + id_jtva_ex N(14) NULL, id_jtva_neex N(14) NULL, ordine N(8), ; + taxcode N(6) NULL, taxcode_neexigibil N(6) NULL, taxcode_n50 N(6) NULL, ; + taxcode_n50_tvai N(6) NULL, taxcode_n100 N(6) NULL, taxcode_regularizare N(6) NULL, taxcode_tvai N(6) NULL) + INSERT INTO (m.tcCursor) (id_jtva_coloana, denumire, jc, jv, afisat, ordine, cota_tva) VALUES (0, '', 0, 0, 1, 0, 0) + INSERT INTO (m.tcCursor) (id_jtva_coloana, denumire, jc, jv, coloana_jc, cota_tva, id_tva, afisat, ordine, taxcode) ; + VALUES (208, 'ACH. INT. 21%', 1, 0, 'RO21B', 21, 209, 1, 1, 301104) + INSERT INTO (m.tcCursor) (id_jtva_coloana, denumire, jc, jv, coloana_jc, cota_tva, afisat, ordine, taxcode) ; + VALUES (209, 'TVA ACH. INT. 21%', 1, 0, 'RO21T', 21, 1, 2, 301104) + INSERT INTO (m.tcCursor) (id_jtva_coloana, denumire, jc, jv, coloana_jc, cota_tva, id_tva, afisat, ordine, taxcode) ; + VALUES (220, 'ACH. IMP. 21%', 1, 0, 'FO21B', 21, 221, 1, 3, 301204) + INSERT INTO (m.tcCursor) (id_jtva_coloana, denumire, jc, jv, coloana_jc, cota_tva, afisat, ordine, taxcode) ; + VALUES (221, 'TVA ACH. IMP. 21%', 1, 0, 'FO21T', 21, 1, 4, 301204) +ENDPROC diff --git a/utile/Teste/achizitie_import/test_runda11_diferenta_participa.ps1 b/utile/Teste/achizitie_import/test_runda11_diferenta_participa.ps1 new file mode 100644 index 0000000..f9089aa --- /dev/null +++ b/utile/Teste/achizitie_import/test_runda11_diferenta_participa.ps1 @@ -0,0 +1,10 @@ +# test_runda11_diferenta_participa.ps1 - wrapper peste harness-ul generic pentru RUNDA 11 +# (baza randului D = doar documente participante la pret; randul D mod_manual=1 nu se rescrie). +# Rulare: powershell -ExecutionPolicy Bypass -File test_runda11_diferenta_participa.ps1 +$ErrorActionPreference = 'Stop' +$Teste = $PSScriptRoot +& (Join-Path (Split-Path $Teste -Parent) 'vfp_ui_harness.ps1') ` + -TestPrg (Join-Path $Teste 'test_runda11_diferenta_participa.prg') ` + -Steps @('doc2','articol','asserts12','asserts3') ` + -ShotsDir (Join-Path $Teste 'screenshots_runda11') ` + -SyncDir (Join-Path $Teste 'uisync_runda11')