Skip to main content

Realy Simple Point of Sale Program with QBASIC



Hi guys,

This is maybe the simplest Point of Sale ever. This code i made to complete my home work even my studying at Nahdlatul Ulama University. Built on top of QBASIC programming language, the very old programming language, but i think this language is effective to learn basic programming. Because all programming language has same characteristics.

So, guys, this is the code:
’’ —————————————————————————-
’’ PROGRAM KASIR SEDERHANA
’’ QBASIC
’’ —————————————————————————-

’’ Clear Screen
CLS

’’
’’ Deklarasi Variable
’’
DIM TRANSAKSI%(100)
DIM PRODUK%(5)

TOTALHARGA& = 0
TOTALITEM% = 0

’’ Data Produk
PRODUK%(1) = 1000
PRODUK%(2) = 1100
PRODUK%(3) = 1200
PRODUK%(4) = 1300
PRODUK%(5) = 1400

’’ Main Menu
1 CLS
 PRINT “Menu:”
 PRINT “1. Produk”
 PRINT “2. Laporan”
 PRINT “3. Transaksi”
 PRINT “4. Keluar”

 INPUT “Pilih Menu:”, menu

 SELECT CASE menu
  CASE 1
   GOTO 10
  
  CASE 2
   GOTO 20

  CASE 3
   GOTO 30
  
  CASE 4
   END

 END SELECT
’’ Data produk
10 CLS
 PRINT “—————————————————“
 PRINT “ DATA PRODUK
 PRINT “—————————————————“

 FOR I = 1 TO 5
  PRINT “KODE: “; I, “HARGA: “; PRODUK%(I)
 NEXT I

 PRINT “”
 PRINT “Menu:”
 PRINT “1. Kembali”
 PRINT “4. Keluar”

 INPUT “Pilih Menu: “, menu

 SELECT CASE menu
  CASE 1
   GOTO 1
  CASE 4
   END
  CASE ELSE
   GOTO 10
 END SELECT

’’ Laporan Transaksi
20 CLS
 PRINT “—————————————————“
 PRINT “ LAPORAN
 PRINT “—————————————————“
 PRINT “”
 PRINT “TOTAL Penjualan: ”, TOTALITEM%, “ ITEM”
 PRINT “TOTAL Pendapatan: ”, TOTALHARGA&
 PRINT “”
 PRINT “”

 PRINT “Menu:”
 PRINT “1. Kembali”
 PRINT “4. Keluar”
 INPUT “Pilih Menu: ”, menu

 SELECT CASE menu
  CASE 1
   GOTO 1
  CASE 4
   END
  CASE ELSE
   GOTO 20
 END SELECT

’’ Proses Transaksi
30  CLS
 PRINT ““
 PRINT “    TRANSAKSI
 PRINT “=======================================“
 PRINT “KODE PRODUK    HARGA”
 PRINT “=======================================”
 
 FOR I = 0 TO TOTALITEM% 
  IF I > 0 THEN
   PRINT TRANSAKSI%(I),”  ”, PRODUK%(TRANSAKSI%(I))
  END IF
 NEXT I

 PRINT “=======================================“
 PRINT “   TOTAL HARGA :”; TOTALHARGA&
 PRINT “=======================================”
 PRINT “”
 
 PRINT “Menu:”
 PRINT “0.  Menu utama”
 PRINT “9.  Keluar”
 PRINT “1-5 (Kode Produk)”
 INPUT “Masukkan Kode Menu / Kode Produkt:”, kode%

 SELECT CASE kode%
  CASE 0
   GOTO 1
  CASE 9
   END
  CASE 1 TO 5
   TOTALITEM% = TOTALITEM% + 1
   TRANSAKSI%(TOTALITEM%) = kode%
   TOTALHARGA& = TOTALHARGA& + PRODUK%(kode%)
   GOTO 30
  CASE ELSE
   GOTO 30
 END SELECT
“================================“
“  SELESAI    “
“================================“

If you get something errors with these code, please leave a comment.

Comments

Popular posts from this blog

Install npm packages globally without root access

Image from nodejsblog.com NPM packages can be installed locally under your home directory. With local installation you won't get error permissions while youre trying to install global npm packages. Let's make your computer can run "npm install -g" without root access. First, create npm packages directory mkdir -p ~/.npm-packages Add NPM_PACKAGES variable on your .bashrc file echo NPM_PACKAGES="${HOME}/.npm-packages" >> ${HOME}/.bashrc Add prefix to your npm configuration echo prefix=${HOME}/.npm-packages >> ${HOME}/.npmrc Install latest npm curl -L https://www.npmjs.org/install.sh | sh Add NODE_PATH variable to your .bashrc file echo NODE_PATH=\"\$NPM_PACKAGES/lib/node_modules\:\$NODE_PATH\" >> ${HOME}/.bashrc Update PATH variable echo PATH=\"\$NPM_PACKAGES/bin\:\$PATH\" >> ${HOME}/.bashrc Reload your environment variable source ~/.bashrc Now you can install global npm package...

How to use multiple PHP Version on Ubuntu 16.04

Ubuntu 16.04 came with PHP 7.0 packages. Sometimes we need to use older version of PHP. Bellow is the easiest way to get multiple versions of PHP on your Ubuntu PC's. First, you need to add my PPA repository. Open terminal and execute the following commands: sudo add-apt-repository ppa:agungwidodo/tphp Update your apt cache sudo apt update Finally, install tphp packages sudo apt install tphp After installation you will get application called PHP Switcher. Use these apps to switch your PHP version. This apps using PHP as CLI not as CGI, so you cant run multiple PHP version at same times. Plese leave a comment if you have any issues.