Contoh Listing Program Skripsi Menggunakan Borland Delphi 7

   Form Menu Login

unit UnitLogin;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, jpeg, ExtCtrls, StdCtrls, Buttons, DB, mySQLDbTables;
type
  TFormLogin = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    EditPass: TEdit;
    EditUsername: TEdit;
    Image1: TImage;
    mySQLQuery1: TmySQLQuery;
    GroupBox2: TGroupBox;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure EditUsernameClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  FormLogin: TFormLogin;
implementation
      uses UnitUtama;
{$R *.dfm}

procedure TFormLogin.BitBtn2Click(Sender: TObject);
begin
EditUsername.Clear;
EditPass.Clear;
end;
procedure TFormLogin.BitBtn1Click(Sender: TObject);
begin
mySQLQuery1.Close;
mySQLQuery1.SQL.Clear;
mySQLQuery1.SQL.Add('select * from user where username="'+EditUsername.Text+'" and pass +"'+EditPass.Text+'"');
mySQLQuery1.Open;
if not mySQLQuery1.IsEmpty then
begin
FormLogin.Hide;
FormUtama.ShowModal;
end
else
MessageDlg('Cek User dan Password', mtError, [mbOk],0)
end;
procedure TFormLogin.BitBtn3Click(Sender: TObject);
begin
Close;
end;
procedure TFormLogin.EditUsernameClick(Sender: TObject);
begin
EditUsername.Clear;
EditPass.Clear;
end;
end.

·         Form Menu Utama

unit UnitUtama;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, mySQLDbTables, Menus, ExtCtrls, StdCtrls, jpeg;
type
  TFormUtama = class(TForm)
    MainMenu1: TMainMenu;
    Kri1: TMenuItem;
    Barang1: TMenuItem;
    BarangMasuk1: TMenuItem;
    BarangKeluar1: TMenuItem;
    Laporan1: TMenuItem;
    LaporanKriteria1: TMenuItem;
    N1: TMenuItem;
    LapSemuaBarang1: TMenuItem;
    N2: TMenuItem;
    LapBarangMasuk1: TMenuItem;
    N3: TMenuItem;
    LapSemuaBarangKeluar1: TMenuItem;
    N5: TMenuItem;
    Exit1: TMenuItem;
    DataBaseSkripsi: TmySQLDatabase;
    Timer1: TTimer;
    Label2: TLabel;
    Label3: TLabel;
    Image1: TImage;
    TabelKriteria: TmySQLTable;
    TabelKriteriaid_kriteria: TStringField;
    TabelKriterianm_kriteria: TStringField;
    TableBarang: TmySQLTable;
    tabelbarangmasuk: TmySQLTable;
    tabelbarangmasukno_nota: TStringField;
    tabelbarangmasuktgl_nota: TDateField;
    TabelHabis: TmySQLTable;
    TabelHabisid_habis: TStringField;
    TabelHabistgl_abis: TDateField;
    Label4: TLabel;
    TableBarangid_barang: TStringField;
    TableBarangnm_barang: TStringField;
    TableBarangid_kriteria: TStringField;
    TableBarangstok: TIntegerField;
    TableBarangsatuan: TStringField;
    Label1: TLabel;
    Image2: TImage;
    Bevel1: TBevel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Timer2: TTimer;
    Label5: TLabel;
    N4: TMenuItem;
    N6: TMenuItem;
    N7: TMenuItem;
    N8: TMenuItem;
    N9: TMenuItem;
    N10: TMenuItem;
    N11: TMenuItem;
    N12: TMenuItem;
    N13: TMenuItem;
    N14: TMenuItem;
    N15: TMenuItem;
    N16: TMenuItem;
    N17: TMenuItem;
    N18: TMenuItem;
    N19: TMenuItem;
    N20: TMenuItem;
    N21: TMenuItem;
    N22: TMenuItem;
    N23: TMenuItem;
    N24: TMenuItem;
    N25: TMenuItem;
    N26: TMenuItem;
    N27: TMenuItem;
    N28: TMenuItem;
    N29: TMenuItem;
    N30: TMenuItem;
    procedure Exit1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure Kri1Click(Sender: TObject);
    procedure Barang1Click(Sender: TObject);
    procedure BarangMasuk1Click(Sender: TObject);
    procedure BarangKeluar1Click(Sender: TObject);
    procedure LaporanKriteria1Click(Sender: TObject);
    procedure LapSemuaBarang1Click(Sender: TObject);
    procedure LapBarangMasuk1Click(Sender: TObject);
    procedure LapSemuaBarangKeluar1Click(Sender: TObject);
    procedure Label5Click(Sender: TObject);
    procedure Timer2Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  FormUtama: TFormUtama;
implementation
     uses Unitgambarlogostmik, UnitBarang, UnitBarangMasuk, UnitLaporanBarangHabis,
     UnitDataKeluar, UnitLaporanPerKriteria, UnitLaporanBarang, UnitLaporanBarangMasuk, UnitMenuLaporan;
{$R *.dfm}

procedure TFormUtama.Exit1Click(Sender: TObject);
begin
Close;
end;
procedure TFormUtama.Timer1Timer(Sender: TObject);
begin
 Label1.Caption := TimeToStr(Now);
end;
procedure TFormUtama.Kri1Click(Sender: TObject);
begin
FormKriteria.ShowModal;
end;
procedure TFormUtama.Barang1Click(Sender: TObject);
begin
FormBarang.ShowModal;
end;
procedure TFormUtama.BarangMasuk1Click(Sender: TObject);
begin
Formbarangmasuk.ShowModal;
end;
procedure TFormUtama.BarangKeluar1Click(Sender: TObject);
begin
FormDataKeluar.ShowModal;
end;
procedure TFormUtama.LaporanKriteria1Click(Sender: TObject);
begin
FormLaporanPerKriteria.QuickRep1.Preview;
end;
procedure TFormUtama.LapSemuaBarang1Click(Sender: TObject);
begin
FormSeluruhBarang.QuickRep1.Preview;
end;
procedure TFormUtama.LapBarangMasuk1Click(Sender: TObject);
begin
FormLaporanBarangMasuk.QuickRep1.Preview;
end;
procedure TFormUtama.LapSemuaBarangKeluar1Click(Sender: TObject);
begin
FormLporanBarangHabis.QuickRep1.Preview;
end;
procedure TFormUtama.Label5Click(Sender: TObject);
begin
FormAboutMe.ShowModal;
end;
procedure TFormUtama.Timer2Timer(Sender: TObject);
begin
Label8.Caption := DateTimeToStr(Now);
end;
procedure TFormUtama.FormCreate(Sender: TObject);
begin
end;
end.      

·         Form Kriteria

unit Unitgambarlogostmik;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, Grids, DBGrids, StdCtrls, ExtCtrls, Buttons;
type
  TFormKriteria = class(TForm)
    Label1: TLabel;
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    Label2: TLabel;
    Timer1: TTimer;
    GroupBox1: TGroupBox;
    LIdKriteria: TLabel;
    EditKriteria: TEdit;
    LNmKriteria: TLabel;
    Edit1: TEdit;
    GroupBox2: TGroupBox;
    GroupBox3: TGroupBox;
    Button2: TButton;
    Button3: TButton;
    ButtonSimpan: TButton;
    ButtonBatal: TButton;
    Button1: TButton;
    ComboBox1: TComboBox;
    Label3: TLabel;
    Bevel1: TBevel;
    Label4: TLabel;
    procedure Timer1Timer(Sender: TObject);
    procedure ButtonSimpanClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ButtonEditClick(Sender: TObject);
    procedure ButtonBatalClick(Sender: TObject);
    procedure ComboBox1DropDown(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Label4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  FormKriteria: TFormKriteria;
implementation
     uses UnitUtama, UnitMenuLaporan;
{$R *.dfm}
procedure TFormKriteria.Timer1Timer(Sender: TObject);
begin
Label2.Caption := TimeToStr(now);
end;
procedure TFormKriteria.ButtonSimpanClick(Sender: TObject);
begin
  if EditKriteria.Text = '' then
  begin
  Application.MessageBox('Id Kriteria Kosong','PERINGATAN',
  MB_OK + MB_ICONERROR);
  Exit;
  end;
  if Edit1.Text = '' then
  begin
  Application.MessageBox('Nama Kriteria Kosong','PERINGATAN',
  MB_OK + MB_ICONERROR);
  Exit;
  EditKriteria.SetFocus;
  end;

  FormUtama.TabelKriteria.Append;
  FormUtama.TabelKriteria.FieldByName('id_kriteria').AsString := EditKriteria.Text;
  FormUtama.TabelKriteria.FieldByName('nm_kriteria').AsString := Edit1.Text;
  FormUtama.TabelKriteria.Post;
  FormCreate(Sender);
end;
procedure TFormKriteria.FormCreate(Sender: TObject);
begin
ComboBox1.Clear;
Edit1.Clear;
FormUtama.TabelKriteria.Open;
FormUtama.TabelKriteria.Active;
FormUtama.TabelKriteria.Active := True;
FormUtama.TabelKriteria.Refresh;
if FormUtama.TabelKriteria.Bof then
EditKriteria.Text :='00001'
 else
 begin
 FormUtama.TabelKriteria.Last;
 EditKriteria.Text := FormatFloat('00000',FormUtama.TabelKriteria.FieldByName('id_kriteria').AsInteger+1)
 end;
end;
procedure TFormKriteria.ButtonEditClick(Sender: TObject);
begin
Close;
end;
procedure TFormKriteria.ButtonBatalClick(Sender: TObject);
begin
ComboBox1.Clear;
Edit1.Clear;
end;
procedure TFormKriteria.ComboBox1DropDown(Sender: TObject);
begin
FormUtama.TabelKriteria.Refresh;
FormUtama.TabelKriteria.First;
ComboBox1.Clear;
while not FormUtama.TabelKriteria.Eof do
begin
ComboBox1.Items.Add(FormUtama.TabelKriteria.FieldByName('id_kriteria').AsString +'-'+
FormUtama.TabelKriteria.FieldByName('nm_kriteria').AsString);
FormUtama.TabelKriteria.Next;
end;
end;
procedure TFormKriteria.ComboBox1Change(Sender: TObject);
var hasillist : string;
begin
  hasillist := ComboBox1.Items[ComboBox1.ItemIndex];
  if FormUtama.TabelKriteria.FindKey([hasillist]) then
  begin
  Edit1.Text := FormUtama.TabelKriteria.fieldbyname('nm_kriteria').AsString;
  end;
end;
procedure TFormKriteria.Button3Click(Sender: TObject);
begin
FormUtama.TabelKriteria.Edit;
FormUtama.TabelKriteria.FieldByName('nm_kriteria').AsString := Edit1.Text;
FormUtama.TabelKriteria.Post
end;
procedure TFormKriteria.Button1Click(Sender: TObject);
begin
if MessageDlg('Apakah ingin menghapus '+Edit1.Text+'??',
mtConfirmation, [mbYes,mbNo],0)= mrYes then
begin
FormUtama.TabelKriteria.Delete;
FormCreate(Sender);
end
else
begin
ComboBox1.SetFocus;
end;
 end;
procedure TFormKriteria.Label4Click(Sender: TObject);
begin
FormAboutMe.ShowModal;
end;
end.

·         Form Barang

unit UnitBarang;

interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids, DBGrids, DB, ExtCtrls, mySQLDbTables, Buttons;
type
  TFormBarang = class(TForm)
    DataSource1: TDataSource;
    Label1: TLabel;
    Timer1: TTimer;
    Tabelkriteria: TmySQLTable;
    GroupBox1: TGroupBox;
    LabelIdKriteria: TLabel;
    ComboBoxIdKriteria: TComboBox;
    Label2: TLabel;
    Tabelkriteriaid_kriteria: TStringField;
    Tabelkriterianm_kriteria: TStringField;
    Edit1: TEdit;
    GroupBox2: TGroupBox;
    Panel1: TPanel;
    LabelIdBarang: TLabel;
    LabelNmBarang: TLabel;
    LabelStok: TLabel;
    Label3: TLabel;
    EditIdBarang: TEdit;
    EditNmBarang: TEdit;
    EditStok: TEdit;
    Edit2: TEdit;
    Panel2: TPanel;
    ButtomSimpan: TBitBtn;
    Button2: TButton;
    mySQLQuery1: TmySQLQuery;
    Button1: TButton;
    GroupBox3: TGroupBox;
    ComboBox1: TComboBox;
    Label4: TLabel;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    procedure Button5Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure ComboBoxIdKriteriaDropDown(Sender: TObject);
    procedure ButtomSimpanClick(Sender: TObject);
    procedure ComboBoxIdKriteriaChange(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure ComboBox1DropDown(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  FormBarang: TFormBarang;
implementation
     uses UnitUtama, UnitLaporanBarang;
{$R *.dfm}
procedure TFormBarang.Button5Click(Sender: TObject);
begin
FormSeluruhBarang.QuickRep1.Preview;
end;
procedure TFormBarang.Timer1Timer(Sender: TObject);
begin
Label1.Caption :=TimeToStr(now);
end;
procedure TFormBarang.FormCreate(Sender: TObject);
begin
Tabelkriteria.Open;
 ComboBox1.Clear;
Edit1.Clear;
Edit2.Clear;
EditNmBarang.Clear;
Edit1.Clear;
ComboBoxIdKriteria.Clear;
EditStok.Clear;
FormUtama.TableBarang.Open;
FormUtama.TableBarang.Active;
FormUtama.TableBarang.Active := True;
FormUtama.TableBarang.Refresh;
if FormUtama.TableBarang.Bof then
EditIdBarang.Text :='00001'
 else
 begin
 FormUtama.TableBarang.Last;
 EditIdBarang.Text := FormatFloat('00000',FormUtama.TableBarang.FieldByName('id_barang').AsInteger+1)
 end;
     end;
procedure TFormBarang.Button2Click(Sender: TObject);
begin
EditIdBarang.Clear;
EditNmBarang.Clear;
ComboBoxIdKriteria.Clear;
EditStok.Clear;
end;
procedure TFormBarang.ComboBoxIdKriteriaDropDown(Sender: TObject);
begin
Tabelkriteria.Open;
Tabelkriteria.Refresh;
Tabelkriteria.First;
ComboBoxIdKriteria.Clear;
while not Tabelkriteria.Eof do
begin
ComboBoxIdKriteria.Items.Add(Tabelkriteria.FieldByName('id_kriteria').AsString);
Tabelkriteria.Next;
end;
end;
procedure TFormBarang.ButtomSimpanClick(Sender: TObject);
begin
  if EditNmBarang.Text = '' then
  begin
  Application.MessageBox('Nama Barang Kosong','PERINGATAN',
  MB_OK + MB_ICONERROR);
  Exit;
  end;
    if EditStok.Text = '' then
  begin
  Application.MessageBox('Stok Barang Kosong','PERINGATAN',
  MB_OK + MB_ICONERROR);
  Exit;
  end;
     if Edit2.Text = '' then
  begin
  Application.MessageBox('Satuan Kosong','PERINGATAN',
  MB_OK + MB_ICONERROR);
  Exit;
  end;
  FormUtama.TableBarang.Append;
  FormUtama.TableBarang.FieldByName('id_barang').AsString := EditIdBarang.Text;
  FormUtama.TableBarang.FieldByName('nm_barang').AsString := EditNmBarang.Text;
  FormUtama.TableBarang.FieldByName('id_kriteria').AsString := ComboBoxIdKriteria.Text;
  FormUtama.TableBarang.FieldByName('stok').AsString := EditStok.Text;
   FormUtama.TableBarang.FieldByName('satuan').AsString := Edit2.Text;
  FormUtama.TableBarang.Post;
  FormCreate(Sender);
end;
procedure TFormBarang.ComboBoxIdKriteriaChange(Sender: TObject);
var hasillist : string;
begin
  hasillist := ComboBoxIdKriteria.Items[ComboBoxIdKriteria.ItemIndex];
  if TabelKriteria.FindKey([hasillist]) then
  begin
  Edit1.Text := Tabelkriteria.fieldbyname('nm_kriteria').AsString;
  end;
end;
procedure TFormBarang.Button1Click(Sender: TObject);
begin
Close;
end;
procedure TFormBarang.ComboBox1Change(Sender: TObject);
var hasillist : string;
begin
  hasillist := ComboBox1.Items[ComboBox1.ItemIndex];
  if FormUtama.TableBarang.FindKey([hasillist]) then
  begin
  EditNmBarang.Text := FormUtama.TableBarang.fieldbyname('nm_barang').AsString;
  EditStok.Text := FormUtama.TableBarang.fieldbyname('stok').AsString;
  Edit2.Text := FormUtama.TableBarang.fieldbyname('satuan').AsString;
  end;
end;
procedure TFormBarang.ComboBox1DropDown(Sender: TObject);
begin
FormUtama.TableBarang.Refresh;
FormUtama.TableBarang.First;
ComboBox1.Clear;
while not FormUtama.TableBarang.Eof do
begin
ComboBox1.Items.Add(FormUtama.TableBarang.FieldByName('id_barang').AsString +'-'+
FormUtama.TableBarang.FieldByName('nm_barang').AsString);
FormUtama.TableBarang.Next;
end;
end;
procedure TFormBarang.Button4Click(Sender: TObject);
begin
FormUtama.TableBarang.Edit;
FormUtama.TableBarang.FieldByName('nm_barang').AsString := EditNmBarang.Text;
FormUtama.TableBarang.FieldByName('stok').AsString := EditStok.Text;
FormUtama.TableBarang.FieldByName('satuan').AsString := Edit2.Text;
FormUtama.TableBarang.Post
end;
procedure TFormBarang.Button3Click(Sender: TObject);
begin
if MessageDlg('Apakah ingin menghapus '+EditNmBarang.Text+'??',
mtConfirmation, [mbYes,mbNo],0)= mrYes then
begin
FormUtama.TableBarang.Delete;
FormCreate(Sender);
end
else
begin
ComboBox1.SetFocus;
end;
end;
end.

·         Form Barang Masuk

unit UnitBarangMasuk;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, StdCtrls, ExtCtrls, DB, ComCtrls, mySQLDbTables;
type
  TFormbarangmasuk = class(TForm)
    Timer1: TTimer;
    Label4: TLabel;
    TabelDetailbarangMasuk: TmySQLTable;
    TabelBarang: TmySQLTable;
    GroupBox1: TGroupBox;
    Label2: TLabel;
    EditNoNota: TEdit;
    DateTimePicker1: TDateTimePicker;
    Label3: TLabel;
    GroupBox2: TGroupBox;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    ComboBoxBarang: TComboBox;
    EditNmBarang: TEdit;
    Editstok: TEdit;
    EditJumlah: TEdit;
    DBGrid1: TDBGrid;
    TabelBarangid_barang: TStringField;
    TabelBarangnm_barang: TStringField;
    TabelBarangid_kriteria: TStringField;
    TabelBarangstok: TIntegerField;
    TabelDetailbarangMasukno_nota: TStringField;
    TabelDetailbarangMasukid_barang: TStringField;
    TabelDetailbarangMasukharga: TIntegerField;
    TabelDetailbarangMasukjumlah: TIntegerField;
    temp_masuk: TmySQLTable;
    temp_masukid_barang: TStringField;
    temp_masuknm_barang: TStringField;
    temp_masukjumlah: TIntegerField;
    DataSource1: TDataSource;
    mySQLQuery1: TmySQLQuery;
    mySQLQuery2: TmySQLQuery;
    mySQLQuery3: TmySQLQuery;
    temp_masukharga: TIntegerField;
    Label5: TLabel;
    EditHarga: TEdit;
    Panel1: TPanel;
    Button1: TButton;
    Label6: TLabel;
    EditSatuan: TEdit;
    temp_masukstok: TIntegerField;
    Edit1: TEdit;
    GroupBox3: TGroupBox;
    ButtonSimpan: TButton;
    ButtonBatal: TButton;
    ButtonKeluar: TButton;
    Bevel1: TBevel;
    Label7: TLabel;
    Bevel2: TBevel;
    Label12: TLabel;
    Panel2: TPanel;
    Label1: TLabel;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ButtonKeluarClick(Sender: TObject);
    procedure ComboBoxBarangDropDown(Sender: TObject);
    procedure ComboBoxBarangChange(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure ButtonSimpanClick(Sender: TObject);
    procedure ButtonBatalClick(Sender: TObject);
    procedure Label12Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Formbarangmasuk: TFormbarangmasuk;
implementation
   uses UnitUtama, UnitMenuLaporan;
{$R *.dfm}
procedure TFormbarangmasuk.Timer1Timer(Sender: TObject);
begin
Label4.Caption :=TimeToStr(now);
end;
procedure TFormbarangmasuk.FormCreate(Sender: TObject);
begin
mySQLQuery1.Close;mySQLQuery1.SQL.Clear;
mySQLQuery1.SQL.Add('delete from temp_masuk');mySQLQuery1.ExecSQL;
temp_masuk.Open;
TabelBarang.Open;
EditNoNota.Clear;
ComboBoxBarang.Clear;
EditNmBarang.Clear;
Editstok.Clear;
EditJumlah.Clear;
EditHarga.Clear;
EditSatuan.Clear;
FormUtama.tabelbarangmasuk.Open;
FormUtama.tabelbarangmasuk.Active;
FormUtama.tabelbarangmasuk.Active := True;
FormUtama.tabelbarangmasuk.Refresh
end;
procedure TFormbarangmasuk.ButtonKeluarClick(Sender: TObject);
begin
Close;
end;
procedure TFormbarangmasuk.ComboBoxBarangDropDown(Sender: TObject);
begin
TabelBarang.Refresh;
TabelBarang.First;
ComboBoxBarang.Clear;
while not TabelBarang.Eof do
begin
ComboBoxBarang.Items.Add(TabelBarang.FieldByName('id_barang').AsString);
TabelBarang.Next;
end;
end;
procedure TFormbarangmasuk.ComboBoxBarangChange(Sender: TObject);
var hasillist : string;
begin
  hasillist := ComboBoxBarang.Items[ComboBoxBarang.ItemIndex];
  if TabelBarang.FindKey([hasillist]) then
  begin
  EditNmBarang.Text := TabelBarang.fieldbyname('nm_barang').AsString;
  Editstok.Text := TabelBarang.fieldbyname('stok').AsString;
  end;
end;
procedure TFormbarangmasuk.Button1Click(Sender: TObject);
var stoklama, jumlahmasuk, hasil : integer;
begin
stoklama := StrToInt(Editstok.Text);
jumlahmasuk := StrToInt(EditJumlah.Text);
  hasil := stoklama + jumlahmasuk;
temp_masuk.Insert;
temp_masuk.FieldByName('id_barang').AsString:=ComboBoxBarang.Text;
temp_masuk.FieldByName('nm_barang').AsString:=EditNmBarang.Text;
temp_masuk.FieldByName('harga').AsString:=EditHarga.Text;
temp_masuk.FieldByName('jumlah').AsString:=EditJumlah.Text;
temp_masuk.FieldByName('stok').AsString := FloatToStr(hasil);
temp_masuk.Post;
end;
procedure TFormbarangmasuk.ButtonSimpanClick(Sender: TObject);
begin
  if ComboBoxBarang.Text = '' then
  begin
  Application.MessageBox('ID Barang Kosong','PERINGATAN',
  MB_OK + MB_ICONERROR);
  Exit;
  end;
  if EditNoNota.Text = '' then
  begin
  Application.MessageBox('Nomer Nota Kosong','PERINGATAN',
  MB_OK + MB_ICONERROR);
  Exit;
  end;
  FormUtama.tabelbarangmasuk.Append;
  FormUtama.tabelbarangmasuk.FieldByName('no_nota').AsString := EditNoNota.Text;
  FormUtama.tabelbarangmasuk.FieldByName('tgl_nota').AsDateTime := DateTimePicker1.Date;
  FormUtama.tabelbarangmasuk.Post;
mySQLQuery2.Close;mySQLQuery2.SQL.Clear;mySQLQuery2.SQL.Add('select * from temp_masuk');mySQLQuery2.Open;
while not mySQLQuery2.Eof do
begin
mySQLQuery3.Close;mySQLQuery3.SQL.Clear;mySQLQuery3.SQL.Add('insert into detail_masuk values("'+EditNoNota.Text+'","'+mySQLQuery2.FieldByName('id_barang').AsString+'", ' +
'"'+mySQLQuery2.FieldByName('harga').AsString+'","'+mySQLQuery2.FieldByName('jumlah').AsString+'")');mySQLQuery3.ExecSQL;
mySQLQuery2.Next;
  end;
  FormCreate(Sender);
end;
procedure TFormbarangmasuk.ButtonBatalClick(Sender: TObject);
begin
EditNoNota.Clear;
end;
procedure TFormbarangmasuk.Label12Click(Sender: TObject);
begin
FormAboutMe.ShowModal;
end;
end.



·         Farm Barang habis

unit UnitDataKeluar;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, ExtCtrls, ComCtrls, StdCtrls, Grids, DBGrids, mySQLDbTables;
type
  TFormDataKeluar = class(TForm)
    Label1: TLabel;
    Timer1: TTimer;
    DataSource1: TDataSource;
    TabelBarang: TmySQLTable;
    GroupBox1: TGroupBox;
    Label4: TLabel;
    ComboBoxBarang: TComboBox;
    Label6: TLabel;
    EditNmBarang: TEdit;
    GroupBox2: TGroupBox;
    Label2: TLabel;
    Label3: TLabel;
    Editidhabis: TEdit;
    DateTimePicker1: TDateTimePicker;
    Label7: TLabel;
    Editstok: TEdit;
    EditJumlah: TEdit;
    Label5: TLabel;
    DBGrid1: TDBGrid;
    DataSource2: TDataSource;
    mySQLTable1: TmySQLTable;
    mySQLTable2: TmySQLTable;
    mySQLQuery1: TmySQLQuery;
    mySQLQuery2: TmySQLQuery;
    mySQLQuery3: TmySQLQuery;
    EditSatuan: TEdit;
    Label8: TLabel;
    mySQLTable1id_barang: TStringField;
    mySQLTable1nm_barang: TStringField;
    mySQLTable1jumlah: TIntegerField;
    mySQLTable2id_habis: TStringField;
    mySQLTable2id_barang: TStringField;
    mySQLTable2jumlah: TIntegerField;
    TabelBarangid_barang: TStringField;
    TabelBarangnm_barang: TStringField;
    TabelBarangid_kriteria: TStringField;
    TabelBarangstok: TIntegerField;
    TabelBarangsatuan: TStringField;
    Panel1: TPanel;
    ButtonSimpan: TButton;
    ButtonBatal: TButton;
    Button3: TButton;
    Panel2: TPanel;
    Button1: TButton;
    mySQLTable1stok: TIntegerField;
    procedure FormCreate(Sender: TObject);
    procedure ButtonSimpanClick(Sender: TObject);
    procedure ComboBoxBarangDropDown(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure ComboBoxBarangChange(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  FormDataKeluar: TFormDataKeluar;
implementation
     uses UnitUtama, UnitMenuLaporan;
{$R *.dfm}
procedure TFormDataKeluar.FormCreate(Sender: TObject);
begin
mySQLQuery1.Close;mySQLQuery1.SQL.Clear;
mySQLQuery1.SQL.Add('delete from temp_habis');mySQLQuery1.ExecSQL;
mySQLTable1.Open;mySQLTable1.Refresh;mySQLTable2.Open;
TabelBarang.Open;
ComboBoxBarang.Clear;
EditJumlah.Clear;
Editstok.Clear;
EditSatuan.Clear;
EditNmBarang.Clear;
FormUtama.TabelHabis.Open;
FormUtama.TabelHabis.Active;
FormUtama.TabelHabis.Active := True;
FormUtama.TabelHabis.Refresh;
if FormUtama.TabelHabis.Bof then
Editidhabis.Text :='00001'
 else
 begin
 FormUtama.TabelHabis.Last;
 Editidhabis.Text := FormatFloat('00000',FormUtama.TabelHabis.FieldByName('id_habis').AsInteger+1)
 end;
end;
procedure TFormDataKeluar.ButtonSimpanClick(Sender: TObject);
begin
  FormUtama.TabelHabis.Append;
  FormUtama.TabelHabis.FieldByName('id_habis').AsString := Editidhabis.Text;
  FormUtama.TabelHabis.FieldByName('tgl_abis').AsDateTime := DateTimePicker1.Date;
  FormUtama.TabelHabis.Post;
  mySQLQuery2.Close;mySQLQuery2.SQL.Clear;mySQLQuery2.SQL.Add('select * from temp_habis');mySQLQuery2.Open;
  while not mySQLQuery2.Eof do
  begin
    mySQLQuery3.Close;mySQLQuery3.SQL.Clear;mySQLQuery3.SQL.Add('insert into detail_habis values("'+Editidhabis.Text+'","'+mySQLQuery2.FieldByName('id_barang').AsString+'", ' +
    '"'+mySQLQuery2.FieldByName('jumlah').AsString+'")');mySQLQuery3.ExecSQL;
    mySQLQuery2.Next;
  end;
  FormCreate(Sender);
end;
procedure TFormDataKeluar.ComboBoxBarangDropDown(Sender: TObject);
begin
TabelBarang.Refresh;
TabelBarang.First;
ComboBoxBarang.Clear;
while not TabelBarang.Eof do
begin
ComboBoxBarang.Items.Add(TabelBarang.FieldByName('id_barang').AsString);
TabelBarang.Next;
end;
end;
procedure TFormDataKeluar.Button3Click(Sender: TObject);
begin
Close;
end;
procedure TFormDataKeluar.ComboBoxBarangChange(Sender: TObject);
var hasillist : string;
begin
  hasillist := ComboBoxBarang.Items[ComboBoxBarang.ItemIndex];
  if TabelBarang.FindKey([hasillist]) then
  begin
  EditNmBarang.Text := TabelBarang.fieldbyname('nm_barang').AsString;
  Editstok.Text := TabelBarang.fieldbyname('stok').AsString;
  EditSatuan.Text := TabelBarang.fieldbyname('satuan').AsString;
  end;
end;
procedure TFormDataKeluar.Button1Click(Sender: TObject);
var stoklama, jumlahkeluar, hasil : Integer;
begin
stoklama := StrToInt(Editstok.Text);
jumlahkeluar := StrToInt(EditJumlah.Text);
hasil := stoklama - jumlahkeluar;
mySQLTable1.Insert;
mySQLTable1.FieldByName('id_barang').AsString:=ComboBoxBarang.Text;
mySQLTable1.FieldByName('nm_barang').AsString:=EditNmBarang.Text;
mySQLTable1.FieldByName('jumlah').AsString:=EditJumlah.Text;
mySQLTable1.FieldByName('stok').AsString := FloatToStr(hasil);
//mySQLTable1.FieldByName('satuan').AsString:=EditSatuan.Text;
mySQLTable1.Post;
ComboBoxBarang.Clear;
EditJumlah.Clear;
Editstok.Clear;
EditNmBarang.Clear;
end;
end.

·         Form Laporan Kriteria

unit UnitLaporanPerKriteria;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, QRCtrls, jpeg, QuickRpt, ExtCtrls, DB, mySQLDbTables;
type
  TFormLaporanPerKriteria = class(TForm)
    QuickRep1: TQuickRep;
    PageHeaderBand1: TQRBand;
    TitleBand1: TQRBand;
    ColumnHeaderBand1: TQRBand;
    DetailBand1: TQRBand;
    PageFooterBand1: TQRBand;
    QRImage1: TQRImage;
    QRLabel1: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel3: TQRLabel;
    QRLabel4: TQRLabel;
    mySQLTable1: TmySQLTable;
    mySQLTable1id_kriteria: TStringField;
    mySQLTable1nm_kriteria: TStringField;
    QRShape1: TQRShape;
    QRLabel5: TQRLabel;
    QRShape2: TQRShape;
    QRLabel6: TQRLabel;
    QRShape3: TQRShape;
    QRDBText1: TQRDBText;
    QRShape4: TQRShape;
    QRDBText2: TQRDBText;
    QRLabel7: TQRLabel;
    procedure QuickRep1BeforePrint(Sender: TCustomQuickRep;
      var PrintReport: Boolean);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  FormLaporanPerKriteria: TFormLaporanPerKriteria;
implementation
  uses UnitUtama;
{$R *.dfm}
procedure TFormLaporanPerKriteria.QuickRep1BeforePrint(
  Sender: TCustomQuickRep; var PrintReport: Boolean);
begin
mySQLTable1.Close;
mySQLTable1.Open;
end;
procedure TFormLaporanPerKriteria.FormCreate(Sender: TObject);
begin
end;
end.

·          Laporam Barang

unit UnitLaporanBarang;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, mySQLDbTables, ExtCtrls, QuickRpt, QRCtrls, jpeg;
type
  TFormSeluruhBarang = class(TForm)
    QuickRep1: TQuickRep;
    PageHeaderBand1: TQRBand;
    QRImage1: TQRImage;
    QRLabel1: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel3: TQRLabel;
    QRLabel7: TQRLabel;
    TitleBand1: TQRBand;
    QRLabel4: TQRLabel;
    ColumnHeaderBand1: TQRBand;
    DetailBand1: TQRBand;
    PageFooterBand1: TQRBand;
    mySQLQuery1: TmySQLQuery;
    mySQLQuery1id_barang: TStringField;
    mySQLQuery1nm_barang: TStringField;
    mySQLQuery1id_kriteria: TStringField;
    mySQLQuery1stok: TIntegerField;
    mySQLQuery1nm_kriteria: TStringField;
    mySQLQuery1satuan: TStringField;
    QRShape1: TQRShape;
    QRLabel5: TQRLabel;
    QRShape2: TQRShape;
    QRDBText1: TQRDBText;
    QRShape3: TQRShape;
    QRLabel6: TQRLabel;
    QRShape4: TQRShape;
    QRDBText2: TQRDBText;
    QRShape5: TQRShape;
    QRLabel8: TQRLabel;
    QRShape6: TQRShape;
    QRDBText3: TQRDBText;
    QRShape7: TQRShape;
    QRLabel10: TQRLabel;
    QRShape8: TQRShape;
    QRShape9: TQRShape;
    QRLabel9: TQRLabel;
    QRShape10: TQRShape;
    QRDBText4: TQRDBText;
    QRDBText5: TQRDBText;
    procedure QuickRep1BeforePrint(Sender: TCustomQuickRep;
      var PrintReport: Boolean);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  FormSeluruhBarang: TFormSeluruhBarang;
implementation
        uses UnitUtama;
{$R *.dfm}
procedure TFormSeluruhBarang.QuickRep1BeforePrint(Sender: TCustomQuickRep;
  var PrintReport: Boolean);
begin
mySQLQuery1.Close;
mySQLQuery1.Open;
end;
procedure TFormSeluruhBarang.FormCreate(Sender: TObject);
begin
end;
end.

·          Laporan Barang Masuk

unit UnitLaporanBarangMasuk;

interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, mySQLDbTables, QRCtrls, jpeg, QuickRpt, ExtCtrls;
type
  TFormLaporanBarangMasuk = class(TForm)
    QuickRep1: TQuickRep;
    PageHeaderBand1: TQRBand;
    QRImage1: TQRImage;
    QRLabel1: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel3: TQRLabel;
    QRLabel7: TQRLabel;
    TitleBand1: TQRBand;
    QRLabel4: TQRLabel;
    ColumnHeaderBand1: TQRBand;
    QRShape2: TQRShape;
    QRShape5: TQRShape;
    QRShape6: TQRShape;
    QRShape7: TQRShape;
    QRLabel5: TQRLabel;
    QRLabel6: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel9: TQRLabel;
    DetailBand1: TQRBand;
    QRShape4: TQRShape;
    QRShape8: TQRShape;
    QRShape9: TQRShape;
    QRShape10: TQRShape;
    QRDBText1: TQRDBText;
    QRDBText2: TQRDBText;
    QRDBText3: TQRDBText;
    QRDBText4: TQRDBText;
    PageFooterBand1: TQRBand;
    mySQLQuery1: TmySQLQuery;
    QRShape1: TQRShape;
    STOK: TQRShape;
    QRShape11: TQRShape;
    QRLabel10: TQRLabel;
    QRLabel11: TQRLabel;
    QRLabel12: TQRLabel;
    QRShape3: TQRShape;
    QRLabel13: TQRLabel;
    QRShape12: TQRShape;
    QRShape14: TQRShape;
    QRShape15: TQRShape;
    QRDBText5: TQRDBText;
    QRDBText6: TQRDBText;
    QRDBText7: TQRDBText;
    QRDBText8: TQRDBText;
    procedure QuickRep1BeforePrint(Sender: TCustomQuickRep;
      var PrintReport: Boolean);
QRShape13: TQRShape;
   
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  FormLaporanBarangMasuk: TFormLaporanBarangMasuk;
implementation
     uses UnitUtama;
{$R *.dfm}
procedure TFormLaporanBarangMasuk.QuickRep1BeforePrint(
  Sender: TCustomQuickRep; var PrintReport: Boolean);
begin
mySQLQuery1.Close;
mySQLQuery1.Open;
end;
procedure TFormLaporanBarangMasuk.FormCreate(Sender: TObject);
begin
end;
end.

·          Form About Me

unit UnitMenuLaporan;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, jpeg, ExtCtrls, StdCtrls;
type
  TFormAboutMe = class(TForm)
    Label1: TLabel;
    Memo1: TMemo;
    Image1: TImage;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  FormAboutMe: TFormAboutMe;
implementation
     uses UnitUtama;
{$R *.dfm}
procedure TFormAboutMe.FormCreate(Sender: TObject);
begin
end;
end.

Related Posts

Posting Komentar