Ternyata tidak terlalu sulit juga..
Berikut ini penampakannya :
Kalau ada yg mau source codenya, silahkan coba2 dibawah ini :
Imports System.DataImports System.Data.SqlClientImports System.IOImports System.DiagnosticsImports Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6Public Class PenjualanDim str, sql, sql1, sql2, sql3 As StringDim cmd1, cmd As SqlCommandDim currentDate As DateTime = DateTime.NowDim printer As New PrinterDim PAPER_WIDTH As Integer = 1800Dim mulai As IntegerSub cetakawal()Dim bj, ks As Stringbj = "Jam : "ks = "Kasir : "printer.Font = New Font("verdana", 7)printer.CurrentX = PAPER_WIDTH - (printer.TextWidth("LAI-LAI MARKET BUAH") / 2)printer.Print("PT. XXXX ABADI JAYA")printer.CurrentX = PAPER_WIDTH - (printer.TextWidth("Jl. Terusan Muter-Muter, Malang") / 2)printer.Print("Jl. Terusan Muter-Muter, Malang")printer.CurrentX = PAPER_WIDTH - (printer.TextWidth("Telp. 0341-336069 Fax. 0341-336070") / 2)printer.Print("Telp. 0341-123456 Fax. 0341-112233")printer.Print("--------------------------------------------------------------")printer.Print("Tanggal : " + Format(Now, "dd MMM yyyy ") & ks & MaskedTextBox3.Text)printer.Print("Nota : " & MaskedTextBox2.Text & " " & bj & Format(Now, "hh:mm:ss"))printer.Print("--------------------------------------------------------------")End SubSub cetaktransaksi()printer.Print(TextBox13.Text)printer.Print(TextBox14.Text & " x " & TextBox15.Text & " = " & TextBox16.Text)End SubSub cetakakhir()cetaktransaksi()printer.Print("--------------------------------------------------------------")'printer.Font = New Font("Arial", 8)printer.Print("")printer.CurrentX = PAPER_WIDTH - (printer.TextWidth("Terima kasih atas kunjungan Anda") / 2)printer.FontItalic = Trueprinter.Print("Terima kasih atas kunjungan Anda")printer.EndDoc() ' potong kertasEnd SubSub FormatText()DGV.Columns(5).DefaultCellStyle.Format = "N0"DGV.Columns(3).DefaultCellStyle.Format = "N0"Me.TextBox2.Text = SetDisplay(0)Me.TextBox3.Text = SetDisplay(0)Me.TextBox4.Text = SetDisplay(0)Me.TextBox5.Text = SetDisplay(0)Me.TextBox6.Text = SetDisplay(0)Me.Label21.Text = SetDisplay(0)Me.TextBox2.TextAlign = HorizontalAlignment.RightMe.TextBox3.TextAlign = HorizontalAlignment.RightMe.TextBox4.TextAlign = HorizontalAlignment.RightMe.TextBox5.TextAlign = HorizontalAlignment.RightMe.TextBox6.TextAlign = HorizontalAlignment.RightMe.TextBox7.TextAlign = HorizontalAlignment.RightEnd SubSub Kosong()mulai = 0Me.TextBox8.Text = 0Me.TextBox9.Text = 0Me.TextBox10.Text = 0Me.TextBox11.Text = 0Me.TextBox12.Text = 0Me.Label5.Text = ""Me.Label6.Text = ""Me.Label7.Text = ""Me.Label8.Text = ""Me.Label9.Text = ""Me.DGV.Rows.Clear()MaskedTextBox2.Text = AutoNumber()End SubSub BuatKolomBaru()DGV.Columns.Add("Kode", "Item Code")DGV.Columns.Add("Nama", "Item Name")DGV.Columns.Add("Sat", "Stn")DGV.Columns.Add("Harga", "Price")DGV.Columns.Add("Jumlah", "Qty")DGV.Columns.Add("Total", "Total")DGV.Columns.Add("Ttl", "Berat")DGV.Columns.Add("Div", "Divisi")Call AturLebarKolom()End SubSub AturLebarKolom()DGV.Columns(0).Width = 120DGV.Columns(1).Width = 260DGV.Columns(2).Width = 65DGV.Columns(3).Width = 100DGV.Columns(4).Width = 60DGV.Columns(5).Width = 100End SubPrivate Sub Form4_Load(sender As Object, e As EventArgs) Handles MyBase.Load'str = "server=server-01\server;database=xxx;user id=sa;password=rahasia;"vmesin = "14"Me.Label4.Visible = FalseMe.BuatKolomBaru()Me.Kosong()If currentDate.Day = 1 ThenBulan_baru()End If'CariBulan()'dbn = bulan + Trim(Today.Year)FormatText()DGV.Columns(3).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRightDGV.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRightDGV.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRightMaskedTextBox1.Text = Today'MaskedTextBox2.Text = bulan + Trim(Today.Year) '"4030417166"MaskedTextBox3.Text = "JOKOWI"CariHari()hsl = 0Me.TextBox2.Text = 0End SubPrivate Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPressIf Asc(e.KeyChar) = 13 ThenTextBox1.CharacterCasing = CharacterCasing.Upperkode = Trim(TextBox1.Text)berat = 1jum = 1If Microsoft.VisualBasic.Left(Me.TextBox1.Text, 2) = "24" Thenkode = Microsoft.VisualBasic.Mid(TextBox1.Text, 3, 5)berat = Microsoft.VisualBasic.Mid(TextBox1.Text, 8, 2) + "," + Microsoft.VisualBasic.Mid(TextBox1.Text, 10, 3)End Ifkiri = Microsoft.VisualBasic.Left(Me.TextBox1.Text, 1)tot = Val(Microsoft.VisualBasic.Mid(Me.TextBox1.Text, 2, 6))nil = 0itm = 0Select Case kiriCase "X"DGV.SelectedCells(4).Value = totDGV.SelectedCells(5).Value = DGV.SelectedCells(3).Value * totDGV.SelectedCells(6).Value = totTextBox14.Text = totCase "T"TextBox5.Text = SetDisplay(Label21.Text)TextBox6.Text = SetDisplay(TextBox5.Text - TextBox4.Text)Me.TextBox10.Text = Val(TextBox1.Text.Split("T").Last)Me.TextBox8.Text = TextBox5.Text - TextBox4.Text'Me.cetakakhir()Koneksi_Bulan()sql1 = "Insert Into rth(nofaktur,tanggal,jumlah,tunai,bayar,sisa,totalqty,iduser,disc1)" &" values('" & MaskedTextBox2.Text & "','" & Format(Now, "yyyy-MM-dd HH:mm:ss") & "'," & TextBox12.Text & "," &"" & TextBox9.Text & "," & TextBox10.Text & "," &"" & TextBox8.Text & "," & TextBox7.Text & "," &"'" & MaskedTextBox3.Text & "'," & TextBox11.Text & ")"Dim cmd1 As New SqlCommand(sql1, Conn_bulan)cmd1.ExecuteNonQuery()TryFor r As Integer = 0 To DGV.Rows.Count - 2str = DGV.Rows(r).Cells(0).Value'If Not str = vbEmpty ThenKoneksi_Bulan()sql = "Insert Into rtd(nofaktur,tanggal,ItemCode,namaitem,satuan,harga,Qtyshp,jumlah,qtybb,divisi,tunai,iduser)" &" values('" & MaskedTextBox2.Text & "','" & Format(Now, "yyyy-MM-dd HH:mm:ss") & "','" & DGV.Rows(r).Cells(0).Value & "'," &"'" & DGV.Rows(r).Cells(1).Value.Replace("'", "''") & "','" & DGV.Rows(r).Cells(2).Value & "'," &"" & DGV.Rows(r).Cells(3).Value & "," & DGV.Rows(r).Cells(4).Value & "," &"" & DGV.Rows(r).Cells(5).Value & "," & DGV.Rows(r).Cells(6).Value & "," &"'" & DGV.Rows(r).Cells(7).Value & "'," & DGV.Rows(r).Cells(5).Value & ",'" & MaskedTextBox3.Text & "')"Dim cmd As New SqlCommand(sql, Conn_bulan)cmd.ExecuteNonQuery()'Conn.Close()'End IfNextMe.Kosong()Me.Label4.Text = "Change ---- " + SetDisplay(TextBox6.Text)CatchMsgBox("Server Tidak Terhubung")End TryCase Else' If mulai = 0 Then'Me.cetakawal()'mulai = 1'Else'Me.cetaktransaksi()'End IfKoneksi_lailai()row = "select ItemCode, NamaItem, Satuan, Harga from IcAlt where ItemCode='" & kode & "'"cmd = New SqlClient.SqlCommand(row, Conn_lailai)rd = cmd.ExecuteReaderrd.Read()If rd.HasRows ThenDGV.Rows.Add(rd.Item(0), rd.Item(1), rd.Item(2), rd.Item(3), berat, rd.Item(3) * berat, 1)Me.Label4.Text = rd.Item(1)Me.Label5.Text = 1Me.Label8.Text = SetDisplay(rd.Item(3))Me.Label9.Text = SetDisplay(rd.Item(3))DGV.CurrentCell = DGV(0, DGV.RowCount - 2)TextBox13.Text = rd.Item(1)TextBox14.Text = SetDisplay(rd.Item(3))TextBox15.Text = SetDisplay(berat)TextBox16.Text = SetDisplay(rd.Item(3) * berat)'Print("SUB Lai Lai Market Buah")ElseMsgBox("Kode barang tidak terdaftar")End IfEnd SelectFor Each R As DataGridViewRow In DGV.Rowsnil += R.Cells(5).Valueitm += R.Cells(6).Value'totqty += R.Cells(6).ValueNextMe.TextBox2.Text = SetDisplay(nil)Me.TextBox7.Text = itmMe.TextBox4.Text = SetDisplay(nil)Me.TextBox12.Text = nilMe.TextBox11.Text = 0Me.TextBox9.Text = nilTextBox1.Clear()End IfEnd SubPrivate Sub DGV_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs) Handles DGV.CellFormattingDGV.SelectionMode = DataGridViewSelectionMode.FullRowSelectDGV.DefaultCellStyle.SelectionBackColor = Color.LawnGreenDGV.DefaultCellStyle.SelectionForeColor = Color.BlueEnd SubPrivate Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.TickMe.Text = "POS Software 1.0 - " + hari + " - " + Today + " - " + TimeOfDayEnd SubPrivate Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChangedSelect Case Microsoft.VisualBasic.Left(Me.TextBox1.Text, 1)Case "T"Label11.Text = "TUNAI"GroupBox3.Visible = TrueIf TextBox1.TextLength = 1 ThenLabel21.Text = 0ElseLabel21.Text = SetDisplay(TextBox1.Text.Split("T").Last)End IfCase "C"Label11.Text = "CARD"GroupBox3.Visible = TrueLabel21.Text = SetDisplay(TextBox2.Text)Case "D"Label11.Text = "DEBET"GroupBox3.Visible = TrueLabel21.Text = SetDisplay(TextBox2.Text)Case ElseGroupBox3.Visible = FalseEnd SelectEnd SubPrivate Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.ClickBulan_baru()End SubEnd Class
Semoga Bermanfaat
Tidak ada komentar:
Posting Komentar