Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fc8b638d7 | ||
|
|
8dc62f8986 |
No files matched your search
@@ -1,4 +1,4 @@
|
||||
SET ANSI_NULLS ON
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
@@ -7,6 +7,10 @@ IF EXISTS (SELECT * FROM sysobjects WHERE name = 'my_ImpDM_Dekr' AND user_name(u
|
||||
DROP PROCEDURE [CDN].my_ImpDM_Dekr
|
||||
GO
|
||||
|
||||
/*
|
||||
2026.10.14 - KC: import linii jednostronnych (tylko Wn albo tylko Ma). Wcześniej Wn i Ma były łączone przez inner join
|
||||
po DT_GIDLp, więc z dekretu o kilku liniach przechodziły tylko linie mające obie strony.
|
||||
*/
|
||||
CREATE PROCEDURE [CDN].my_ImpDM_Dekr
|
||||
(
|
||||
@DZKNr int -- 1 - DZK_DIGNumer
|
||||
@@ -22,21 +26,23 @@ AS
|
||||
insert into @CRE
|
||||
select DT_GIDNumer, DT_GIDLp, DT_DC, DT_Konto, DT_Kwota, DT_DataCentrali from CDN.Dekrety where DT_DC = 2 and DT_GIDNumer = @DZKNr
|
||||
|
||||
SELECT Lp = ROW_NUMBER() OVER(ORDER BY DZK_Opis, DEL_Opis, deb.DT_Konto, cre.DT_Konto),
|
||||
-- linia dekretu może mieć obie strony albo tylko jedną; brakująca strona = pusty numer konta
|
||||
SELECT Lp = ROW_NUMBER() OVER(ORDER BY DZK_Opis, DEL_Opis, isnull(deb.DT_Konto, ''), isnull(cre.DT_Konto, ''), DEL_GIDLp),
|
||||
DZK_Opis = left (DZK_Opis, 80),
|
||||
[Data] = DEL_DataWyst,
|
||||
DataDokumentu = DEL_DataOper,
|
||||
Kwota = deb.DT_Kwota,
|
||||
Kwota = coalesce(deb.DT_Kwota, cre.DT_Kwota),
|
||||
DokZr = DZK_DokumentZrodlowy,
|
||||
KontoDebet = deb.DT_Konto,
|
||||
KontoCredit = cre.DT_Konto,
|
||||
KontoDebet = isnull(deb.DT_Konto, ''),
|
||||
KontoCredit = isnull(cre.DT_Konto, ''),
|
||||
Identyfikator = left(DZK_Opis, 80),
|
||||
Opis = left(DEL_Opis, 80),
|
||||
DataImportu = CDN.TsToDate(coalesce(deb.DT_DataCentrali, 0), 1)
|
||||
DataImportu = CDN.TsToDate(coalesce(deb.DT_DataCentrali, cre.DT_DataCentrali, 0), 1)
|
||||
FROM CDN.Dziennik inner join CDN.DziennikElem on DZK_GIDNumer = DEL_GIDNumer
|
||||
inner join @DEB deb ON deb.DT_GIDNumer = DEL_GIDNumer and deb.DT_GIDLp = DEL_GIDLp
|
||||
inner join @CRE cre ON cre.DT_GIDNumer = DEL_GIDNumer and cre.DT_GIDLp = DEL_GIDLp
|
||||
left outer join @DEB deb ON deb.DT_GIDNumer = DEL_GIDNumer and deb.DT_GIDLp = DEL_GIDLp
|
||||
left outer join @CRE cre ON cre.DT_GIDNumer = DEL_GIDNumer and cre.DT_GIDLp = DEL_GIDLp
|
||||
where DZK_GIDNumer = @DZKNr
|
||||
and (deb.DT_GIDNumer is not null or cre.DT_GIDNumer is not null)
|
||||
order by 1
|
||||
|
||||
|
||||
|
||||
@@ -190,17 +190,22 @@ Partial Public Class MainFrm
|
||||
BsTbmy_ImpDM_Dekr.ResetBindings(False)
|
||||
BsTbmy_ImpDM_Dekr.MoveFirst()
|
||||
While i < BsTbmy_ImpDM_Dekr.Count
|
||||
KontoWn = BsTbmy_ImpDM_Dekr.Current("KontoDebet")
|
||||
KontoMa = BsTbmy_ImpDM_Dekr.Current("KontoCredit")
|
||||
KontoWn = If(IsDBNull(BsTbmy_ImpDM_Dekr.Current("KontoDebet")), "", BsTbmy_ImpDM_Dekr.Current("KontoDebet"))
|
||||
KontoMa = If(IsDBNull(BsTbmy_ImpDM_Dekr.Current("KontoCredit")), "", BsTbmy_ImpDM_Dekr.Current("KontoCredit"))
|
||||
KKS_Wn = 0
|
||||
KKS_Ma = 0
|
||||
Rok = Year(DataDok)
|
||||
sql = "select top(1) KKS_GIDNumer from CDN.Konta where KKS_Rok = " & CStr(Rok) & " and KKS_Konto = '" & KontoWn & "'"
|
||||
line = GetOneVal(sql, DstConn_str)
|
||||
If line > "" Then KKS_Wn = CInt(line)
|
||||
sql = "select top(1) KKS_GIDNumer from CDN.Konta where KKS_Rok = " & CStr(Rok) & " and KKS_Konto = '" & KontoMa & "'"
|
||||
line = GetOneVal(sql, DstConn_str)
|
||||
If line > "" Then KKS_Ma = CInt(line)
|
||||
' linia jednostronna - pusta strona zostaje z KKSNumer = 0
|
||||
If KontoWn > "" Then
|
||||
sql = "select top(1) KKS_GIDNumer from CDN.Konta where KKS_Rok = " & CStr(Rok) & " and KKS_Konto = '" & KontoWn & "'"
|
||||
line = GetOneVal(sql, DstConn_str)
|
||||
If line > "" Then KKS_Wn = CInt(line)
|
||||
End If
|
||||
If KontoMa > "" Then
|
||||
sql = "select top(1) KKS_GIDNumer from CDN.Konta where KKS_Rok = " & CStr(Rok) & " and KKS_Konto = '" & KontoMa & "'"
|
||||
line = GetOneVal(sql, DstConn_str)
|
||||
If line > "" Then KKS_Ma = CInt(line)
|
||||
End If
|
||||
With NotaPozycjaInfo
|
||||
.Kwota = Str(BsTbmy_ImpDM_Dekr.Current("Kwota")) + Chr(0) 'Kwota
|
||||
.NumerDokumentu = NrDok + Chr(0) 'Numer dokumentu
|
||||
|
||||
Generated
+1
-1
@@ -633,7 +633,7 @@ Partial Class MainFrm
|
||||
Me.Name = "MainFrm"
|
||||
Me.Padding = New System.Windows.Forms.Padding(3)
|
||||
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
|
||||
Me.Text = "Import dokumentów magazynowych 2.0.1 z 13.10.2026"
|
||||
Me.Text = "Import dokumentów magazynowych 2.0.2 z 14.10.2026"
|
||||
Me.TlMainPanel.ResumeLayout(False)
|
||||
Me.Panel1.ResumeLayout(False)
|
||||
Me.Panel1.PerformLayout()
|
||||
|
||||
+42
-4
@@ -204,6 +204,21 @@ Public Class MainFrm
|
||||
End If
|
||||
End Sub
|
||||
|
||||
' odświeżenie listy po zmianie konta z opóźnieniem - przewijanie listy kont przytrzymanym klawiszem
|
||||
' albo wpisywanie numeru konta nie uruchamia zapytania po każdej zmianie, tylko raz po 0,5 s spokoju
|
||||
Private WithEvents TmKonto As New System.Windows.Forms.Timer With {.Interval = 500}
|
||||
Private WczytaneKonto As String = ""
|
||||
|
||||
Private Sub CbKonto_TextChanged(sender As Object, e As EventArgs) Handles CbKonto.TextChanged
|
||||
TmKonto.Stop()
|
||||
If SourceConnected AndAlso CbKonto.Text <> WczytaneKonto Then TmKonto.Start()
|
||||
End Sub
|
||||
|
||||
Private Sub TmKonto_Tick(sender As Object, e As EventArgs) Handles TmKonto.Tick
|
||||
TmKonto.Stop()
|
||||
If CbKonto.Text <> WczytaneKonto Then OdswiezDane()
|
||||
End Sub
|
||||
|
||||
Private Sub CbMiesiac_TextChanged(sender As Object, e As EventArgs) Handles CbMiesiac.TextChanged
|
||||
If SourceConnected Then
|
||||
Mies = CbMiesiac.Items.IndexOf(CbMiesiac.Text) + 1
|
||||
@@ -243,9 +258,23 @@ Public Class MainFrm
|
||||
OdswiezDane()
|
||||
End Sub
|
||||
|
||||
Private Sub DgvDokumenty_RowPostPaint(sender As Object, e As DataGridViewRowPostPaintEventArgs) Handles DgvDokumenty.RowPostPaint
|
||||
If Not DgvDokumenty.Rows(e.RowIndex).Cells("colDataImportu").Value Is DBNull.Value Then
|
||||
If CStr(DgvDokumenty.Rows(e.RowIndex).Cells("colDataImportu").Value) > "1990-01-01" Then DgvDokumenty.Rows(e.RowIndex).DefaultCellStyle.ForeColor = Color.Red
|
||||
' Dokument niezaimportowany ma DataImportu = 1990-01-01 (DT_DataCentrali = 0) albo NULL
|
||||
Private Shared ReadOnly BrakImportu As Date = New Date(1990, 1, 1)
|
||||
|
||||
Private Function CzyZaimportowany(ByVal Wiersz As DataRowView) As Boolean
|
||||
Dim Data As Object = Wiersz("DataImportu")
|
||||
Return Not IsDBNull(Data) AndAlso CDate(Data) > BrakImportu
|
||||
End Function
|
||||
|
||||
' zaimportowane - czerwona czcionka, czekające na import - czarna
|
||||
Private Sub DgvDokumenty_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs) Handles DgvDokumenty.CellFormatting
|
||||
If e.RowIndex < 0 OrElse e.RowIndex >= BsTbmy_ImpDM_Src.Count Then Return
|
||||
' wiersz z BindingSource, a nie z DgvDokumenty.Rows - nie rozwiązuje współdzielonych wierszy grida
|
||||
If CzyZaimportowany(CType(BsTbmy_ImpDM_Src(e.RowIndex), DataRowView)) Then
|
||||
e.CellStyle.ForeColor = Color.Red
|
||||
e.CellStyle.SelectionForeColor = Color.LightPink
|
||||
Else
|
||||
e.CellStyle.ForeColor = Color.Black
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -411,7 +440,9 @@ Public Class MainFrm
|
||||
|
||||
If Not SourceConnected Then Return
|
||||
|
||||
TmKonto.Stop()
|
||||
Konto = CbKonto.Text
|
||||
WczytaneKonto = Konto
|
||||
ImpFl = 2
|
||||
If RbBlack.Checked Then ImpFl = 0 Else If RbRed.Checked Then ImpFl = 1
|
||||
|
||||
@@ -425,7 +456,14 @@ Public Class MainFrm
|
||||
lbUwaga.Refresh()
|
||||
Application.DoEvents()
|
||||
pos = BsTbmy_ImpDM_Src.Position
|
||||
Tamy_ImpDM_Src.Fill(Me.DsMain.Tbmy_ImpDM_Src, SpFlag, ZakFlag, WewFlag, RM, Rok, Mies, Konto, ImpFl)
|
||||
' bez powiadamiania grida o każdym wczytanym wierszu - jedno odświeżenie po Fill
|
||||
BsTbmy_ImpDM_Src.RaiseListChangedEvents = False
|
||||
Try
|
||||
Tamy_ImpDM_Src.Fill(Me.DsMain.Tbmy_ImpDM_Src, SpFlag, ZakFlag, WewFlag, RM, Rok, Mies, Konto, ImpFl)
|
||||
Finally
|
||||
BsTbmy_ImpDM_Src.RaiseListChangedEvents = True
|
||||
BsTbmy_ImpDM_Src.ResetBindings(False)
|
||||
End Try
|
||||
If pos < BsTbmy_ImpDM_Src.Count Then BsTbmy_ImpDM_Src.Position = pos Else BsTbmy_ImpDM_Src.Position = BsTbmy_ImpDM_Src.Count - 1
|
||||
lbUwaga.Visible = False
|
||||
lbUwaga.Invalidate()
|
||||
|
||||
Reference in new issue
Block a user