i have code here ...
<pre> If Not dr.HasRows Then
penfaktur.Text = "" + Format(Now, "ddMMyyyy") + "NF" + "0001"
Else
penfaktur.Text = Val(Microsoft.VisualBasic.Mid(dr.Item("no_faktur").ToString, 11, 4)) + 1
If Len(penfaktur.Text) = 1 Then
penfaktur.Text = "" + Format(Now, "ddMMyyyy") + "NF000" & penfaktur.Text & ""
ElseIf Len(penfaktur.Text) = 2 Then
penfaktur.Text = "" + Format(Now, "ddMMyyyy") + "NF00" & penfaktur.Text & ""
ElseIf Len(penfaktur.Text) = 3 Then
penfaktur.Text = "" + Format(Now, "ddMMyyyy") + "NF0" & penfaktur.Text & ""
ElseIf Len(penfaktur.Text) = 4 Then
penfaktur.Text = "" + Format(Now, "ddMMyyyy") + "NF" & penfaktur.Text & ""
End If
End If
I want every date change the number back to "0001" ..
help me..
ex :
01072017NF0099
01072017NF0100
02072017NF0001 <--- Change back to NF + 0001 here, since the date changed
02072017NF0002
03072017NF0001 <--- Change back to NF + 0001 here, since the date changed
What I have tried:
If Not dr.HasRows Then
penfaktur.Text = "" + Format(Now, "ddMMyyyy") + "NF" + "0001"
Else
penfaktur.Text = Val(Microsoft.VisualBasic.Mid(dr.Item("no_faktur").ToString, 11, 4)) + 1
If Len(penfaktur.Text) = 1 Then
penfaktur.Text = "" + Format(Now, "ddMMyyyy") + "NF000" & penfaktur.Text & ""
ElseIf Len(penfaktur.Text) = 2 Then
penfaktur.Text = "" + Format(Now, "ddMMyyyy") + "NF00" & penfaktur.Text & ""
ElseIf Len(penfaktur.Text) = 3 Then
penfaktur.Text = "" + Format(Now, "ddMMyyyy") + "NF0" & penfaktur.Text & ""
ElseIf Len(penfaktur.Text) = 4 Then
penfaktur.Text = "" + Format(Now, "ddMMyyyy") + "NF" & penfaktur.Text & ""
End If
End If