⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmporeceiveoutoftownae.frm

📁 Inventory control system
💻 FRM
📖 第 1 页 / 共 5 页
字号:
End Sub

Private Sub txtExtDiscAmt_Change()
    ComputeGrossNet
End Sub

Private Sub txtExtDiscAmt_GotFocus()
    HLText txtExtDiscAmt
End Sub

Private Sub txtExtDiscAmt_KeyPress(KeyAscii As Integer)
    KeyAscii = isNumber(KeyAscii)
End Sub

Private Sub txtExtDiscAmt_Validate(Cancel As Boolean)
    txtExtDiscAmt.Text = toMoney(toNumber(txtExtDiscAmt.Text))
End Sub

Private Sub txtExtDiscPerc_Change()
    ComputeGrossNet
End Sub

Private Sub txtExtDiscPerc_GotFocus()
    HLText txtExtDiscPerc
End Sub

Private Sub txtExtDiscPerc_KeyPress(KeyAscii As Integer)
    KeyAscii = isNumber(KeyAscii)
End Sub

Private Sub txtFreight_GotFocus()
    HLText txtFreight
End Sub

Private Sub txtFreight_KeyPress(KeyAscii As Integer)
    KeyAscii = isNumber(KeyAscii)
End Sub

Private Sub txtLocalArrastre_GotFocus()
    HLText txtLocalArrastre
End Sub

Private Sub txtLocalArrastre_KeyPress(KeyAscii As Integer)
    KeyAscii = isNumber(KeyAscii)
End Sub

Private Sub txtLocalArrastre_Validate(Cancel As Boolean)
    txtLocalArrastre.Text = toMoney(toNumber(txtLocalArrastre.Text))
End Sub

Private Sub txtLooseCargo_GotFocus()
    HLText txtLooseCargo
End Sub

Private Sub txtLooseCargo_KeyPress(KeyAscii As Integer)
    KeyAscii = isNumber(KeyAscii)
End Sub

Private Sub txtLooseCargo_Validate(Cancel As Boolean)
    txtLooseCargo.Text = toMoney(toNumber(txtLooseCargo.Text))
End Sub

Private Sub txtQty_KeyPress(KeyAscii As Integer)
    KeyAscii = isNumber(KeyAscii)
End Sub

Private Sub txtQty_LostFocus()
    Dim intQtyDue As Integer
      
    intQtyDue = getValueAt("SELECT QtyDue FROM qry_Purchase_Order_Detail WHERE POID=" & PK, "QtyDue")
    If txtQty.Text > intQtyDue Then
        MsgBox "Overdelivery for " & txtStock.Text & ".", vbInformation
        txtQty.Text = intQtyOld
    End If
End Sub

Private Sub txtQty_Validate(Cancel As Boolean)
    txtQty.Text = toNumber(txtQty.Text)
End Sub

Private Sub txtPrice_Change()
    ComputeGrossNet
End Sub

Private Sub txtPrice_Validate(Cancel As Boolean)
    txtPrice.Text = toMoney(toNumber(txtPrice.Text))
End Sub

Private Sub txtQty_Change()
    If toNumber(txtQty.Text) < 1 Then
        btnUpdate.Enabled = False
    Else
        btnUpdate.Enabled = True
    End If
    
    ComputeGrossNet
'    txtGross(1).Text = toMoney((toNumber(txtQty.Text) * toNumber(txtPrice.Text)))
'    txtNetAmount.Text = toMoney((toNumber(txtQty.Text) * toNumber(txtPrice.Text)) - ((toNumber(txtDiscPercent.Text) / 100) * toNumber(toNumber(txtQty.Text) * toNumber(txtPrice.Text))))
End Sub

Private Sub txtQty_GotFocus()
    HLText txtQty
    
    intQtyOld = txtQty.Text
End Sub

Private Sub txtPrice_KeyPress(KeyAscii As Integer)
    KeyAscii = isNumber(KeyAscii)
End Sub

'Used to edit record
Private Sub DisplayForAdding()
    On Error GoTo err
    txtSupplier.Text = rs!Company
    txtPONo.Text = rs!PONo
    
    txtGross(2).Text = toMoney(toNumber(rs![Gross]))
    txtDesc.Text = toMoney(toNumber(rs![Discount]))
    txtTaxBase.Text = toMoney(rs![TaxBase])
    txtVat.Text = toMoney(rs![Vat])
    txtNet.Text = toMoney(rs![NetAmount])
    
    cIGross = txtGross(2).Text
    cIAmount = txtNet.Text
    cDAmount = txtDesc.Text
    
    'Display the details
    Dim RSDetails As New Recordset

    RSDetails.CursorLocation = adUseClient
    RSDetails.Open "SELECT * FROM qry_Forwarders_Detail WHERE ForwarderID=" & PK & " AND QtyDue > 0 ORDER BY Stock ASC", CN, adOpenStatic, adLockOptimistic
    If RSDetails.RecordCount > 0 Then
        RSDetails.MoveFirst
        While Not RSDetails.EOF
            With Grid
                If .Rows = 2 And .TextMatrix(1, 15) = "" Then
                    .TextMatrix(1, 1) = RSDetails![Barcode]
                    .TextMatrix(1, 2) = RSDetails![Stock]
                    .TextMatrix(1, 3) = RSDetails![QtyDue]
                    .TextMatrix(1, 4) = RSDetails![unit]
                    .TextMatrix(1, 5) = 0
                    .TextMatrix(1, 6) = 0
                    .TextMatrix(1, 7) = toMoney(RSDetails![Price])
                    .TextMatrix(1, 8) = toMoney(RSDetails![Gross])
                    .TextMatrix(1, 9) = RSDetails![DiscPercent] * 100
                    .TextMatrix(1, 10) = RSDetails![ExtDiscPercent] * 100
                    .TextMatrix(1, 11) = toMoney(RSDetails![ExtDiscAmt])
                    .TextMatrix(1, 12) = toMoney(RSDetails![NetAmount])
                    .TextMatrix(1, 13) = 0
'                    .TextMatrix(1, 14) = RSDetails![CostperPackage]
                    .TextMatrix(1, 15) = RSDetails![StockID]
                Else
                    .Rows = .Rows + 1
                    .TextMatrix(.Rows - 1, 1) = RSDetails![Barcode]
                    .TextMatrix(.Rows - 1, 2) = RSDetails![Stock]
                    .TextMatrix(.Rows - 1, 3) = RSDetails![QtyDue]
                    .TextMatrix(.Rows - 1, 4) = RSDetails![unit]
                    .TextMatrix(.Rows - 1, 5) = 0
                    .TextMatrix(.Rows - 1, 6) = 0
                    .TextMatrix(.Rows - 1, 7) = toMoney(RSDetails![Price])
                    .TextMatrix(.Rows - 1, 8) = toMoney(RSDetails![Gross])
                    .TextMatrix(.Rows - 1, 9) = RSDetails![DiscPercent] * 100
                    .TextMatrix(.Rows - 1, 10) = RSDetails![ExtDiscPercent] * 100
                    .TextMatrix(.Rows - 1, 11) = toMoney(RSDetails![ExtDiscAmt])
                    .TextMatrix(.Rows - 1, 12) = toMoney(RSDetails![NetAmount])
                    .TextMatrix(.Rows - 1, 13) = 0
'                    .TextMatrix(.Rows - 1, 14) = RSDetails![CostperPackage]
                    .TextMatrix(.Rows - 1, 15) = RSDetails![StockID]
                End If
                cIRowCount = cIRowCount + 1
            End With
            RSDetails.MoveNext
        Wend
        
        Grid.Row = 1
        Grid.ColSel = 14
        'Set fixed cols
        If State = adStateEditMode Then
            Grid.FixedRows = Grid.Row: 'Grid.SelectionMode = flexSelectionFree
            Grid.FixedCols = 2
        End If
    End If

    RSDetails.Close
    'Clear variables
    Set RSDetails = Nothing
  
    dtpArrivalDate.Visible = True
'    txtDRDate.Visible = False
    lblStatus.Visible = False
    cboStatus.Visible = False
    Exit Sub
err:
    'Error if encounter a null value
    If err.Number = 94 Then
        Resume Next
    Else
        MsgBox err.Description
    End If
End Sub

'Used to edit record
Private Sub DisplayForEditing()
    On Error GoTo err
    txtSupplier.Text = rs!Company
    txtPONo.Text = rs!PONo
    PK = rs!POID 'get POID to be make a reference for QtyDue, etc.
    
    nsdShippingCo.Tag = rs![ShippingCompanyID]
    nsdShippingCo.Text = rs![ShippingCompany]
    txtShippingGuideNo.Text = rs![ShippingGuideNo]
    txtShip.Text = rs![Ship]
    cboClass.ListIndex = rs![Class]
    nsdLocal.Tag = rs![LocalForwarderID]
    nsdLocal.Text = rs![LocalForwarder]
    txtArrivalDate.Text = rs![ArrivalDate]
    txtDRNo.Text = rs![DRNo]
    txtBLNo.Text = rs![BLNo]
    txtTruckNo.Text = rs![TruckNo]
    txtVanNo.Text = rs![VanNo]
    txtVoyageNo.Text = rs![VoyageNo]
    cboStatus.Text = rs!Status_Alias

    txtGross(2).Text = toMoney(toNumber(rs![Gross]))
    txtDesc.Text = toMoney(toNumber(rs![Discount]))
    txtTaxBase.Text = toMoney(rs![TaxBase])
    txtVat.Text = toMoney(rs![Vat])
    txtNet.Text = toMoney(rs![NetAmount])
    
    cIGross = txtGross(2).Text
    cIAmount = txtNet.Text
    cDAmount = txtDesc.Text
    cIRowCount = 0
    
    'Connection for Transportation_Cost
    Dim RSTranspo As New Recordset

    RSTranspo.CursorLocation = adUseClient
    RSTranspo.Open "SELECT * FROM Transportation_Cost WHERE ForwarderID=" & ForwarderPK, CN, adOpenStatic, adLockOptimistic
   
    With RSTranspo
        rs.Filter = "ForwarderID=" & ForwarderPK

        dtp(1).Value = ![MlaTruckingDate]
        txtOR(1).Text = ![MlaTruckingOR]
        txtAmount(1).Text = toMoney(![MlaTruckingAmount])
        
        dtp(2).Value = ![MlaArrastreDate]
        txtOR(2).Text = ![MlaArrastreOR]
        txtAmount(2).Text = toMoney(![MlaArrastreAmount])
        
        dtp(3).Value = ![MlaWfgFeeDate]
        txtOR(3).Text = ![MlaWfgFeeOR]
        txtAmount(3).Text = toMoney(![MlaWfgFeeAmount])
        
        dtp(4).Value = ![FreightDate]
        txtOR(4).Text = ![FreightOR]
        txtAmount(4).Text = toMoney(![FreightAmount])
        
        dtp(5).Value = ![LocalArrastreDate]
        txtOR(5).Text = ![LocalArrastreOR]
        txtAmount(5).Text = toMoney(![LocalArrastreAmount])
        
        dtp(6).Value = ![LocalTruckingDate]
        txtOR(6).Text = ![LocalTruckingOR]
        txtAmount(6).Text = toMoney(![LocalTruckingAmount])
        
        dtp(7).Value = ![SidewalkHandlingDate]
        txtOR(7).Text = ![SidewalkHandlingOR]
        txtAmount(7).Text = toMoney(![SidewalkHandlingAmount])
                
    End With
    
    'Display the details
    Dim RSDetails As New Recordset

    RSDetails.CursorLocation = adUseClient
    RSDetails.Open "SELECT * FROM qry_Forwarders_Detail WHERE ForwarderID=" & ForwarderPK & " ORDER BY Stock ASC", CN, adOpenStatic, adLockOptimistic
    If RSDetails.RecordCount > 0 Then
        RSDetails.MoveFirst
        While Not RSDetails.EOF
            cIRowCount = cIRowCount + 1     'increment
            With Grid
                If .Rows = 2 And .TextMatrix(1, 15) = "" Then
                    .TextMatrix(1, 1) = RSDetails![Barcode]
                    .TextMatrix(1, 2) = RSDetails![Stock]
                    .TextMatrix(1, 3) = RSDetails![QtyDue]
                    .TextMatrix(1, 4) = RSDetails![unit]
                    .TextMatrix(1, 5) = RSDetails![LooseCargo]
                    .TextMatrix(1, 6) = RSDetails![LocalArrastre]
                    .TextMatrix(1, 7) = toMoney(RSDetails![Price])
                    .TextMatrix(1, 8) = toMoney(RSDetails![Gross])
                    .TextMatrix(1, 9) = RSDetails![DiscPercent] * 100
                    .TextMatrix(1, 10) = RSDetails![ExtDiscPercent] * 100
                    .TextMatrix(1, 11) = toMoney(RSDetails![ExtDiscAmt])
                    .TextMatrix(1, 12) = toMoney(RSDetails![NetAmount])
                    .TextMatrix(1, 13) = RSDetails![FreightPercent]
                    .TextMatrix(1, 14) = RSDetails![CostPerPackage]
                    .TextMatrix(1, 15) = RSDetails![StockID]
                Else
                    .Rows = .Rows + 1
                    .TextMatrix(.Rows - 1, 1) = RSDetails![Barcode]
                    .TextMatrix(.Rows - 1, 2) = RSDetails![Stock]
                    .TextMatrix(.Rows - 1, 3) = RSDetails![QtyDue]
                    .TextMatrix(.Rows - 1, 4) = RSDetails![unit]
                    .TextMatrix(.Rows - 1, 5) = RSDetails![LooseCargo]
                    .TextMatrix(.Rows - 1, 6) = RSDetails![LocalArrastre]
                    .TextMatrix(.Rows - 1, 7) = toMoney(RSDetails![Price])
                    .TextMatrix(.Rows - 1, 8) = toMoney(RSDetails![Gross])
                    .TextMatrix(.Rows - 1, 9) = RSDetails![DiscPercent] * 100
                    .TextMatrix(.Rows - 1, 10) = RSDetails![ExtDiscPercent] * 100
                    .TextMatrix(.Rows - 1, 11) = toMoney(RSDetails![ExtDiscAmt])
                    .TextMatrix(.Rows - 1, 12) = toMoney(RSDetails![NetAmount])
                    .TextMatrix(.Rows - 1, 13) = RSDetails![FreightPercent]
                    .TextMatrix(.Rows - 1, 14) = RSDetails![CostPerPackage]
                    .TextMatrix(.Rows - 1, 15) = RSDetails![StockID]
                End If
            End With
            RSDetails.MoveNext
        Wend
        Grid.Row = 1
        Grid.ColSel = 14
        'Set fixed cols
        If State = adStateEditMode Then
            Grid.FixedRows = Grid.Row: 'Grid.SelectionMode = flexSelectionFree
            Grid.FixedCols = 2
        End If
    End If

    RSDetails.Close
    'Clear variables
    Set RSDetails = Nothing
  
    Exit Sub
err:
    'Error if encounter a null value
    If err.Number = 94 Then
        Resume Next
    Else
        MsgBox err.Description
    End If
End Sub

'Used to display record
Private Sub DisplayForViewing()
    On Error GoTo err
    txtSupplier.Text = rs!Company
    txtPONo.Text = rs!PONo
    PK = rs!POID 'get POID to be make a reference for QtyDue, etc.
    
    nsdShippingCo.Tag = rs![ShippingCompanyID]
    nsdShippingCo.Text = rs![ShippingCompany]
    txtShippingGuideNo.Text = rs![ShippingGuideNo]
    txtShip.Text = rs![Ship]
    cboClass.ListIndex = rs![Class]
    nsdLocal.Tag = rs![LocalForwarderID]
    nsdLocal.Text = rs![LocalForwarder]
    txtArrivalDate.Text = rs![ArrivalDate]
    txtDRNo.Text = rs![DRNo]
    txtBLNo.Text = rs![BLNo]
    txtTruckNo.Text = rs![TruckNo]
    txtVanNo.Text = rs![VanNo]
    txtVoyageNo.Text = rs![VoyageNo]
    cboStatus.Text = rs!Status_Alias

    txtGross(2).Text = toMoney(toNumber(rs![Gross]))
    txtDesc.Text = toMoney(toNumber(rs![Discount]))
    txtTaxBase.Text = toMoney(rs![TaxBase])
    txtVat.Text = toMoney(rs![Vat])
    txtNet.Text = toMoney(rs![NetAmount])
    
    cIGross = txtGross(2).Text
    cIAmount = txtNet.Text
    cDAmount = txtDesc.Text
    cIRowCount = 0
    
    'Connection for Transportation_Cost
    Dim RSTranspo As New Recordset

    RSTranspo.CursorLocation = adUseClient
    RSTranspo.Open "SELECT * FROM Transportation_Cost WHERE ForwarderID=" & ForwarderPK, CN, adOpenStatic, adLockOptimistic
   
    With RSTranspo
        rs.Filter = "ForwarderID=" & ForwarderPK

        dtp(1).Value = ![MlaTruckingDate]
        txtOR(1).Text = ![MlaTruckingOR]
        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -