fakt, Abrechnung, ustva.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
Imports System.IO
|
||||
Imports System.Web.UI.WebControls.Expressions
|
||||
Imports Chilkat
|
||||
Imports com.sun.org.apache.bcel.internal.generic
|
||||
Imports VERAG_PROG_ALLGEMEIN
|
||||
|
||||
Public Class usrCntlFaktAbrechnung
|
||||
@@ -1401,11 +1402,11 @@ Public Class usrCntlFaktAbrechnung
|
||||
Try
|
||||
If dgvOfferteDetailsUebersicht.Columns IsNot Nothing AndAlso dgvOfferteDetailsUebersicht.Columns("LeistungsNr") IsNot Nothing Then dgvOfferteDetailsUebersicht.Sort(dgvOfferteDetailsUebersicht.Columns("LeistungsNr"), System.ComponentModel.ListSortDirection.Ascending)
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
|
||||
Try
|
||||
Dim landNr As String = ""
|
||||
Dim landBez = CheckLandNr_getLandBezFromLandNr(landNr)
|
||||
|
||||
For Each r As DataGridViewRow In dgvOfferteDetailsUebersicht.Rows
|
||||
If r.Cells("Anzahl").Value IsNot DBNull.Value AndAlso Not IsNumeric(r.Cells("Anzahl").Value) Then r.Cells("Anzahl").Value = 0
|
||||
If r.Cells("Preis").Value IsNot DBNull.Value AndAlso Not IsNumeric(r.Cells("Preis").Value) Then r.Cells("Preis").Value = 0
|
||||
@@ -1419,32 +1420,10 @@ Public Class usrCntlFaktAbrechnung
|
||||
POS.Preis = If(r.Cells("Preis").Value Is DBNull.Value, 0, CDbl(r.Cells("Preis").Value.ToString.Replace(".", "")))
|
||||
POS.Anzahl = If(r.Cells("Anzahl").Value Is DBNull.Value, 0, r.Cells("Anzahl").Value)
|
||||
|
||||
If SPEDBUCH.Abfertigungsart = 114 Or SPEDBUCH.Abfertigungsart = 115 Or SPEDBUCH.Abfertigungsart = 10 Then 'MWST-Abrechnung! + Kompat. zu FM-Zoll
|
||||
Dim LeistungsBez = r.Cells("LeistungsBez").Value
|
||||
If LeistungsBez <> "" Then
|
||||
Dim isMWST As Boolean = False
|
||||
If SPEDBUCH.Packstücke.ToString.Contains("Mehrwertsteuerrückerstattung") Then
|
||||
Dim LandNr As String = SPEDBUCH.Packstücke.ToString.Replace("Mehrwertsteuerrückerstattung ", "")
|
||||
LandNr = LandNr.Substring(0, 2).Trim()
|
||||
Dim LandBez = SQL.getValueTxtBySql("select LandKz from [Länderverzeichnis für die Außenhandelsstatistik] where LandNr = " & LandNr, "FMZOLL")
|
||||
'-----------------------MWST-Abrechnung! + Kompat. zu FM-Zoll
|
||||
setMWSTABRfromSPEDinPOS(r, POS, landNr, landBez)
|
||||
'-----------------------MWST-Abrechnung! + Kompat. zu FM-Zoll
|
||||
|
||||
If LandBez <> "" AndAlso SPEDBUCH.Packstücke.ToString.Replace("Mehrwertsteuerrückerstattung " & LandNr, "MWSt-Rückerstattung " & LandBez).StartsWith(LeistungsBez.ToString) Then isMWST = True
|
||||
Else
|
||||
|
||||
If SPEDBUCH.Packstücke.ToString().StartsWith(LeistungsBez.ToString) Then isMWST = True
|
||||
|
||||
End If
|
||||
If isMWST Then
|
||||
POS.Anzahl = 1
|
||||
|
||||
If POS.Preis = 0 Then
|
||||
POS.Preis = IIf(SPEDBUCH.Rechnungsbetrag IsNot Nothing, 0, SPEDBUCH.Rechnungsbetrag) * -1
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If POS.Anzahl = 0 And POS.BerechnungsartNr = 8 And POS.Preis <> 0 Then
|
||||
POS.Preis = 0 'Wenn Anzahl =0 bei Berart 8, dann Preis auch 0
|
||||
@@ -1791,7 +1770,7 @@ Public Class usrCntlFaktAbrechnung
|
||||
If DAID <> "" AndAlso IsNumeric(DAID) Then
|
||||
Dim daidno As Integer = CInt(DAID)
|
||||
Dim ds As New cDATENSERVER(daidno)
|
||||
.Rows.Add(0, nameLief, ds.da_name, ds.da_id, ds.da_id)
|
||||
.Rows.Add(1, nameLief, ds.da_name, ds.da_id, ds.da_id)
|
||||
End If
|
||||
|
||||
Next
|
||||
@@ -1803,7 +1782,7 @@ Public Class usrCntlFaktAbrechnung
|
||||
Dim FI As New FileInfo(pfadExcel)
|
||||
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER("DOKUMENTE", "MDM", "POS_LISTE", "", "", SPEDBUCH.AbfertigungsNr & FI.Extension, USTV.UStVAn_KuNr, False)
|
||||
DS.uploadDataToDATENSERVER(pfadExcel, FI.Name, FI.Extension,,,, True)
|
||||
.Rows.Add(0, "POS-LIST", DS.da_name, DS.da_id, DS.da_id)
|
||||
.Rows.Add(1, "POS-LIST", DS.da_name, DS.da_id, DS.da_id)
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -4364,6 +4343,46 @@ Nächste_Textzeile_lesen:
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function CheckLandNr_getLandBezFromLandNr(ByRef LandNr As String) As String
|
||||
|
||||
Dim landbez As String = ""
|
||||
If SPEDBUCH Is Nothing Then Return landbez
|
||||
If SPEDBUCH.Packstücke.ToString.Contains("Mehrwertsteuerrückerstattung") Then
|
||||
LandNr = SPEDBUCH.Packstücke.ToString.Replace("Mehrwertsteuerrückerstattung ", "")
|
||||
LandNr = LandNr.Substring(0, 2).Trim()
|
||||
If IsNumeric(LandNr) Then
|
||||
landbez = SQL.getValueTxtBySql("select LandKz from [Länderverzeichnis für die Außenhandelsstatistik] where LandNr = " & LandNr, "FMZOLL")
|
||||
Return landbez
|
||||
ElseIf LandNr = "AT" Then
|
||||
landbez = LandNr
|
||||
Return landbez
|
||||
End If
|
||||
End If
|
||||
Return landbez
|
||||
End Function
|
||||
|
||||
Private Sub setMWSTABRfromSPEDinPOS(r As DataGridViewRow, POS As cRechnungsausgangPositionen, LandNr As String, LandBez As String)
|
||||
|
||||
If SPEDBUCH.Abfertigungsart = 114 Or SPEDBUCH.Abfertigungsart = 115 Or SPEDBUCH.Abfertigungsart = 10 Then
|
||||
Dim LeistungsBez = r.Cells("LeistungsBez").Value
|
||||
If LeistungsBez <> "" Then
|
||||
Dim isMWST As Boolean = False
|
||||
If LandBez <> "" AndAlso LandNr <> "" Then
|
||||
If SPEDBUCH.Packstücke.ToString.Replace("Mehrwertsteuerrückerstattung " & LandNr, "MWSt-Rückerstattung " & LandBez).StartsWith(LeistungsBez.ToString) Then isMWST = True
|
||||
Else
|
||||
If SPEDBUCH.Packstücke.ToString().StartsWith(LeistungsBez.ToString) Then isMWST = True
|
||||
End If
|
||||
|
||||
If isMWST Then
|
||||
POS.Anzahl = 1
|
||||
|
||||
If POS.Preis = 0 Then
|
||||
POS.Preis = IIf(SPEDBUCH.Rechnungsbetrag Is Nothing, 0, SPEDBUCH.Rechnungsbetrag) * -1
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -2719,7 +2719,6 @@ Public Class frmMDM_USTVAntrag
|
||||
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub initdgvErstattungen(Optional posIndex As Integer = -1)
|
||||
|
||||
@@ -46,21 +46,20 @@ Public Class frmBU_Mahnlauf
|
||||
" & If(MyComboBox1._value > 0, " and max(si_mahnstufe)>='" & MyComboBox1._value & "'", "") & "
|
||||
ORDER BY KTO.c_name"
|
||||
|
||||
Dim sqlStringVerag360 = "SELECT i_personenkonto Konto,KTO.c_name, KTO.c_landid Land,/*KTO.c_plz + ' ' + KTO.c_ort Ort,isnull(KTO.c_email,'') Email, */ " &
|
||||
"isnull(( SELECT TOP 1 [Zahlungsinformationen] FROM [FMZOLL\SQLFMZOLL].[VERAG].[dbo].Kunden where KundenNr=i_personenkonto ) ,'') Zahlungsinfo, cast(min (OWNFIELD_Belegdatum)as date) as 'ältesteRg'," &
|
||||
"count(*) Anzahl, sum(eur_bruttobetrag+eur_zahlung) Ausstand ,min(op.d_netto) Faelligkeit,max(si_mahnstufe) Mahnstufe, cast(MAX(d_mahnung)as date) Mahndatum, max(replace(KTO.c_zahlziel,'0/0/','')) ZZ,
|
||||
|
||||
Dim sqlStringVerag360 = "SELECT i_personenkonto Konto,KTO.c_name, KTO.c_landid Land,max(KTO.dec_aktuellersaldo) as Saldo,/*KTO.c_plz + ' ' + KTO.c_ort Ort,isnull(KTO.c_email,'') Email, */ " &
|
||||
"cast(min (OWNFIELD_Belegdatum)as date) as 'ältesteRg', sum(eur_bruttobetrag+eur_zahlung) as Ausstand,min(op.d_netto) Faelligkeit,max(si_mahnstufe) as MS,max(KTO.dec_wert3) as Risiko, cast(MAX(d_mahnung)as date) Mahndatum,max(Kunden.UStV_Summe3470BetragEUR) as '3470' ,max(Kunden.UStV_SummeVZBetragEUR) as V,
|
||||
case
|
||||
when max(si_mahnstufe) = 1 and max((replace(KTO.c_zahlziel,'0/0/',''))) = 20 Then 'telefonisch'
|
||||
when max(si_mahnstufe) = 1 and max((replace(KTO.c_zahlziel,'0/0/',''))) = 30 Then 'ZZ 30 Tage'
|
||||
when max(si_mahnstufe) = 1 and cast(MAX(d_mahnung)as date) < (GETDATE()- 60) Then 'Sperre Donnerstag'
|
||||
when max(si_mahnstufe) = 2 and max((replace(KTO.c_zahlziel,'0/0/',''))) = 20 Then 'Sperre Freitag'
|
||||
when max(si_mahnstufe) = 2 and max((replace(KTO.c_zahlziel,'0/0/',''))) = 30 Then 'ZZ 30 Tage'
|
||||
when max(si_mahnstufe) >= 3 Then 'Sperre Donnerstag'
|
||||
when max(si_mahnstufe) = 1 Then 'telefonisch'
|
||||
when max(si_mahnstufe) = 2 Then 'Freitag'
|
||||
when max(si_mahnstufe) = 3 Then 'Donnerstag'
|
||||
when max(si_mahnstufe) = 4 Then 'Mittwoch'
|
||||
when max(si_mahnstufe) >= 5 Then 'gesperrt'
|
||||
else '-'
|
||||
End as sperre" & If(cbxNurFaellig.Checked, "", ",SUM(CASE WHEN op.d_netto<getDATE() THEN (eur_bruttobetrag+eur_zahlung) ELSE 0 END) Summe_Faellig") & "
|
||||
End as sperre,
|
||||
sum(case when OP.c_typ = 'g' then isnull(OP.eur_bruttobetrag, 0) + isnull(OP.eur_zahlung, 0) else 0 end) as Gutschrift " & If(cbxNurFaellig.Checked, "", ",SUM(CASE WHEN op.d_netto<getDATE() THEN (eur_bruttobetrag+eur_zahlung) ELSE 0 END) Summe_Faellig") & "
|
||||
FROM op_debitor OP
|
||||
RIGHT join fibu_konto KTO on i_personenkonto=i_konto AND KTO.i_firm_refid=OP.i_firm_refid
|
||||
inner join [FMZOLL\SQLFMZOLL].[VERAG].[dbo].[Kunden] on Kunden.KundenNr = i_personenkonto
|
||||
WHERE (OP.i_firm_refid = '" & Firma_ID & "') AND (dt_geloescht IS NULL)
|
||||
" & If(cbxNurFaellig.Checked, " and op.d_netto<=getdate() and isnull(si_mahnflags,0) <>(1) ", "") & "
|
||||
" & If(KdNr > 0, " AND i_personenkonto ='" & KdNr & "'", "") & "
|
||||
@@ -124,34 +123,38 @@ Public Class frmBU_Mahnlauf
|
||||
|
||||
.Columns("Land").Width = 40
|
||||
|
||||
.Columns("Anzahl").Width = 40
|
||||
|
||||
If Firma_ID = 19 Then
|
||||
.Columns("Zahlungsinfo").Width = 300
|
||||
.Columns("ältesteRg").Width = 75
|
||||
.Columns("MS").Width = 50
|
||||
.Columns("Faelligkeit").Width = 75
|
||||
.Columns("Faelligkeit").HeaderText = "Fälligkeit"
|
||||
Else
|
||||
.Columns("Email").Width = 150
|
||||
.Columns("Ort").Width = 150
|
||||
|
||||
.Columns("Anzahl").Width = 40
|
||||
.Columns("Faelligkeit").Width = 75
|
||||
.Columns("Faelligkeit").HeaderText = "Fälligkeit"
|
||||
.Columns("Ausstand").HeaderText = "Betrag"
|
||||
.Columns("Mahnstufe").Width = 50
|
||||
End If
|
||||
|
||||
|
||||
.Columns("Faelligkeit").Width = 75
|
||||
.Columns("Faelligkeit").HeaderText = "Fälligkeit"
|
||||
|
||||
|
||||
.Columns("Mahndatum").Width = 75
|
||||
|
||||
.Columns("Konto").Width = 75
|
||||
.Columns("Konto").HeaderText = "KdNr/Konto"
|
||||
.Columns("Ausstand").Width = 75
|
||||
.Columns("Ausstand").HeaderText = "Betrag"
|
||||
|
||||
|
||||
If Not cbxNurFaellig.Checked Then
|
||||
.Columns("Summe_Faellig").Width = 75
|
||||
.Columns("Summe_Faellig").HeaderText = "Summe fällig"
|
||||
End If
|
||||
|
||||
.Columns("Mahnstufe").Width = 50
|
||||
|
||||
End If
|
||||
|
||||
End With
|
||||
|
||||
Reference in New Issue
Block a user