Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports CrystalDecisions.CrystalReports.Engine
- Imports CrystalDecisions.Shared
- Public Class rptStockPickingNote
- Private Sub rptStockPickingNote_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- BindCombobox(cboItemSubCategoryFrom, "SUBCATEGORY", "SUBCATEGORY", "SELECT SUBCATEGORY, DESP FROM SUBCATEGORY ORDER BY SUBCATEGORY")
- BindCombobox(cboItemSubCategoryTo, "SUBCATEGORY", "SUBCATEGORY", "SELECT SUBCATEGORY, DESP FROM SUBCATEGORY ORDER BY SUBCATEGORY")
- 'BindCombobox(cboStatus, "ITEMCONFIRMFLAG", "ITEMCONFIRMFLAG", "SELECT DISTINCT ITEMCONFIRMFLAG FROM SPNDTL(NOLOCK)")
- BindCombobox(cboStatus, "YESNOVALUE", "YESNODESC", "SELECT 'Y' AS YESNOVALUE, 'Y' AS YESNODESC UNION ALL SELECT 'N' AS YESNOVALUE, 'N or E' AS YESNODESC")
- ClearFields()
- End Sub
- Private Sub ClearFields()
- dtpSPNDateFrom.Value = DateAdd(DateInterval.Month, -1, Now.Date)
- dtpSPNDateTo.Value = Date.Now
- txtFromItem.Text = ""
- txtToItem.Text = ""
- rdbReportDetail.Checked = True
- rdbSortSPN.Checked = True
- End Sub
- Private Function ChkValid() As Boolean
- Dim strMsg As String = ""
- ChkValid = False
- If dtpSPNDateFrom.Value > dtpSPNDateTo.Value Then
- strMsg = strMsg & "From SPN Date cannot greater than To SPN Date." & vbCrLf
- End If
- If txtFromItem.Text <> "" Then
- If CheckIsExist("ITEM", "ITEMNO = " & CSql(txtFromItem.Text)) = False Then
- strMsg = strMsg & "Invalid From Item #." & vbCrLf
- End If
- End If
- If txtToItem.Text <> "" Then
- If CheckIsExist("ITEM", "ITEMNO = " & CSql(txtToItem.Text)) = False Then
- strMsg = strMsg & "Invalid To Item #." & vbCrLf
- End If
- End If
- If strMsg <> "" Then
- DisplayMessage(strMsg, "")
- ChkValid = False
- Else
- ChkValid = True
- End If
- Return ChkValid
- End Function
- Private Sub btnFromItem_Click(sender As Object, e As EventArgs) Handles btnFromItem.Click
- With frmPopUpMasterK
- .txtTable.Text = "ITEM"
- .txtForm.Text = Me.Name
- .txtField.Text = "F"
- .BindGrid()
- .BringToFront()
- .Show()
- End With
- End Sub
- Private Sub btnToItem_Click(sender As Object, e As EventArgs) Handles btnToItem.Click
- With frmPopUpMasterK
- .txtTable.Text = "ITEM"
- .txtForm.Text = Me.Name
- .txtField.Text = "T"
- .BindGrid()
- .BringToFront()
- .Show()
- End With
- End Sub
- Private Sub dtpSPNDateFrom_KeyDown(sender As Object, e As KeyEventArgs) Handles dtpSPNDateFrom.KeyDown
- SetNextFocusManual(e, dtpSPNDateTo)
- End Sub
- Private Sub dtpSPNDateFrom_KeyPress(sender As Object, e As KeyPressEventArgs) Handles dtpSPNDateFrom.KeyPress
- e.KeyChar = Chr(KeyAscCode(Asc(e.KeyChar)))
- End Sub
- Private Sub dtpSPNDateTo_KeyDown(sender As Object, e As KeyEventArgs) Handles dtpSPNDateTo.KeyDown
- SetNextFocusManual(e, txtFromItem)
- End Sub
- Private Sub dtpSPNDateTo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles dtpSPNDateFrom.KeyPress
- e.KeyChar = Chr(KeyAscCode(Asc(e.KeyChar)))
- End Sub
- Private Sub txtFromItem_KeyDown(sender As Object, e As KeyEventArgs) Handles txtFromItem.KeyDown
- SetNextFocusManual(e, txtToItem)
- End Sub
- Private Sub txtFromItem_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtFromItem.KeyPress
- e.KeyChar = Chr(KeyAscCode(Asc(e.KeyChar)))
- End Sub
- Private Sub txtToItem_KeyDown(sender As Object, e As KeyEventArgs) Handles txtToItem.KeyDown
- SetNextFocusManual(e, cboItemSubCategoryFrom)
- End Sub
- Private Sub txtToItem_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtToItem.KeyPress
- e.KeyChar = Chr(KeyAscCode(Asc(e.KeyChar)))
- End Sub
- Private Sub cboItemSubCategoryFrom_KeyDown(sender As Object, e As KeyEventArgs) Handles cboItemSubCategoryFrom.KeyDown
- SetNextFocusManual(e, cboItemSubCategoryTo)
- End Sub
- Private Sub cboItemSubCategoryFrom_KeyPress(sender As Object, e As KeyPressEventArgs) Handles cboItemSubCategoryFrom.KeyPress
- e.KeyChar = Chr(KeyAscCode(Asc(e.KeyChar)))
- End Sub
- Private Sub cboItemSubCategoryTo_KeyDown(sender As Object, e As KeyEventArgs) Handles cboItemSubCategoryTo.KeyDown
- SetNextFocusManual(e, cboStatus)
- End Sub
- Private Sub cboItemSubCategoryTo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles cboItemSubCategoryTo.KeyPress
- e.KeyChar = Chr(KeyAscCode(Asc(e.KeyChar)))
- End Sub
- Private Sub cboStatus_KeyDown(sender As Object, e As KeyEventArgs) Handles cboStatus.KeyDown
- SetNextFocusManual(e, dtpSPNDateFrom)
- End Sub
- Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
- Me.Close()
- End Sub
- Private Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click
- If ChkValid() = True Then
- Dim strSPNDateFrom As Date = ConvertDate(dtpSPNDateFrom.Value)
- Dim strSPNDateTo As Date = ConvertDate(dtpSPNDateTo.Value)
- Dim strSPNDateFromString As String = ConvertDate(dtpSPNDateFrom.Value)
- Dim strSPNDateToString As String = ConvertDate(dtpSPNDateTo.Value)
- Dim strFromItem As String = txtFromItem.Text
- Dim strToItem As String = txtToItem.Text
- Dim strItemSubCategoryFrom As String = cboItemSubCategoryFrom.Text
- Dim strItemSubCategoryTo As String = cboItemSubCategoryTo.Text
- Dim strOrderBy As String = "Order By "
- Dim strStoredProcedureName As String = ""
- Dim rpt As New ReportDocument
- Try
- If strToItem = "" Then
- strToItem = SetMaxToValue()
- End If
- If strItemSubCategoryTo = "" Then
- strItemSubCategoryTo = SetMaxToValue()
- End If
- If rdbReportDetail.Checked = True Then
- rpt.Load(GetReportPath() & "rptStockPickingNoteDetail.rpt")
- strStoredProcedureName = "SPN_rpTransactionListing;1"
- End If
- RptPastParameter(rpt, "@fdate", strSPNDateFromString)
- RptPastParameter(rpt, "@tdate", strSPNDateToString)
- RptPastParameter(rpt, "@fitem", strFromItem)
- RptPastParameter(rpt, "@titem", strToItem)
- RptPastParameter(rpt, "@fitemsubcat", strItemSubCategoryFrom)
- RptPastParameter(rpt, "@titemsubcat", strItemSubCategoryTo)
- Dim strSQL As String = "{SPN_rpTransactionListing;1.ItemConfirmFlag} = 'Y' OR {SPN_rpTransactionListing;1.ItemConfirmFlag} = 'N' "
- rpt.DataDefinition.RecordSelectionFormula = strSQL
- If rdbSortSPN.Checked = True Then
- strOrderBy = strOrderBy & rdbSortSPN.Text
- RptPastSortFormula(rpt, "fnSortField", "{" & strStoredProcedureName & ".SPNNo}")
- ElseIf rdbSortSPNDate.Checked = True Then
- strOrderBy = strOrderBy & rdbSortSPNDate.Text
- RptPastSortFormula(rpt, "fnSortField", "{" & strStoredProcedureName & ".SPNDate}")
- Else
- strOrderBy = strOrderBy & rdbSortItemCode.Text
- RptPastSortFormula(rpt, "fnSortField", "{" & strStoredProcedureName & ".ItemNo}")
- End If
- SetRptCompany(rpt, True, False, False, False, False, False, False, False)
- RptPastFormula(rpt, "strUserName", strGlobalUserName)
- RptPastFormula(rpt, "strOrderBy", strOrderBy)
- SetReportDataSource(rpt)
- PreviewReport(rpt)
- Catch ex As Exception
- InsertSysErrorLog(Me.Name, "btnPrint_Click", ex.Message, "")
- End Try
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement