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

📄 form_outbill.frm

📁 仓库扫描管理系统
💻 FRM
📖 第 1 页 / 共 5 页
字号:
Dim m_billType As Integer

Private Sub cmdCHeck_Click()
  Dim strMsg As String
  SSTab1.Tab = 1
  strMsg = checkbarcodesRepeated(mf1)
  If strMsg <> "" Then
    MsgBox "红色显示部分条码重复!", vbCritical, "警告"
  End If
End Sub

Private Sub cmdDelete_Click()
    Dim rs As Recordset
    Set rs = DataMaster.Recordset
    If Not IsNull(rs) And rs.RecordCount > 0 And Not IsNull(rs.Fields("billId")) Then
        Dim sql As String
        If MsgBox("真的要删除吗?", vbYesNo + vbQuestion + vbDefaultButton2, "提示") = vbYes Then
            sql = " delete from hpos_StockOutBill_Dtl where billId=" + Chr(34) + rs.Fields("billId") + Chr(34)
            g_db.Execute sql
            sql = " delete from hpos_StockOutBill_Master where billId=" + Chr(34) + rs.Fields("billId") + Chr(34)
            g_db.Execute sql
            DataMaster.Refresh
            MsgBox "已经删除!", vbInformation, "提示"
'            EditData
            If SSTab1.Tab = 1 Then
                SSTab1.Tab = 0
            End If
        End If
        If Not DataMaster.Recordset.EOF Then
          cmdEdit.Enabled = True
          enableControls (True)
        Else
            clearData mf1
            clearData msfgTtl
            txttakeunit.Text = ""
            txtBillId.Text = ""
            takeunitName.Text = ""
            handler.Text = ""
            txtStockDataNo.Text = ""
            Me.txtPrevBillNo.Text = ""
          cmdEdit.Enabled = False
          enableControls (False)
        End If
    End If
End Sub

Private Sub cmdDeleteLine_Click()
'    If mf1.RowSel <> 0 Then
    For i = mf1.FixedCols To mf1.cols - mf1.FixedCols
      mf1.TextMatrix(mf1.row, i) = ""
    Next i
    text1.Text = ""
    Call fillTotalDataFromDtlData
    If mf1.row > 1 Then
        mf1.row = mf1.row - 1
    End If
'    End If
    Exit Sub
End Sub


Private Sub cmdImport_Click()
    Dim filePath As String
    filePath = ""
    
   filePath = "C:\盘点机目录\ck.txt"
   If Dir(filePath) = "" Then
     MsgBox "对不起,找不到文件【" + filePath + "】", vbInformation, "提示"
     Exit Sub
   End If
    If MsgBox("真的要导入文件" + vbCrLf + "【" + filePath + "】的数据嘛?", vbYesNo + vbQuestion + vbDefaultButton1, "提示") = vbNo Then
        Exit Sub
    End If
'   将文本文件中的数据导入到数据库中
   If importDataFromFile(filePath, "CK") = True Then
    MsgBox "恭喜,导入成功!", vbInformation, "提示"
   Else
    MsgBox "对不起,导入失败!", vbInformation, "提示"
   End If
   cmdQuery_Click
End Sub

Private Sub cmdPrevNo_Click()
        Load dlg_incomeBill2
        dlg_incomeBill2.Show vbModal, Me
''   重新设置箱号
'        If Me.txtOutNo.Text <> "" Then
'            setGridSequence Me.mf1, m_prevBillNo + 1, 0
'        End If
        fillTotalDataFromDtlData
        Me.mf1.row = mf1.rows - 1
        Me.mf1.SetFocus
End Sub

Private Sub cmdPrint_Click()
    If Me.chkSkinWeight.Value = 1 Then
        g_outputSkinWeight = True
    Else
        g_outputSkinWeight = False
    End If
    printBill
End Sub

Private Sub cmdQuery_Click()
    Dim fldName As String
    If (cmbField.Text = "客户编号") Then
      fldName = "hpos_organization.orgCode"
    End If
    If (cmbField.Text = "客户全称") Then
      fldName = "hpos_organization.fullName"
    End If
    If (cmbField.Text = "单据编号") Then
      fldName = "hpos_StockOutBill_Master.billNo"
    End If
    Dim sql As String
    sql = sqlMaster & " and ( " + fldName + " like " + Chr(34) + "*" + txtConditon.Text + "*" + Chr(34) + ")"
    sql = sql + " and (hpos_StockOutBill_Master.billDate between " + Chr(35) + CStr(DTP1.Value) + " 00:00:00" + Chr(35) + " and " + Chr(35) + CStr(DTP2.Value) + " 23:59:59" + Chr(35) + ") "
    sql = sql + sqlOrderBy
    DataMaster.RecordSource = sql
    DataMaster.Refresh
    DBGrid1.Refresh
     If Not DataMaster.Recordset.EOF Then
        cmdEdit.Enabled = True
     End If
End Sub

Private Sub cmdEdit_Click()
  EditData
End Sub

Private Sub EditData()
    enableControls (True)
    clearMasterData
      Dim billId As String
      Dim rs As Recordset
    '  isAdd = False
      Set rs = DataMaster.Recordset
      If rs.EOF And Not isAdd Then
        MsgBox "没有数据了,请先登记!", vbInformation, "提示"
'        Comdj_Click
          Exit Sub
      End If
        takeunitName.Enabled = True: handler.Enabled = True
        text1.Enabled = True: mf1.Enabled = True: Combc.Enabled = True: Comqx.Enabled = True: Comdj.Enabled = True
        billNo.Enabled = True
      cmdEdit.Enabled = True

      If Not isAdd Then
        If Not IsNull(rs.Fields("billId")) Then txtBillId.Text = rs.Fields("billId")
        If Not IsNull(rs.Fields("billNo")) Then billNo.Text = rs.Fields("billNo")
        If Not IsNull(rs.Fields("takeunit")) Then txttakeunit.Text = rs.Fields("takeunit")
        If Not IsNull(rs.Fields("fullName")) Then takeunitName.Text = rs.Fields("fullName")
        If Not IsNull(rs.Fields("billDate")) Then billDate.Text = CStr(rs.Fields("billDate"))
        If Not IsNull(rs.Fields("handler")) Then handler.Text = rs.Fields("handler")
        If Not IsNull(rs.Fields("rsvFld3")) Then Me.txtStockDataNo.Text = rs.Fields("rsvFld3")
        '    入库单号码
        If Not IsNull(rs.Fields("rsvFld1")) Then Me.txtPrevBillNo.Text = rs.Fields("rsvFld1")
        '    页码
        If Not IsNull(rs.Fields("rsvFld2")) Then Me.txtPageNo.Text = rs.Fields("rsvFld2")
      End If
      SSTab1.Tab = 1

      Dim rsDtl As Recordset
      Dim sql As String
      strSQL = "select D.*,P.productCode,P.productName,P.productModel,P.productSpecs,P.productStd,P.productUnit from hpos_StockOutBill_dtl as D left join hpos_products as P on D.productId=P.productId "
'      Set rsDtl = g_db.OpenRecordset(strSQL + " where D.billId='" + txtBillId.Text + "' order by int(MID(D.dtlId,len(D.billId)+2,len(D.dtlId)-len(D.billId)-1))")
      Set rsDtl = g_db.OpenRecordset(strSQL + " where D.billId='" + txtBillId.Text + "' order by D.billId,CINT(D.rsvFld1) ")
      Dim i As Integer
      Dim qty, amount, pieceQty, axesWeight As Double
      i = 0
     mf1.rows = mf1.FixedRows + 1
      Do While Not rsDtl.EOF
          '  序号列显示编号
        If (g_CustomerSN > 1 And Not IsNull(rsDtl.Fields("rsvFld1"))) Then
            mf1.TextMatrix(i + 1, 0) = rsDtl.Fields("rsvFld1")
        End If
        If (i + 1 >= mf1.rows - mf1.FixedRows) Then
            mf1.rows = mf1.rows + 1
'            mf1.TextMatrix(mf1.rows - mf1.FixedRows, 0) = mf1.rows - mf1.FixedRows
            If g_CustomerSN > 1 And IsNumeric(mf1.TextMatrix(mf1.rows - mf1.FixedRows - 1, 0)) Then
                mf1.TextMatrix(mf1.rows - mf1.FixedRows, 0) = CInt(mf1.TextMatrix(mf1.rows - mf1.FixedRows - 1, 0)) + 1
            End If
        End If
        If Not IsNull(rsDtl.Fields("barcode")) Then
          mf1.TextMatrix(i + 1, 1) = rsDtl.Fields("barcode")
        End If
        If Not IsNull(rsDtl.Fields("productName")) Then
          mf1.TextMatrix(i + 1, 2) = rsDtl.Fields("productName")
        End If
        If Not IsNull(rsDtl.Fields("productModel")) Then
          mf1.TextMatrix(i + 1, 3) = rsDtl.Fields("productModel")
        End If
        If Not IsNull(rsDtl.Fields("productSpecs")) Then
          mf1.TextMatrix(i + 1, 3) = mf1.TextMatrix(i + 1, 3) + " || " + rsDtl.Fields("productSpecs")
        End If
        If Not IsNull(rsDtl.Fields("productStd")) Then
          mf1.TextMatrix(i + 1, 4) = rsDtl.Fields("productStd")
        End If
        
        If Not IsNull(rsDtl.Fields("productUnit")) Then
          mf1.TextMatrix(i + 1, 5) = rsDtl.Fields("productUnit")
        End If
        If Not IsNull(rsDtl.Fields("qty")) Then
          mf1.TextMatrix(i + 1, 6) = rsDtl.Fields("qty")
          qty = qty + rsDtl.Fields("qty")
        End If
        If Not IsNull(rsDtl.Fields("price")) Then
          mf1.TextMatrix(i + 1, 7) = rsDtl.Fields("price")
        End If
        If IsNumeric(mf1.TextMatrix(i + 1, 6)) And IsNumeric(mf1.TextMatrix(i + 1, 7)) Then
            mf1.TextMatrix(i + 1, 8) = Val(mf1.TextMatrix(i + 1, 7)) * Val(mf1.TextMatrix(i + 1, 6))
            mf1.TextMatrix(i + 1, 8) = Format(mf1.TextMatrix(i + 1, 8), g_barcode_weight_scale)
            mf1.TextMatrix(i + 1, 6) = Format(mf1.TextMatrix(i + 1, 6), g_barcode_weight_scale)
            mf1.TextMatrix(i + 1, 7) = Format(mf1.TextMatrix(i + 1, 7), g_barcode_weight_scale)
        End If
        amount = amount + Val(mf1.TextMatrix(i + 1, 8))
       
        If Not IsNull(rsDtl.Fields("axesWeight")) Then
          mf1.TextMatrix(i + 1, 9) = rsDtl.Fields("axesWeight")
        End If
        If Not IsNull(rsDtl.Fields("pieceQty")) Then
          mf1.TextMatrix(i + 1, 10) = rsDtl.Fields("pieceQty")
        End If

        If IsNumeric(mf1.TextMatrix(i + 1, 9)) And IsNumeric(mf1.TextMatrix(i + 1, 10)) Then
            mf1.TextMatrix(i + 1, 11) = Val(mf1.TextMatrix(i + 1, 9)) + Val(mf1.TextMatrix(i + 1, 10)) * Val(mf1.TextMatrix(i + 1, 6))
            mf1.TextMatrix(i + 1, 11) = Format(mf1.TextMatrix(i + 1, 11), g_barcode_weight_scale)
            mf1.TextMatrix(i + 1, 9) = Format(mf1.TextMatrix(i + 1, 9), g_barcode_weight_scale)
'            mf1.TextMatrix(i + 1, 10) = Format(mf1.TextMatrix(i + 1, 10), g_barcode_weight_scale)
            axesWeight = axesWeight + Val(mf1.TextMatrix(i + 1, 11))
        End If
    
        If Not IsNull(rsDtl.Fields("comment")) Then
          mf1.TextMatrix(i + 1, 12) = rsDtl.Fields("comment")
        End If
        If Not IsNull(rsDtl.Fields("productId")) Then
          mf1.TextMatrix(i + 1, 13) = rsDtl.Fields("productId")
        End If
      rsDtl.MoveNext
      i = i + 1
    Loop
    For r = i + 1 To mf1.rows - mf1.FixedRows
        For c = mf1.FixedCols To mf1.cols - mf1.FixedCols
            mf1.TextMatrix(r, c) = ""
        Next
    Next
    '  计算累加数据
    Call fillTotalDataFromDtlData
    takeunitName.SetFocus: takeunitName.SelStart = 0: takeunitName.SelLength = Len(takeunitName.Text)
    gridCustomer.Visible = False
End Sub

Private Sub DBGrid1_DblClick()
  EditData
End Sub

Private Sub Form_Load()
'    Me.cmdImport.Visible = False
    Me.txtStockDataNo.Visible = False
    Me.Label8.Visible = False
    enableControls (False)
    SSTab1.Tab = 0
    grid1IsVisible = False
    isAdd = False
    cmbField.AddItem "客户编号", 0
    cmbField.AddItem "客户全称", 1
    cmbField.AddItem "单据编号", 2
    cmbField.Text = "单据编号"
    '自动识别数据库路径
     Data1.DatabaseName = g_dbPath
     Data2.DatabaseName = g_dbPath
     DataMaster.DatabaseName = g_dbPath
     m_billType = 0
     
     mf1.rows = 2: mf1.cols = 14     '定义mf1表的总行数、总列数
    '定义mf1表的列宽和表头信息
     s = Array("500", "1300", "1200", "1300", "1100", "450", "1000", "0", "0", "1000", "500", "1000", "1300", 0)
     y = Array("序号", "条  码  号", "物料名称", "型号||规格", " 标 准", "单位", "净重", "价格", "金额", "总皮重", "件/箱", "毛重", "工号", "productId")
     For i = 0 To mf1.cols - 1
      mf1.ColWidth(i) = s(i): mf1.TextMatrix(0, i) = y(i)
     Next i
     mf1.FixedRows = 1: mf1.FixedCols = 1     '定义mf1表的固定行数、固定列数
     '定义mf1表的列序号
     For i = mf1.FixedRows To mf1.rows - mf1.FixedRows
         mf1.TextMatrix(i, 0) = i
     Next i
     mf1.AllowUserResizing = flexResizeColumns

    '定义msfgTtl表的列宽和表头信息
     msfgTtl.rows = 2: msfgTtl.cols = 11     '定义msfgTtl表的总行数、总列数
     msfgTtl.FixedRows = 1: msfgTtl.FixedCols = 1     '定义mf1表的固定行数、固定列数
     s = Array("500", "900", "1400", "1300", "1100", "700", "1000", "0", "600", "1000", 0)
     y = Array("序号", "物料编号", "物料名称", "型号||规格", " 标 准", "单位", "总净重", "金额", "总件数", "总毛重", "productId")
     For i = 0 To msfgTtl.cols - 1
      msfgTtl.ColWidth(i) = s(i): msfgTtl.TextMatrix(0, i) = y(i)
     Next i
     msfgTtl.rows = 101
     For i = msfgTtl.FixedRows To msfgTtl.rows - msfgTtl.FixedRows
         msfgTtl.TextMatrix(i, 0) = i
     Next i
     
     
     billDate.Text = CStr(Now)     '设置出库日期
    'DTP1.Format = dtpCustom
    'DTP1.CustomFormat = "yyyy-MM-dd HH:mm:ss"  '"yyyy年MM月dd日 HH时mm分ss秒"
    'DTP1.Value = Now
     DTP2.Value = CStr(Date)
     
     Data1.RecordSource = "select * from hpos_products"
     Data2.RecordSource = "select fullName,orgId,orgCode,shortenedform from hpos_organization where orgType=0 order by fullName"
     sqlMaster = "SELECT hpos_StockOutBill_Master.*,hpos_organization.* FROM hpos_StockOutBill_Master LEFT JOIN hpos_organization ON hpos_organization.orgId = hpos_StockOutBill_Master.takeunit where billtype=" + CStr(m_billType)
     sqlOrderBy = " order by hpos_StockOutBill_Master.billNo desc "
     cmdQuery_Click
End Sub
Private Sub Form_Unload(Cancel As Integer)
  frm_main.Enabled = True
End Sub

Private Sub gridCustomer_DblClick()
  selectCustomer
End Sub

Private Sub gridCustomer_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then     '当按回车键时
   selectCustomer
End If
If KeyCode = vbKeyEscape Then     '按ESC键
  gridCustomer.Visible = False     'gridCustomer不可见
End If
End Sub
Private Sub selectCustomer()
     With Data2.Recordset
     If Data2.Recordset.RecordCount > 0 Then
      If Data2.Recordset.Fields("orgId") <> "" Then

⌨️ 快捷键说明

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