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

📄 frmbookmaster.frm

📁 This a complete inventory management system that performs the functions of Purchases, Sales and paym
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Style           =   3
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "&Edit"
            Key             =   "Edit"
            Object.ToolTipText     =   "Edit"
            ImageIndex      =   3
         EndProperty
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "&Close"
            Key             =   "tbrClose"
            Object.ToolTipText     =   "Exit"
            ImageIndex      =   5
         EndProperty
         BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   0
      Top             =   0
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   22
      ImageHeight     =   22
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   5
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBookMaster.frx":001C
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBookMaster.frx":0365
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBookMaster.frx":082A
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBookMaster.frx":0D1C
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmBookMaster.frx":1179
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.Image Image1 
      BorderStyle     =   1  'Fixed Single
      Height          =   3315
      Left            =   6600
      Stretch         =   -1  'True
      Top             =   840
      Width           =   4260
   End
End
Attribute VB_Name = "frmBookMaster"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim fs As FileSystemObject
Dim strImg
Dim gBookId
Dim gMod
Private Sub cmdBrowse_Click()
CommonDialog1.Filter = "All Images|*.Bmp;*.gif;*.jpg|Bitmaps|*.BMP|Gif Images|*.Gif|Jpeg Images|*.jpg"
CommonDialog1.ShowOpen
If Not Trim(CommonDialog1.FileName) = "" Then
strImg = CommonDialog1.FileName
Image1.Picture = LoadPicture(strImg)
End If
End Sub

Private Sub cmdClear_Click()
Set Image1 = Nothing
strImg = ""
End Sub

Private Function fn_Edit()
On Error Resume Next
Dim gQuery
gMod = 1
gBookId = ""
popBook.txtBookID = ""
popBook.Show vbModal
gBookId = popBook.txtBookID
Unload popBook
If Trim(gBookId) = "" Then
    Unload Me
    frmBookMaster.Show
Else
Dim rstEdit As ADODB.Recordset
Set rstEdit = New ADODB.Recordset
gQuery = "select * from aBookMaster where b_Id='" & Trim(gBookId) & "'"
rstEdit.Open gQuery, CNimanager, 3, 1
    If Not rstEdit.EOF Or Not rstEdit.BOF Then
        txtNo = rstEdit("b_no")
        txtBID = rstEdit("b_Id")
        txtBName = rstEdit("b_Name")
        txtGag = rstEdit("b_gag")
        txtUnit = rstEdit("b_unit")
        txtBCat = rstEdit("b_CatId")
        txtBMft = rstEdit("b_MftId")
        txtBDesc = rstEdit("b_Desc")
        txtBStock = Null2Blank(rstEdit("b_OpeningQty"))
        txtBSRetail = Trim(Replace(FormatNumber(rstEdit("b_SellingPrice"), 2), ",", ""))
        If Not rstEdit("b_ImageName") = "" Then
        Dim imgPath
        imgPath = App.Path & "/Images/Books/" & rstEdit("b_ImageName")
        If Not fs.FileExists(imgPath) Then
            imgPath = App.Path & "/Images/Books/notfound.gif"
        End If
        Image1.Picture = LoadPicture(imgPath)
        strImg = App.Path & "/Images/Books/" & rstEdit("b_ImageName")
        Else
        Set Image1 = Nothing
        strImg = ""
        End If
    End If
End If
End Function

Private Function fn_Exit()
Unload Me
End Function

Private Function fn_new()
Unload Me
frmBookMaster.Show
End Function

Private Function fn_Save()
Dim gQuery
Dim gQuery1
Dim strSource, strDest, strImageName
        '***********Validations**************************************************************
                    If Trim(txtBName) = "" Then
                        MsgBox "Book Name can not be left blank", vbCritical, "iManager"
                        txtBName.SetFocus
                        Exit Function
                    End If
                   
        '*************************************************************************************
        '*********Image Copy Script **********************************************************
        If Not Trim(strImg) = "" Then
        strDest = App.Path & "/Images"
        If Not fs.FolderExists(strDest) Then
            fs.CreateFolder (strDest)
        End If
        strDest = strDest & "/Books"
        If Not fs.FolderExists(strDest) Then
            fs.CreateFolder (strDest)
        End If
            strDest = strDest & "/" & Trim(txtBID) & Trim(Right(strImg, 4))
            strSource = strImg
            strImageName = Trim(txtBID) & Trim(Right(strImg, 4))
            If fs.FileExists(strDest) Then
                SetAttr strDest, vbNormal
            End If
            fs.CopyFile strSource, strDest, True
        End If
        '******************************************************************************
    If gMod = 0 Then
        gQuery = "insert into aBookMaster(b_ID, b_No, b_Name,b_gag,b_unit, b_Desc, b_MftId, b_SellingPrice , b_ImageName)" & _
        " values('" & txtBID & "'," & txtNo & ",'" & fnEscapeQuote(Trim(txtBName)) & "','" & fnEscapeQuote(Trim(txtGag)) & "','" & fnEscapeQuote(Trim(txtUnit)) & "','" & fnEscapeQuote(Trim(txtBDesc)) & "','',0.00,'" & fnEscapeQuote(Trim(strImageName)) & "')"
        gQuery1 = "Update aCompanySetup set a_LastBook=a_LastBook+1 where a_Sno=1"
            CNimanager.Execute (gQuery)
            CNimanager.Execute (gQuery1)
            MsgBox "Book added", vbInformation, "iManager"
            Unload Me
            frmBookMaster.Show
    ElseIf gMod = 1 Then
            gQuery = "Update aBookMaster set b_Name='" & fnEscapeQuote(Trim(txtBName)) & "',b_gag='" & fnEscapeQuote(Trim(txtGag)) & "',b_unit='" & fnEscapeQuote(Trim(txtUnit)) & "', b_Desc='" & fnEscapeQuote(Trim(txtBDesc)) & "', b_ImageName='" & fnEscapeQuote(Trim(strImageName)) & "' where b_No=" & Trim(txtNo)
            'MsgBox gQuery
            CNimanager.Execute (gQuery)
            MsgBox "Book edited", vbInformation, "iManager"
            Unload Me
            frmBookMaster.Show
    End If
End Function

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
    Case 27
    If MsgBox("Do you want to exit this form?", vbQuestion + vbYesNo, "iManager") = vbYes Then
        Unload Me
    End If
    Case 13
        SendKeys "{Tab}"
        SendKeys "{Home}+{End}"
End Select
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
'        Select Case KeyAscii
'            Case 5
'                fn_Edit
'            Case 14
'                fn_New
'            Case 19
'                fn_Save
'            Case 24
'                fn_Exit
'        End Select
End Sub

Private Sub Form_Load()
txtBSRetail = Trim(Replace(FormatNumber(0, 2), ",", ""))
txtBStock = 0
strImg = ""
Dim rstNew As ADODB.Recordset
Dim gQuery
Dim gNewID
gMod = 0

Set fs = New FileSystemObject
    Set rstNew = New ADODB.Recordset
            rstNew.Open "select a_LastBook from aCompanySetup where a_sno=1", CNimanager
            gNewID = Trim(rstNew("a_LastBook")) + 1
            txtNo = gNewID
        For i = 1 To 5 - Len(gNewID)
            gNewID = "0" & gNewID
        Next
        gNewID = "P" & gNewID
        txtBID = gNewID




Me.Top = 0
Me.Left = 0
Me.Height = 7500
Me.Width = 11640

End Sub


Private Sub Text1_Change()

End Sub

Private Sub Tlb_Kit_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
    Case 1
        Call fn_new
    Case 3
        Call fn_Save
    Case 5
        Call fn_Edit
    Case 7
        Call fn_Exit
End Select
End Sub

Private Sub txtBCat_Click()
txtBCatName.ListIndex = txtBCat.ListIndex
End Sub

Private Sub txtBCatName_Click()
 txtBCat.ListIndex = txtBCatName.ListIndex
End Sub

Private Sub txtBMft_Click()
txtBMftName.ListIndex = txtBMft.ListIndex
End Sub

Private Sub txtBMftName_Click()
txtBMft.ListIndex = txtBMftName.ListIndex
End Sub

Private Sub txtBName_Lostfocus()
    txtBName = StrConv(Trim(txtBName), vbProperCase)
End Sub

Private Sub txtBSRetail_LostFocus()
If Not Trim(txtBSRetail) = "" Then
    If IsNumeric(txtBSRetail) = False Then
        MsgBox "Only numeric values are allowed.", vbCritical, "iManager"
        txtBSRetail.SetFocus
    Else
        txtBSRetail = Trim(Replace(FormatNumber(txtBSRetail, 2), ",", ""))
    End If
Else
txtBSRetail = Trim(Replace(FormatNumber(0, 2), ",", ""))
End If
End Sub

Private Sub txtBStock_LostFocus()
If Trim(txtBStock) = "" Then
    txtBStock = 0
End If
End Sub

⌨️ 快捷键说明

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