on 09-16-2014 11:51 AM
Hi everyone,
I try to get de DueDate from:
Public Sub TestMethod_GetDueDate(ByVal cardCode As String, ByVal refDate As Date)
Dim vObj As SAPbobsCOM.SBObob
Dim rs As SAPbobsCOM.Recordset
Dim strResult As String
Dim errResult As String
Set vObj =m_company. GetBusinessObject(BoBridge)
Set rs =m_company. GetBusinessObject(BoRecordset)
Set rs = vObj.GetDueDate(cardCode, refDate)
strResult = RecorsetToText(rs)
errResult = GetLastErrorString()
OutputMessage(strResult, errResult)
End Sub
But is not working.
Is there anyone that work it?
The SBO version is 882 PL09.
Thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I done this:
Public Function getDueDateBP(ByVal CardCode As String, ByVal RefDate As Date) As Date
'
getDueDateBP = RefDate
'
Dim ls As String
Dim oRcs As SAPbobsCOM.Recordset = Nothing
'
ls = ""
ls &= " SELECT" & vbCrLf
ls &= " PL.Months [MonthAdded]," & vbCrLf
ls &= " PL.PmntDate as [Day]" & vbCrLf
ls &= " FROM(" & vbCrLf
ls &= " SELECT" & vbCrLf
ls &= " CASE" & vbCrLf
ls &= " WHEN PmntDate >= " & RefDate.Day & " THEN 0" & vbCrLf
ls &= " ELSE 1" & vbCrLf
ls &= " END as [Months],*" & vbCrLf
ls &= " FROM CRD5 " & vbCrLf
ls &= " WHERE (CardCode = '" & CardCode & "')" & vbCrLf
ls &= " )PL" & vbCrLf
ls &= " ORDER BY PL.Months, PL.PmntDate" & vbCrLf
'
oRcs = m_SBOAddon.SBO_Company.GetBusinessObject(BoRecordset)
'
oRcs.DoQuery(ls)
' Guardem en un HT els dies i els mesos a afegir a l'actual data
If Not oRcs.EoF Then
oRcs.MoveFirst()
Dim oDate = New Date(RefDate.Year, RefDate.Month, RefDate.Day)
While Not oRcs.EoF
oDate = DateAdd(DateInterval.Month, oRcs.Fields.Item("MonthAdded").Value, oDate)
'CDate(oDate).AddMonths(oRcs.Fields.Item("MonthAdded").Value)
oDate = New Date(CDate(oDate).Year, CDate(oDate).Month, oRcs.Fields.Item("Day").Value)
If IsDate(oDate) Then
getDueDateBP = oDate
Exit While
End If
End While
End If
'
LiberarObjCOM(oRcs)
'
End Function
RefDate has added the days of payment (+30, +60...)
Thanks
Hi Carles,
Maybe it's related to the PL, the following code works fine for me in 9.0.
// on the 16.09.2014
Recordset rs = bob.GetDueDate("C23900", DateTime.Today);
DateTime dueDate = rs.Fields.Item(0).Value;
Console.WriteLine(dueDate);
The output is 16.10.2014 and the payment terms for the BP is 30 days.
Best regards,
Pedro Magueija
User | Count |
---|---|
101 | |
14 | |
10 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.