0% found this document useful (0 votes)
8 views3 pages

Master Data Input Script for Inventory

This document contains the script code for a desktop application to manage inventory using FoxPro. The script defines forms, fields, and procedures to: 1. Initialize the application by opening two tables (Items and Sales) and setting properties. 2. Populate form fields from the Items table when a product is selected. 3. Validate and save new sales records, decrementing the item stock quantity. 4. Include navigation buttons to move between records. The application allows users to view, add, edit and delete inventory sale transactions by linking the Items and Sales tables. Procedures are defined for form loading, field population, data entry validation and record saving.

Uploaded by

Entot Suhartono
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Master Data Input Script for Inventory

This document contains the script code for a desktop application to manage inventory using FoxPro. The script defines forms, fields, and procedures to: 1. Initialize the application by opening two tables (Items and Sales) and setting properties. 2. Populate form fields from the Items table when a product is selected. 3. Validate and save new sales records, decrementing the item stock quantity. 4. Include navigation buttons to move between records. The application allows users to view, add, edit and delete inventory sale transactions by linking the Items and Sales tables. Procedures are defined for form loading, field population, data entry validation and record saving.

Uploaded by

Entot Suhartono
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SCRIPT INPUT DATA MASTER BARANG

Object : Form1

Procedure : Activate

*// Menghapus semua tabel dan database aktif


[Link]

Object : Form1

Procedure : Init

*// Setting Awal program


[Link] = DATE() & mengaktifkan tanggal

Object : Form1

Procedure : Load

*// Mengaktifkan tabel barang dan indeks kode


SET PATH TO "Lokasi folder kerja"
SET DEFAULT TO " Lokasi folder kerja"
SET DATE BRITISH
SET TALK OFF
SET DELETED ON
CLOSE TABLES
CLOSE DATABASES
USE TbBarang
SET ORDER TO kode
PUBLIC Tambah
Tambah = 0

Object : Form1

Procedure: aktif

Object : Form1

Procedure: nonaktif

*// Mengaktifkan semua object textbox & combo


[Link]("enabled",.t.,"textbox")
[Link] = .t.

*// Menonaktifkan semua object textbox & combo


[Link]("enabled",.f.,"textbox")
[Link] = .t.

Object : Form1

Object : Form1

Procedure: kosong

[Link] = ""
[Link] = DATE()
[Link] = ""
[Link] = 0
[Link] = 0
[Link] = 0
[Link] = ""

Object : Command1 (First)

Script Tombol Navigasi dan Operasi Data Record


Procedure: Click
Object : Command4 (Last)

*// Tombol First


GOTO top
[Link]

Object : Command2 (Prev)

Procedure: Click

*// Tombol Last


GOTO Bottom
[Link]

Procedure: Click

*// Tombol Previous


IF BOF() then
GOTO Bottom
ELSE
SKIP -1
ENDIF
[Link]

Object : Command5 (Add)

Procedure: viewdata

[Link] = kode
[Link] = nama
[Link] = Hrgsatuan
[Link] = satuan
[Link] = stok
[Link] = hrgjual
[Link]

Object : Command3 (Next)

Procedure: Click

*// Tombol Next


IF EOF() then
GOTO Top
ELSE
SKIP 1
ENDIF
[Link]

Procedure: Click

Object : Command6 (Edit) Procedure: Click

*// Tombol Add (tambah data)


Tambah = 0
[Link]
[Link]
[Link]

*// Tombol Edit data


Tambah = 1
[Link]
[Link]

Object : Command7 (Del)

Object : Command8 (Save)

Procedure: Click

*// Tombol Delete Data (hapus data record)


SET DELETED ON
DELETE
[Link]
[Link]
[Link]

*// perintah pack disimpan di tombol


Keluar sebelum [Link]()

Procedure: Click

*// Tombol Save (Simpan Data)


IF tambah = 0 THEN
GOTO bottom
APPEND BLANK
ENDIF
replace kode WITH [Link]
replace nama WITH [Link]
replace satuan WITH [Link]
replace hrgsatuan WITH [Link]
replace hrgjual WITH [Link]
replace stok WITH [Link]
[Link]()
[Link]
[Link]

Projek Inventori
Tabel : [Link]
No Nama Field Type
kode
Text/5
nama
Text/25
satuan
Text/5
hrgsatuan Num/14
hrgjual
Num/14
stok
Num/4

Keterangan
Indeks ascending
(Unit, Box, Lusin, Gross)
Harga beli
30% dari hrgsatuan
Minimal 5

Tabel : [Link]
No Nama Field Type
notrans
Text/5
tanggal
Date/8
kdbarang
Text/5
Jmlbeli
Num/4
totaljual
Num/14
customer
Text/20

Keterangan
Indeks ascending
Tanggal Transaksi
Kode barang
Jumlah pembelian barang
Total penjualan
Nama Customer

Tabel : [Link]
No Nama Field Type
Nofaktur
Text/5
tanggal
Date/8
kdbarang
Text/5
JmlJual
Num/4
totalbeli
Num/14
supplier
Text/20

Keterangan
Indeks ascending
Tanggal Transaksi
Kode barang
Jumlah pembelian barang
Total penjualan
Nama Customer

SCRIPT INPUT TRANSAKSI DATA BARANG KELUAR


Object : Form1
*//
*//
SET
SET

Procedure : Load

mengaktifkan 2 tabel (TbBarang dan TBKeluar)


Mengaktifkan tabel barang dan indeks kode
PATH TO "Lokasi folder kerja"
DEFAULT TO " Lokasi folder kerja"

CLOSE TABLES
CLOSE DATABASES
SELECT 1
USE TbBarang
SET ORDER TO kode
SELECT 2
USE TbKeluar
SET ORDER TO NOTRANS

Object : Form1

&& NOTRANS

Procedure : Active/Init/aktif/nonaktif

Idem dengan data master

Object : Combo1

Procedure: InteractiveChange

*// menampilkan master data barang


SELECT 1
CARI = ALLTRIM([Link])
SEEK cari
IF FOUND()
[Link] = nama
[Link] = hrgjual
[Link] = stok
ENDIF
[Link]
SELECT 2

Object : Text1

Object : Form1

Script Tombol Navigasi dan Operasi Data Record


Procedure: LostFocus
Object : Command.. (Save)

*//Deteksi data no. faktur kembar


cari = ALLTRIM([Link])
SELECT 2
SEEK cari
IF FOUND()
MESSAGEBOX("No. Faktur " + cari + " sudah ada",16,
"Konfirmasi")
[Link] =""
ENDIF
[Link]

Procedure: viewdata

SELECT 2
[Link] = notrans
[Link] = DTOC(tanggal)
[Link] = kdbarang
[Link] = jmlbeli
[Link] = totaljual
[Link] = customer
*// Menampilkan master data barang
SELECT 1
CARI = ALLTRIM([Link])
SEEK cari
IF FOUND()
[Link] = nama
[Link] = hrgjual
ENDIF
[Link]
SELECT 2

Procedure: Click

*// Tombol SAVE


IF tambah = 0 THEN
GOTO bottom
SELECT 2
APPEND BLANK
ENDIF
replace notrans WITH [Link]
replace tanggal WITH [Link]
replace kdbarang WITH [Link]
replace jmlbeli WITH [Link]
replace totaljual WITH [Link]
replace customer WITH [Link]
*// Mengurangi stok barang
SELECT 1
replace stok WITH stok - [Link]
SELECT 2
[Link]()
[Link]
[Link]

Script Tombol Navigasi dan Operasi Data Record lainnya idem dengan aplikasi sebelumnya

You might also like