Click here to Skip to main content
15,895,011 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: DEVELOPING A HOTEL RESERVATION SYSTEM Pin
Colin Angus Mackay6-Jul-09 2:02
Colin Angus Mackay6-Jul-09 2:02 
GeneralRe: DEVELOPING A HOTEL RESERVATION SYSTEM Pin
Eddy Vluggen6-Jul-09 3:13
professionalEddy Vluggen6-Jul-09 3:13 
AnswerRe: DEVELOPING A HOTEL RESERVATION SYSTEM Pin
Colin Angus Mackay6-Jul-09 2:05
Colin Angus Mackay6-Jul-09 2:05 
GeneralRe: DEVELOPING A HOTEL RESERVATION SYSTEM Pin
kimbowa sande30-Jul-09 4:39
kimbowa sande30-Jul-09 4:39 
GeneralRe: DEVELOPING A HOTEL RESERVATION SYSTEM Pin
Colin Angus Mackay30-Jul-09 10:02
Colin Angus Mackay30-Jul-09 10:02 
Questionhow to add sql statement in databinding?, vb 2005 Pin
wongth75-Jul-09 20:23
wongth75-Jul-09 20:23 
Questionproblem with delete button ..vb 2005 Pin
wongth75-Jul-09 20:17
wongth75-Jul-09 20:17 
QuestionPrint Out Problem in Billing system??? Pin
JC.KaNNaN5-Jul-09 19:32
JC.KaNNaN5-Jul-09 19:32 
hi,

i have created simple billing software in vb.net with ms access.
Now i want to print all purchase, sales details or something..
but when we are going to print before see the print preview.
its all showing whatever in Query.
When i took print,nothing printing from db. but print other than DB.

i have attached sample code for mine.Plz Help me Urgent.



Private Sub Print_JOB_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
TOT = 0
INCR = 0
Sno = 1
PAGE_LIMIT = PER_PAGE
myConnection = New OleDbConnection(constr)
MyCommand.Connection = myConnection
'MyCommand.CommandText = "SELECT JOB_NAME,JOB_AMT FROM JOBCARD WHERE JOBNO=" + G_JOBNO + ""
MyCommand.CommandText = "SELECT JOB_NAME,JOB_AMT FROM JOBCARD WHERE JOBNO=128"
MyCommand.CommandType = CommandType.Text
ada.SelectCommand = MyCommand
ada.Fill(ds, "SALES_JOBMASTER")
dt = ds.Tables(2)
Data_Adapter()

' ROW_COUNT = ds.Tables(2).Rows.Count
ROW_COUNT = 3

'Me.Close()

'ROW_COUNT = 3

dlgPrintPreview.Document = PreparePrintDocument()
dlgPrintPreview.WindowState = FormWindowState.Maximized
dlgPrintPreview.ShowDialog()
Catch ex As Exception
WAR(ex.ToString)
End Try
End Sub

Private Function PreparePrintDocument() As PrintDocument
Dim print_document As New PrintDocument
AddHandler print_document.PrintPage, AddressOf Spare_Print_PrintPage
Return print_document
End Function

Private Sub Spare_Print_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles Spare_Print.PrintPage
Try
g = e.Graphics
DB()

g.DrawString(COMNAME, CNAME, brush, New Point(300, 25))
g.DrawString(DEALER, DNAME, brush, New Point(350, 50))
g.DrawString(ADD1 + " " + ADD2 + " " + CITY, FNT, brush, New Point(100, 70))
g.DrawString("Phone : " + PHONE + " " + "Mobile : " + MOBILE, FNT, brush, New Point(100, 90))
g.DrawString("TIN: " + TIN + " " + "Dt: " + TINDATE + " " + "Area Code: " + TINAREA, FNT, brush, New Point(100, 110))
'g.DrawLine(mypen, 20, 140, 820, 140) ';//Draw Horizondal Line
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 135))
g.DrawString("*** JOB INVOICE ***", FNT, brush, New Point(300, 155))
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 170))
'g.DrawLine(mypen, 20, 175, 820, 175) ';//Draw Horizondal Line

g.DrawString("To, ", FNT, brush, New Point(30, 180)) ';// Get company Address
g.DrawString("Mr." + CustName, FNT, brush, New Point(80, 200)) ';// Get company Address
Dim t As Double = 220
g.DrawString(Address1 + " " + CustCity, FNT, brush, New Point(100, t)) ';// Get company Address
t = t + 70
g.DrawString("Phone : ", FNT, brush, New Point(50, t)) ';// Get company Address
g.DrawString(CustPhone, FNT, brush, New Point(145, t)) ';// Get company Address
g.DrawString("Mobile : ", FNT, brush, New Point(370, t)) ';// Get company Address
g.DrawString(CustMobile, FNT, brush, New Point(440, t))

g.DrawString("Invoice No : ", FNT, brush, New Point(550, 200)) ';//Get company Code.no
g.DrawString(G_BNO, FNT, brush, New Point(650, 200))
g.DrawString("Date : ", FNT, brush, New Point(550, 230))
g.DrawString(G_DATE, FNT, brush, New Point(650, 230))
g.DrawString("Last KM Reading : ", FNT, brush, New Point(550, 260))
g.DrawString(KM, FNT, brush, New Point(720, 260))

'g.DrawLine(mypen, 20, 315, 820, 315) ';//Horizondal line
g.DrawString("Vehicle No : " + VechNo, FNT, brush, New Point(50, 320)) ';// Get company Address
g.DrawString("Make : " + Make, FNT, brush, New Point(370, 320)) ';// Get company Address
g.DrawString("Model : " + Model, FNT, brush, New Point(600, 320)) ';// Get company Address

'g.DrawLine(mypen, 20, 345, 820, 345) ';//Horizondal line
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 330))
g.DrawString("No", FNT, brush, New Point(40, 350)) ';//
g.DrawString("Particulars", FNT, brush, New Point(150, 350))
g.DrawString("Amount", FNT, brush, New Point(670, 350))
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 365))
'g.DrawLine(mypen, 20, 375, 820, 375) ';//Horizondal line

'Data_Adapter()


Dim yy, zz As Integer
Dim Qty As Decimal
x = 125
y = 380
y1 = 380
' MsgBox(ds.Tables(2).Rows(1).Item(1).ToString())
'MsgBox(dt.Rows.Count)
originalx = x


'ROW_COUNT = ds.Tables(2).Rows.Count
Dim rw, col As Integer
rw = ds.Tables(2).Rows.Count - 1
col = ds.Tables(2).Columns.Count - 1
' zz = dt.Rows.Count
For yy = 0 To PER_PAGE
If ROW_COUNT = INCR Then
GoTo CC
End If

For zz = 0 To col
Masktxt.Text = Sno.ToString 'FOR SNO
char_count = Masktxt.Text.Length
If char_count = 4 Then
g.DrawString(Masktxt.Text + ".", FNT, brush, New Point(10, y1))
ElseIf char_count = 3 Then
g.DrawString(Masktxt.Text + ".", FNT, brush, New Point(21, y1))
ElseIf char_count = 2 Then
g.DrawString(Masktxt.Text + ".", FNT, brush, New Point(32, y1))
ElseIf char_count = 1 Then
g.DrawString(Masktxt.Text + ".", FNT, brush, New Point(40, y1))
Else
g.DrawString(Masktxt.Text + ".", FNT, brush, New Point(10, y1))
End If
'g.DrawString(Sno.ToString() + ".", FNT, brush, New Point(65, y1))
If COUNT = 1 Then 'JOB NAME

g.DrawString(ds.Tables(2).Rows(INCR).Item(zz).ToString(), FNT, brush, New Point(100, y))

ElseIf COUNT = 2 Then 'AMT
'g.DrawString(ds.Tables(2).Rows(INCR).Item(zz).ToString(), FNT, brush, New Point(630, y))
Qty = ds.Tables(2).Rows(INCR).Item(zz).ToString()
Masktxt.Text = Format(Qty, "#.00")
char_count = Masktxt.Text.Length
If char_count = 10 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(640, y))
ElseIf char_count = 9 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(650, y))
ElseIf char_count = 8 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(660, y))
ElseIf char_count = 7 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(672, y))
ElseIf char_count = 6 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(683, y))
ElseIf char_count = 5 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(693, y))
ElseIf char_count = 4 Then
g.DrawString(Masktxt.Text, FNT, brush, New Point(705, y))
Else
Masktxt.Text = Format(Qty, "#")
g.DrawString(Masktxt.Text, FNT, brush, New Point(620, y))
End If
TOT += Qty

End If
COUNT += 1
Next
y += 25 ';//Next Column
y1 += 25 ';//Next Colum
COUNT = 1
Sno += 1
INCR += 1
Next
CC:
GrandTot = Round(TOT)
MaskVATToT1.Text = Format(GrandTot, "#.00") 'ROUND AMT
MaskVATToT2.Text = Format(TOT, "#.00") 'TOT AMT
char_count = MaskVATToT2.Text.Length
If char_count = 10 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(638, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(638, 920))
ElseIf char_count = 9 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(650, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(650, 920))
ElseIf char_count = 8 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(660, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(660, 920))
ElseIf char_count = 7 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(672, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(672, 920))
ElseIf char_count = 6 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(683, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(683, 920))
ElseIf char_count = 5 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(694, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(694, 920))
ElseIf char_count = 4 Then
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(706, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(706, 920))
Else
g.DrawString(MaskVATToT2.Text, FNT, brush, New Point(638, 880))
g.DrawString(MaskVATToT1.Text, FNT, brush, New Point(638, 920))
End If
'g.DrawLine(mypen, 20, 950, 820, 950) ';//Horizondal line
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 860))
g.DrawString(RupeesToWord(Val(MaskVATToT1.Text)), FNT, brush, New Point(50, 955))
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 935))
'g.DrawLine(mypen, 20, 980, 820, 980) ';//Horizondal line

g.DrawString("For,", FNT, brush, New Point(560, 1000))
g.DrawString("(" + COMNAME + ")", FNT, brush, New Point(580, 1070))
g.DrawString("---------------------------------------------------------------------------------------------------------------------------------------------------", FNT, brush, New Point(20, 970))
'g.DrawLine(mypen, 20, 870, 820, 870) '//Horizondal line
g.DrawString("Total", FNT, brush, New Point(530, 880))
g.DrawString("-------------------------------------------------", FNT, brush, New Point(585, 900))
'g.DrawLine(mypen, 585, 910, 820, 910) ';//Horizondal line
g.DrawString("Grand Total", FNT, brush, New Point(470, 920))
RESET()

' If we have more paragraphs, we have more pages.
PAGE_LIMIT = ROW_COUNT - INCR
If PAGE_LIMIT > 0 Then
'Reset()
e.HasMorePages = True
Else
e.HasMorePages = False
End If
Catch ex As Exception
WAR(ex.ToString)
End Try
End Sub

Yours,
KaNNaN

-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"

Mail To : foreverkans@gmail.com

AnswerRe: Print Out Problem in Billing system??? Pin
EliottA6-Jul-09 2:53
EliottA6-Jul-09 2:53 
QuestionWrite to a word doc which is already open. Pin
Musa Biralo5-Jul-09 16:47
Musa Biralo5-Jul-09 16:47 
AnswerRe: Write to a word doc which is already open. Pin
Christian Graus5-Jul-09 17:03
protectorChristian Graus5-Jul-09 17:03 
QuestionSorting a structure array Pin
Jacob Dixon5-Jul-09 11:53
Jacob Dixon5-Jul-09 11:53 
AnswerRe: Sorting a structure array Pin
Luc Pattyn5-Jul-09 12:40
sitebuilderLuc Pattyn5-Jul-09 12:40 
GeneralRe: Sorting a structure array Pin
Jacob Dixon5-Jul-09 12:44
Jacob Dixon5-Jul-09 12:44 
AnswerRe: Sorting a structure array Pin
Gideon Engelberth5-Jul-09 12:44
Gideon Engelberth5-Jul-09 12:44 
GeneralRe: Sorting a structure array Pin
Jacob Dixon5-Jul-09 13:52
Jacob Dixon5-Jul-09 13:52 
GeneralRe: Sorting a structure array Pin
Gideon Engelberth5-Jul-09 15:56
Gideon Engelberth5-Jul-09 15:56 
GeneralRe: Sorting a structure array Pin
Jacob Dixon5-Jul-09 15:59
Jacob Dixon5-Jul-09 15:59 
GeneralRe: Sorting a structure array Pin
Luc Pattyn6-Jul-09 0:46
sitebuilderLuc Pattyn6-Jul-09 0:46 
QuestionDrag&Drop problem Pin
The real $M@5-Jul-09 0:17
The real $M@5-Jul-09 0:17 
AnswerRe: Drag&Drop problem Pin
Mycroft Holmes5-Jul-09 2:14
professionalMycroft Holmes5-Jul-09 2:14 
GeneralRe: Drag&Drop problem Pin
Henry Minute5-Jul-09 4:18
Henry Minute5-Jul-09 4:18 
GeneralRe: Drag&Drop problem Pin
Mycroft Holmes5-Jul-09 14:10
professionalMycroft Holmes5-Jul-09 14:10 
AnswerRe: Drag&Drop problem Pin
Alan N5-Jul-09 4:05
Alan N5-Jul-09 4:05 
GeneralRe: Drag&Drop problem Pin
The real $M@5-Jul-09 22:04
The real $M@5-Jul-09 22:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.