Private Sub LoadReceipt() Dim x As Integer = 0 Dim Y As Integer = 0 Try sqL = "SELECT IDescription, itemprice, [Quantity], POSDATE, (itemPrice * [Quantity]) as TotalPrice FROM [Item] as I, POSDetail as PD, POS as P WHERE I.ItemNo = PD.itemNo And PD.InvoiceNO = P.InvoiceNo AND P.InvoiceNo = '" & frmPOS.lblInvoiceNo.Text & "' ORDER By iDescription" ConnDB() cmd = New OleDbCommand(sqL, conn) dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) dgw.Rows.Clear() getTotal = 0.0 getQuantity = 0.0 Do While dr.Read = True dgw.Rows.Add(dr("Quantity"), dr("iDescription"), dr("Itemprice"), dr("TotalPrice")) getTotal += dr("TotalPrice") getQuantity += dr(2) dgw.Height += 19 x += 19 Loop Y = x - 30 dgw.Height = dgw.Height - 20 lblTotal.Text = Format(getTotal, "#,##0.00") lblVat.Location = New Point(204, 212 + Y) vat.Location = New Point(4, 212 + Y) subTotal.Location = New Point(3, 227 + Y) lblSubtotal.Location = New Point(203, 227 + Y) TotalAmount.Location = New Point(3, 245 + Y) lblTotal.Location = New Point(203, 245 + Y) Cash.Location = New Point(3, 262 + Y) lblCash.Location = New Point(203, 262 + Y) change.Location = New Point(3, 280 + Y) lblChange.Location = New Point(203, 280 + Y) lblLine.Location = New Point(4, 299 + Y) lblOR.Location = New Point(46, 315 + Y) lblThank.Location = New Point(62, 331 + Y) Panel1.Height = Panel1.Height + Y Me.Height = Me.Height + Y Catch ex As Exception MsgBox(ex.Message) Finally cmd.Dispose() conn.Close() End Try End Sub Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage Dim bm As New Bitmap(Me.Panel1.Width, Me.Panel1.Height) Panel1.DrawToBitmap(bm, New Rectangle(0, 0, Me.Panel1.Width, Me.Panel1.Height)) e.Graphics.DrawImage(bm, 0, 0) Dim aPS As New PageSetupDialog aPS.Document = PrintDocument1 End Sub Private Sub frmPrintReceipt_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Label7.Text = Format(Date.Now, "Short Date") Label9.Text = Format(Date.Now, "Long Time") lblInvoice.Text = frmPOS.lblInvoiceNo.Text LoadCustomer() GetVatNonVat() getCashChange() getEmployee() LoadReceipt() PrintDocument1.Print() frmPOS.txtSearch.Focus() Me.Close() End Sub
18 août 2019 à 21:17
18 août 2019 à 21:23
18 août 2019 à 21:25
merci beaucoup Whismeril pour ta réponse
18 août 2019 à 22:39
18 août 2019 à 22:41