Jumat, 23 Desember 2016

UTS LAB PEMROGRAMAN BISNIS

Public Class Form1

    Dim ExcelApp As New Microsoft.Office.Interop.Excel.Application
    Dim MyExcelBook As Microsoft.Office.Interop.Excel.Workbook
    Dim AppWord As Microsoft.Office.Interop.Word.Application
    Dim DocWord As Microsoft.Office.Interop.Word.Document

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        MyExcelBook = ExcelApp.Workbooks.Open("D:\tugas vb\Book1.xlsx")

        ExcelApp.Range("A6").Value = TextBox1
        ExcelApp.Range("B6").Value = ComboBox1
        ExcelApp.Range("C6").Value = ComboBox2
        ExcelApp.Range("D6").Value = TextBox4
        ExcelApp.Range("E6").Value = TextBox5

        MyExcelBook.SaveAs("D:\tugas vb\Book1.xlsx")
        ExcelApp.Visible = True

        DocWord = AppWord.Documents.Open("D:\tugas vb\Data pembayaran.docx")
        DocWord.Bookmarks("Nama barang").Select()
        AppWord.Selection.TypeText(TextBox1.Text)

        DocWord.Bookmarks("Kode barang").Select()
        AppWord.Selection.TypeText(ComboBox1.Text)

        DocWord.Bookmarks("Jumlah pembelian").Select()
        AppWord.Selection.TypeText(ComboBox2.Text)

        DocWord.Bookmarks("Haraga satuan").Select()
        AppWord.Selection.TypeText(TextBox4.Text)

        DocWord.Bookmarks("Jumlah harga").Select()
        AppWord.Selection.TypeText(TextBox5.Text)

        DocWord.SaveAs2("D:\tugas vb\Data pembayaran.docx")
        AppWord.Visible = True


    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        ComboBox1.Items.Add("001")
        ComboBox1.Items.Add("002")
        ComboBox1.Items.Add("003")
        ComboBox1.Items.Add("004")
        ComboBox1.Items.Add("005")

        ComboBox2.Items.Add("1")
        ComboBox2.Items.Add("2")
        ComboBox2.Items.Add("3")
        ComboBox2.Items.Add("4")
        ComboBox2.Items.Add("5")
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
        If ComboBox1.Text = "001" Then
            TextBox1.Text = "teh kotak"
            TextBox4.Text = "5000"
        End If
        If ComboBox1.Text = "002" Then
            TextBox1.Text = "frestea"
            TextBox4.Text = "5000"
        End If
        If ComboBox1.Text = "003" Then
            TextBox1.Text = "pocari sweat"
            TextBox4.Text = "5000"
        End If
        If ComboBox1.Text = "004" Then
            TextBox1.Text = "coca cola"
            TextBox4.Text = "5000"
        End If
        If ComboBox1.Text = "005" Then
            TextBox1.Text = "Fanta"
            TextBox4.Text = "5000"
        End If

    End Sub

    Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged
        If ComboBox2.Text = "1" Then
            TextBox5.Text = "5000"
        End If
        If ComboBox2.Text = "2" Then
            TextBox5.Text = "10000"
        End If
        If ComboBox2.Text = "3" Then
            TextBox5.Text = "15000"
        End If
        If ComboBox2.Text = "4" Then
            TextBox5.Text = "20000"
        End If
        If ComboBox2.Text = "5" Then
            TextBox5.Text = "25000"
        End If
    End Sub
End Class

Kamis, 15 Desember 2016

LAB PEMROGRAMAN BISNIS

     Form1
Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Pembelian.Show()
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Penjualan.Show()
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Persediaan.Show()
    End Sub

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        Querry1.Show()
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
End Class
Pembelian
                          

    

Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb
Public Class Pembelian
    Dim Koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=F:\riyan\Beli-Beli HP.accdb"
    Dim ObjekKoneksi As New OleDb.OleDbConnection(Koneksi)
    Dim xReader As OleDbDataReader
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        TextBox7.Text = TextBox5.Text * TextBox4.Text
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Data_Pembelian.Show()
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        TextBox5.Text = ""
        TextBox6.Text = ""
        TextBox7.Text = ""

        TextBox1.Focus()

        ObjekKoneksi.Close()
        ObjekKoneksi.Open()

        Dim TambahDataPembelian As String = "INSERT INTO TablePembelian VALUES('" & TextBox1.Text & "','" & TextBox3.Text & "', '" & TextBox2.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & TextBox6.Text & "')"

        Dim Ocmd = New OleDbCommand(TambahDataPembelian, ObjekKoneksi)
        Ocmd.ExecuteNonQuery()

        ObjekKoneksi.Close()
        MsgBox("Sukses")
    End Sub

    Private Sub Pembelian_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
End Class
Penjualan



Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb
Public Class penjualan
    Dim Koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=F:\riyan\Beli-Beli HP.accdb"
    Dim ObjekKoneksi As New OleDb.OleDbConnection(Koneksi)
    Dim xReader As OleDbDataReader
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        TextBox7.Text = TextBox4.Text * TextBox5.Text
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Data_Penjualan.Show()
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        TextBox5.Text = ""
        TextBox6.Text = ""
        TextBox7.Text = ""

        TextBox1.Focus()

        ObjekKoneksi.Close()
        ObjekKoneksi.Open()

        Dim TambahDataPembelian As String = "INSERT INTO TablePembelian VALUES('" & TextBox1.Text & "','" & TextBox3.Text & "', '" & TextBox2.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & TextBox6.Text & "')"

        Dim Ocmd = New OleDbCommand(TambahDataPembelian, ObjekKoneksi)
        Ocmd.ExecuteNonQuery()

        ObjekKoneksi.Close()
        MsgBox("Sukses")
    End Sub

    Private Sub penjualan_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
End Class

Persediaan



Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb
Public Class Persediaan
    Dim Koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=F:\riyan\Beli-Beli HP.accdb"
    Dim ObjekKoneksi As New OleDb.OleDbConnection(Koneksi)
    Dim xReader As OleDbDataReader
    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
        Data_Persediaan.Show()
    End Sub

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        MessageBox.Show("Apakah Anda Yakin?", "caption", MessageBoxButtons.YesNo)
        If DialogResult.Yes Then
            Dim sql As String = "Delete FROM TablePersediaan WHERE NamaBarang='" + TextBox2.Text + "' where KodeBarang='" + TextBox1.Text + "'"

            Dim oCmd As New OleDbCommand
            ObjekKoneksi.Close()
            ObjekKoneksi.Open()
            oCmd.Connection = ObjekKoneksi
            oCmd.CommandText = sql
            oCmd.ExecuteNonQuery()

            MsgBox("Sukses")
        Else

            Exit Sub
        End If

    End Sub
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Dim sql As String = "Update TablePersediaan set NamaBarang='" + TextBox2.Text + "' where KodeBarang='" + TextBox1.Text + "'"

        Dim oCmd As New OleDbCommand
        ObjekKoneksi.Close()
        ObjekKoneksi.Open()
        oCmd.Connection = ObjekKoneksi
        oCmd.CommandText = sql
        oCmd.ExecuteNonQuery()

        MsgBox("Sukses")
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim VKodeMK = InputBox("Masukan Kode Mata Kuliah")

        ObjekKoneksi.Close()
        ObjekKoneksi.Open()
        Dim Ocmd As New OleDbCommand("SELECT * FROM TableMK Where KodeMK='" + VKodeMK + "'", ObjekKoneksi)
        xReader = Ocmd.ExecuteReader
        If xReader.HasRows Then
            xReader.Read()
            TextBox1.Text = xReader("KodeBarang")
            TextBox2.Text = xReader("NamaBarang")
            TextBox3.Text = xReader("JumlahBarang")
        Else
            MsgBox("Kode Mata Kuliah Tidak Ada")
            Exit Sub
        End If
        xReader.Close()
    End Sub

    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        PRINT.Show()
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""


        TextBox1.Focus()

        ObjekKoneksi.Close()
        ObjekKoneksi.Open()

        Dim TambahDataPenjualan As String = "INSERT INTO TablePembelian VALUES('" & TextBox1.Text & "','" & TextBox2.Text & "', '" & TextBox3.Text & "')"

        Dim Ocmd = New OleDbCommand(TambahDataPenjualan, ObjekKoneksi)
        Ocmd.ExecuteNonQuery()

        ObjekKoneksi.Close()
        MsgBox("Sukses")
    End Sub

    Private Sub Persediaan_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
End Class

                              Q
uerry1





Minggu, 29 Mei 2016

Tugas Konsep Pemrograman

TAHAP PERCOBAAN SPG
MENGGUNAKAN 3 RUMUS


Dibawah ini adalah coding

// RIYAN KP UAS.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
using namespace std;


class TOTAL {

       int total(int JUMLAHPRODUK, int BONUS)
       {
              int total = JUMLAHPRODUK * BONUS * 0.5;
              return total;

       }
}operasitotal;

struct riyan{
       char NAMASPG[20];
       int JUMLAHPRODUK;
       int BONUS;
       int MENDAPATKANGAJI;
       int GRADE;
}riyanfebrianto1506715841;

int main()
{

       cout << "TAHAP PERCOBAAN SPG";
       cout << endl;


       cout << "Nama SPG: ";
       cin >> (riyanfebrianto1506715841.NAMASPG);
       cout << "JUMLAH PRODUK: ";
       cin >> (riyanfebrianto1506715841.JUMLAHPRODUK);
       cout << "BONUS: ";
       cin >> (riyanfebrianto1506715841.BONUS);

       int c;
       do
       {
              cout << "masukan kode spg yang anda inginkan: ";
              cin >> c;
              cout << "anda memilih kode spg :" << c;
       } while (c != 1 & 2 & 3);
       cout << endl;

       int MENDAPATKANGAJI;
       MENDAPATKANGAJI = riyanfebrianto1506715841.JUMLAHPRODUK * riyanfebrianto1506715841.BONUS *0.5;
       cout << "nilai mendapatkan gaji: " << MENDAPATKANGAJI;
       cout << endl;

       int KETERANGAN;
       if (MENDAPATKANGAJI >= 5000000)
       {
              cout << "keterangan = SELAMAT ANDA LULUS";
              cout << endl;
       }
       else
              cout << "keterangan = COBA LAGI ANDA BELOM BERUNTUNG";
       cout << endl;
      


       return 0;
}


Berikut ini adalah hasilnya