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

📄 frmforwardersguideae.frm

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

Private Sub mnu_ReceiveItems_Click()
    Dim RSDetails As New Recordset
    
    RSDetails.CursorLocation = adUseClient
    RSDetails.Open "SELECT * FROM qry_Forwarders_Detail WHERE ForwarderID=" & ForwarderPK & " AND QtyDue > 0 ORDER BY Stock ASC", CN, adOpenStatic, adLockOptimistic
    
    If RSDetails.RecordCount > 0 Then
        With frmForwardersReceiveAE
            .State = adStateAddMode
            .PK = ForwarderPK
            .show vbModal
        End With
    Else
        MsgBox "All items are already forwarded.", vbInformation
    End If
End Sub

Private Sub mnu_Vat_Click()
    If mnu_Vat.Caption = "Show VAT && Taxbase" Then
        Label5.Visible = True
        Label8.Visible = True
        txtTaxBase.Visible = True
        txtVat.Visible = True
        mnu_Vat.Caption = "Hide VAT && Taxbase"
    Else
        Label5.Visible = False
        Label8.Visible = False
        txtTaxBase.Visible = False
        txtVat.Visible = False
        mnu_Vat.Caption = "Show VAT && Taxbase"
    End If
End Sub


Private Sub txtDesc_GotFocus()
    HLText txtDesc
End Sub

Private Sub txtDiscPercent_Change()
    ComputeGrossNet
End Sub

Private Sub txtDiscPercent_GotFocus()
    HLText txtDiscPercent
End Sub

Private Sub txtDiscPercent_KeyPress(KeyAscii As Integer)
    KeyAscii = isNumber(KeyAscii)
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 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 + intQtyOld) 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.Tag = RS!VendorID
    txtSupplier.Text = RS!Company
    txtPONo.Text = RS!PONo
    cboFreightAgreement.Text = RS!FreightAgreement
    cboFreightPeriod.Text = RS!FreightPeriod
    
    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_Purchase_Order_Detail WHERE POID=" & PK & " AND QtyDue > 0 ORDER BY Stock ASC", CN, adOpenDynamic, adLockOptimistic
    If RSDetails.RecordCount > 0 Then
        RSDetails.MoveFirst
        While Not RSDetails.EOF
            With Grid
                If .Rows = 2 And .TextMatrix(1, 11) = "" Then
                    .TextMatrix(1, 1) = RSDetails![Barcode]
                    .TextMatrix(1, 2) = RSDetails![Stock]
                    .TextMatrix(1, 3) = RSDetails![QtyDue]
                    .TextMatrix(1, 4) = RSDetails![Unit]
                    .TextMatrix(1, 5) = toMoney(RSDetails![Price])
                    .TextMatrix(1, 6) = toMoney(RSDetails![Gross])
                    .TextMatrix(1, 7) = RSDetails![DiscPercent] * 100
                    .TextMatrix(1, 8) = RSDetails![ExtDiscPercent] * 100
                    .TextMatrix(1, 9) = toMoney(RSDetails![ExtDiscAmt])
                    .TextMatrix(1, 10) = toMoney(RSDetails![NetAmount])
                    .TextMatrix(1, 11) = RSDetails![StockID]

                    'add qty received in Purchase Order Details
                    RSDetails!QtyReceived = toNumber(RSDetails!QtyReceived) + toNumber(RSDetails![QtyDue])

                    RSDetails.Update
                    '-----------------
                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) = toMoney(RSDetails![Price])
                    .TextMatrix(.Rows - 1, 6) = toMoney(RSDetails![Gross])
                    .TextMatrix(.Rows - 1, 7) = RSDetails![DiscPercent] * 100
                    .TextMatrix(.Rows - 1, 8) = RSDetails![ExtDiscPercent] * 100
                    .TextMatrix(.Rows - 1, 9) = toMoney(RSDetails![ExtDiscAmt])
                    .TextMatrix(.Rows - 1, 10) = toMoney(RSDetails![NetAmount])
                    .TextMatrix(.Rows - 1, 11) = RSDetails![StockID]

                    'add qty received in Purchase Order Details
                    RSDetails!QtyReceived = toNumber(RSDetails!QtyReceived) + toNumber(RSDetails![QtyDue])

                    RSDetails.Update
                    '-----------------
                End If
                cIRowCount = cIRowCount + 1
            End With
            RSDetails.MoveNext
        Wend

        Grid.Row = 1
        Grid.ColSel = 10
        '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
  
    dtpDeliveryDate.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.Number & " " & err.Description
    End If
End Sub

'Used to edit record
Private Sub DisplayForEditing()
    On Error GoTo err
    txtSupplier.Tag = RS!VendorID
    txtSupplier.Text = RS!Company
    txtPONo.Text = RS!PONo
    PK = RS!POID 'get POID to make a reference for QtyDue, etc.
    cboFreightAgreement.Text = RS!FreightAgreement
    cboFreightPeriod.Text = RS!FreightPeriod
    
    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]
    dtpDeliveryDate.Value = RS![DeliveryDate]
    dtpReceiptDate.Value = RS![ReceiptDate]
    cboRef.Text = RS![Ref]
    txtRefNo.Text = RS![RefNo]
'    txtTruckNo.Text = rs![TruckNo]
'    txtVanNo.Text = rs![VanNo]
'    txtVoyageNo.Text = rs![VoyageNo]
    txtPickupLocation.Text = RS![PickupLocation]
    dtpPickupDate.Value = RS![PickupDate]
    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])
    
'    txtFreight.Text = toMoney(RS![Freight])
'    txtArrastre.Text = toMoney(RS![Arrastre])
    
    cIGross = txtGross(2).Text
    cIAmount = txtNet.Text
    cDAmount = txtDesc.Text
    cIRowCount = 0
    
    '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, 11) = "" Then
                    .TextMatrix(1, 1) = RSDetails![Barcode]
                    .TextMatrix(1, 2) = RSDetails![Stock]
                    .TextMatrix(1, 3) = RSDetails![Qty]
                    .TextMatrix(1, 4) = RSDetails![Unit]
                    .TextMatrix(1, 5) = toMoney(RSDetails![Price])
                    .TextMatrix(1, 6) = toMoney(RSDetails![Gross])
                    .TextMatrix(1, 7) = RSDetails![DiscPercent] * 100
                    .TextMatrix(1, 8) = RSDetails![ExtDiscPercent] * 100
                    .TextMatrix(1, 9) = toMoney(RSDetails![ExtDiscAmt])
                    .TextMatrix(1, 10) = toMoney(RSDetails![NetAmount])
                    .TextMatrix(1, 11) = RSDetails![StockID]
                Else
                    .Rows = .Rows + 1
                    .TextMatrix(.Rows - 1, 1) = RSDetails![Barcode]
                    .TextMatrix(.Rows - 1, 2) = RSDetails![Stock]
                    .TextMatrix(.Rows - 1, 3) = RSDetails![Qty]
                    .TextMatrix(.Rows - 1, 4) = RSDetails![Unit]
                    .TextMatrix(.Rows - 1, 5) = toMoney(RSDetails![Price])
                    .TextMatrix(.Rows - 1, 6) = toMoney(RSDetails![Gross])
                    .TextMatrix(.Rows - 1, 7) = RSDetails![DiscPercent] * 100
                    .TextMatrix(.Rows - 1, 8) = RSDetails![ExtDiscPercent] * 100
                    .TextMatrix(.Rows - 1, 9) = toMoney(RSDetails![ExtDiscAmt])
                    .TextMatrix(.Rows - 1, 10) = toMoney(RSDetails![NetAmount])
                    .TextMatrix(.Rows - 1, 11) = RSDetails![StockID]
                End If
            End With
            RSDetails.MoveNext
        Wend
        Grid.Row = 1
        Grid.ColSel = 10
        '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.Tag = RS!VendorID
    txtSupplier.Text = RS!Company
    txtPONo.Text = RS!PONo
    PK = RS!POID 'get POID to make a reference for QtyDue, etc.
    cboFreightAgreement.Text = RS!FreightAgreement
    cboFreightPeriod.Text = RS!FreightPeriod
    
    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]
    txtDeliveryDate.Text = RS![DeliveryDate]
    txtReceiptDate.Text = RS![ReceiptDate]
    cboRef.Text = RS![Ref]
    txtRefNo.Text = RS![RefNo]
'    txtTruckNo.Text = rs![TruckNo]
'    txtVanNo.Text = rs![VanNo]
'    txtVoyageNo.Text = rs![VoyageNo]
    txtPickupLocation.Text = RS![PickupLocation]
    txtPickupDate.Text = RS![PickupDate]
    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])
    
'    txtFreight.Text = toMoney(RS![Freight])
'    txtArrastre.Text = toMoney(RS![Arrastre])
    
    cIGross = txtGross(2).Text
    cIAmount = txtNet.Text
    cDAmount = txtDesc.Text
    cIRowCount = 0
        
    'Display the details
    Dim RSDetails As

⌨️ 快捷键说明

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