📄 main.vbs
字号:
'USEUNIT Dialogs
'USEUNIT Menus
'USEUNIT Buttons
'USEUNIT ExtCtrls
'USEUNIT About
'USEUNIT Pickinvc
'USEUNIT Invcrpt
'USEUNIT Orderrpt
'USEUNIT Pickrep
'USEUNIT Custrpt
'USEUNIT Brparts
'USEUNIT Qrycust
'USEUNIT Brcstord
'USEUNIT Edorders
'USEUNIT Datamod
dim HELP_QUIT
HELP_QUIT = 2
dim HELP_CONTENTS
HELP_CONTENTS = 3
'-------------------------------------------------------------------
sub BrowseCustOrd(Sender)
BrCustOrdForm.Show
End Sub
'-------------------------------------------------------------------
sub CloseApp(Sender)
Close
End Sub
'-------------------------------------------------------------------
sub FormCreate(Sender)
ClientWidth = CloseBtn.Left + CloseBtn.Width + 1
ClientHeight = CloseBtn.Top + CloseBtn.Height
MainPanel.Align = alClient
MainForm.Left = 0
MainForm.Top = 0
End Sub
'-------------------------------------------------------------------
sub BrowseParts(Sender)
BrPartsForm.Show
End Sub
'-------------------------------------------------------------------
sub ToggleStayonTop(Sender)
Sender.Checked = not Sender.Checked
if Sender.Checked then
FormStyle = fsStayOnTop
else
FormStyle = fsNormal
End If
End Sub
'-------------------------------------------------------------------
sub NewOrder(Sender)
call Edorders.Enter()
End Sub
'-------------------------------------------------------------------
sub HelpBtnClick(Sender)
call Application.HelpCommand(HELP_CONTENTS, 0)
End Sub
'-------------------------------------------------------------------
sub PrinterSetupClick(Sender)
PrinterSetup.Execute
End Sub
'-------------------------------------------------------------------
sub AboutClick(Sender)
AboutBox.ShowModal
End Sub
'-------------------------------------------------------------------
sub FormDestroy(Sender)
call Application.HelpCommand(HELP_QUIT,0)
End Sub
'-------------------------------------------------------------------
sub ReportBtnClick(Sender)
if PickRpt.ShowModal = mrOK then
select case PickRpt.ReportType.ItemIndex
case 0: call PrintCustomerReport(GetPreview())
case 1: call PrintOrderReport( GetPreview())
case 2: call PrintInvoiceReport( GetPreview() )
End Select
End If
End Sub
'-------------------------------------------------------------------
sub PrintCustomerReport(Preview)
MastData.CustByLastInvQuery.Open
if Preview then
FormCusRep.CustomerByInvoiceReport.Preview
else
FormCusRep.CustomerByInvoiceReport.Print
End If
MastData.CustByLastInvQuery.Close
End Sub
'-------------------------------------------------------------------
sub PrintOrderReport(Preview)
QueryCustDlg.MsgLab.Caption = "Print all orders ranging:"
if Qrycust.GetFromDate() = 0 then Qrycust.SetFromDate(EncodeDate(95, 01, 01))
if Qrycust.GetToDate() = 0 then Qrycust.SetToDate(Now)
if QueryCustDlg.ShowModal = mrOk then
MastData.OrdersByDateQuery.Close
MastData.OrdersByDateQuery.Params.ParamByName("FromDate").AsDateTime = Qrycust.GetFromDate()
MastData.OrdersByDateQuery.Params.ParamByName("ToDate").AsDateTime = Qrycust.GetToDate()
MastData.OrdersByDateQuery.Open
FormOrderRep.OrdersByDateReport.ReportTitle = "From " + DateToStr(Qrycust.GetFromDate()) +" To " + DateToStr(Qrycust.GetToDate())
if Preview then
FormOrderRep.OrdersByDateReport.Preview
else
FormOrderRep.OrdersByDateReport.Print
End If
MastData.OrdersByDateQuery.Close
End If
End Sub
'-------------------------------------------------------------------
sub PrintInvoiceReport(Preview)
if PickOrderNoDlg.ShowModal = mrOk then
if Preview then
FormInvRep.InvoiceByOrderNoReport.Preview
else
FormInvRep.InvoiceByOrderNoReport.Print
End If
End IF
End Sub
'-------------------------------------------------------------------
sub OrderReport(Sender)
PrintOrderReport(false)
End Sub
'-------------------------------------------------------------------
sub CustomerReport(Sender)
PrintCustomerReport(false)
End Sub
'-------------------------------------------------------------------
sub InvoiceReport(Sender)
PrintInvoiceReport(false)
End Sub
'-------------------------------------------------------------------
sub FormShow(Sender)
Datamod.Database().TransIsolation = tiDirtyRead
ShortDateFormat = "dd/mm/yy"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -