Public Function Get_SystemNo_Form3(ByVal CN As SqlClient.SqlConnection, ByVal SQL_TRAN As SqlClient.SqlTransaction, ByVal sBus_type As String, ByVal sDoc_type As String) As String
Dim Result_Value As String = ""
Dim sPrefix As String = ""
Dim iRefNo As Integer = 0
Dim dToDay As DateTime = GetSqlServer_DateTime()
Dim strSQL As String
If dToDay.ToString("yyyy") + dToDay.ToString("MM") + dToDay.ToString("dd") <> "19000101" Then
strSQL = "update tb_systemno set doc_no = doc_no where Bus_type=@P2 and doc_type=@P3"
Dim CMD11 As New SqlClient.SqlCommand(strSQL, CN)
CMD11.Transaction = SQL_TRAN
CMD11.Parameters.Clear()
CMD11.Parameters.Add(New SqlClient.SqlParameter("@P2", SqlDbType.NVarChar))
CMD11.Parameters("@P2").Value = sBus_type
CMD11.Parameters.Add(New SqlClient.SqlParameter("@P3", SqlDbType.NVarChar))
CMD11.Parameters("@P3").Value = sDoc_type
CMD11.ExecuteNonQuery()
strSQL = "select prefix,doc_no, pad_no, Reset_Flag, Current_Data, getdate() as Get_Date "
strSQL += " from tb_systemno where Bus_type=@P2 and doc_type=@P3"
CMD11.CommandText = strSQL
CMD11.Parameters.Clear()
CMD11.Parameters.Add(New SqlClient.SqlParameter("@P2", SqlDbType.NVarChar))
CMD11.Parameters("@P2").Value = sBus_type
CMD11.Parameters.Add(New SqlClient.SqlParameter("@P3", SqlDbType.NVarChar))
CMD11.Parameters("@P3").Value = sDoc_type