Friday, September 1, 2017

Download Source Code Stock Barang Sederhana

Biasakan  membaca dahulu

Selamat siang sob, kali  ini saya akan mengulas source code aplikasi stok barang, dari pada ga di pake, program ini saya buat saat kuliah dulu, program ini sangat sederhana banget, yang pasti sudah bisa mengurangi dan menambah stok secara otomatis,  Souce code ini hanya buat pembelajaran saja, tidak untuk dijual hanya saya minta share dan like fans page saya lebih baik berkomentar..

Download Source Code Stock Barang Sederhana

Silahkan diambil sesuka anda


Database

-- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 02, 2017 at 05:34 AM
-- Server version: 10.1.25-MariaDB
-- PHP Version: 7.1.7

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `kws`
--

-- --------------------------------------------------------

--
-- Table structure for table `admin`
--

CREATE TABLE `admin` (
`id` int(11) NOT NULL,
`username` varchar(20) NOT NULL,
`password` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `admin`
--

INSERT INTO `admin` (`id`, `username`, `password`) VALUES
(1, 'admin', 'admin');

-- --------------------------------------------------------

--
-- Table structure for table `barang_in`
--

CREATE TABLE `barang_in` (
`id_masuk` int(11) NOT NULL,
`id_barang` varchar(11) NOT NULL,
`kode_barang` varchar(11) NOT NULL,
`kategori` varchar(50) NOT NULL,
`nama_barang` varchar(50) NOT NULL,
`jumlah` int(11) NOT NULL,
`satuan` varchar(11) NOT NULL,
`tgl` datetime NOT NULL,
`location` varchar(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `barang_in`
--

INSERT INTO `barang_in` (`id_masuk`, `id_barang`, `kode_barang`, `kategori`, `nama_barang`, `jumlah`, `satuan`, `tgl`, `location`) VALUES
(1, '1', 'K-18', 'Karton', 'Karton K-18', 1000, 'Pcs', '2016-12-12 01:20:09', 'AS'),
(2, '1', 'K-18', 'Karton', 'Karton K-18', 890, 'Pcs', '2016-12-12 01:20:55', 'HJ'),
(3, '4', 'BK', 'Reports', 'Surat Jalan Manual', 200, 'Pcs', '2016-12-12 11:27:57', 'DF'),
(4, '5', 'SPD', 'ATK', 'Sepidol', 1000, 'Pcs', '2016-12-17 16:32:42', 'AA'),
(5, '1', 'K-18', 'Karton', 'Karton K-18', 56, 'Pcs', '2016-12-17 23:34:42', 'FD'),
(6, '2', 'LM', 'Lem', 'Lem Fox', 100, 'Kaleng', '2016-12-19 21:02:27', 'GG');

--
-- Triggers `barang_in`
--
DELIMITER $$
CREATE TRIGGER `barang_masuk` BEFORE INSERT ON `barang_in` FOR EACH ROW BEGIN
UPDATE stock SET stok=stok+NEW.jumlah
WHERE id_barang=NEW.id_barang;
END
$$
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `barang_out`
--

CREATE TABLE `barang_out` (
`id_keluar` int(11) NOT NULL,
`id_barang` varchar(11) NOT NULL,
`kode_barang` varchar(11) NOT NULL,
`kategori` varchar(50) NOT NULL,
`nama_barang` varchar(50) NOT NULL,
`jumlah` int(11) NOT NULL,
`satuan` varchar(11) NOT NULL,
`tgl` datetime NOT NULL,
`location` varchar(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `barang_out`
--

INSERT INTO `barang_out` (`id_keluar`, `id_barang`, `kode_barang`, `kategori`, `nama_barang`, `jumlah`, `satuan`, `tgl`, `location`) VALUES
(1, '1', 'K-18', 'Karton', 'Karton K-18', 890, 'Pcs', '2016-12-12 01:21:21', ''),
(2, '2', 'LM', 'Lem', 'Lem Fox', 7, 'Kaleng', '2016-12-12 01:23:08', ''),
(3, '5', 'SPD', 'ATK', 'Sepidol', 12, 'Pcs', '2016-12-12 11:38:02', ''),
(4, '5', 'SPD', 'ATK', 'Sepidol', 500, 'Pcs', '2016-12-17 16:33:10', ''),
(5, '5', 'SPD', 'ATK', 'Sepidol', 1, 'Pcs', '2016-12-17 16:33:41', '');

--
-- Triggers `barang_out`
--
DELIMITER $$
CREATE TRIGGER `barang_keluar` BEFORE INSERT ON `barang_out` FOR EACH ROW BEGIN
UPDATE stock SET stok=stok-NEW.jumlah
WHERE id_barang=NEW.id_barang;
END
$$
DELIMITER ;

-- --------------------------------------------------------

--
-- Table structure for table `stock`
--

CREATE TABLE `stock` (
`id_stock` int(11) NOT NULL,
`id_barang` int(11) NOT NULL,
`kd_barang` varchar(11) NOT NULL,
`nama_barang` varchar(50) NOT NULL,
`kategori` varchar(50) NOT NULL,
`stok` int(11) NOT NULL,
`satuan` varchar(11) NOT NULL,
`location` varchar(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `stock`
--

INSERT INTO `stock` (`id_stock`, `id_barang`, `kd_barang`, `nama_barang`, `kategori`, `stok`, `satuan`, `location`) VALUES
(1, 1, 'K-18', 'Karton K-18', 'Karton', 2056, 'Pcs', 'AB'),
(2, 2, 'LM', 'Lem Fox', 'Lem', 105, 'Kaleng', 'BF'),
(3, 3, 'K-104', 'Karton K-106', 'Karton', 7000, 'Pcs', 'G'),
(4, 4, 'BK', 'Surat Jalan Manual', 'Reports', 434, 'Pcs', 'DF'),
(5, 5, 'SPD', 'Sepidol', 'ATK', 499, 'Pcs', '21');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`id`);

--
-- Indexes for table `barang_in`
--
ALTER TABLE `barang_in`
ADD PRIMARY KEY (`id_masuk`);

--
-- Indexes for table `barang_out`
--
ALTER TABLE `barang_out`
ADD PRIMARY KEY (`id_keluar`);

--
-- Indexes for table `stock`
--
ALTER TABLE `stock`
ADD PRIMARY KEY (`id_stock`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `admin`
--
ALTER TABLE `admin`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `barang_in`
--
ALTER TABLE `barang_in`
MODIFY `id_masuk` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `barang_out`
--
ALTER TABLE `barang_out`
MODIFY `id_keluar` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `stock`
--
ALTER TABLE `stock`
MODIFY `id_stock` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;COMMIT

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;





Mengukur Tingkat Kekuatan Password Dengan jQuery

Ini hanyalah tolok ukur untuk mengetahui seberapa besar kekuatan sandi anda untuk dibobol

Fitur utama

  • Menampilkan indikator kekuatan password dibawah textbox
  • Muncul pesan pendek, antara buruk sedang atau kuat
  • Muncul emotion yang menandakan kekuatan password
Mengukur Tingkat Kekuatan Password Dengan jQuery

Source Code Seperti dibawah ini
1. Includ Password strength meter javascript, file password.css dan password.js seperti ini

<script src="//code.jquery.com/jquery.min.js"></script>
<link rel="stylesheet" href="password.css">
<script src="password.js"></script>

2. Panggil fungsi password() dalam inputan
$('#YOUR-PASSWORD').password();

3. Config kekuatan password sebagai berikut
$('#password').password({

// custom messages
shortPass: 'The password is too short',
badPass: 'Weak; try combining letters & numbers',
goodPass: 'Medium; try using special charecters',
strongPass: 'Strong password',
containsUsername: 'The password contains the username',
enterPass: 'Type your password',

// show percent
showPercent: true,

// show text
showText: true,

// enable animation
animate: true,
animateSpeed: 'fast',

// link to username
username: false,
usernamePartialMatch: true,

// minimum length
minimumLength: 4

});

4. Costum password
$('#events').password().on('password.score', function (e, score) {
if (score > 75) {
$('#submit').removeAttr('disabled');
} else {
$('#submit').attr('disabled', true);
}
});

$('#events').on('password.text', (e, text, score) => {
console.log('Called every time the text is changed (less up<a href="http://www.jqueryscript.net/time-clock/">date</a>d than password.score)')
console.log('Current message is %s with a score of %d', text, score)
})


Download CRUD MySQLi dengan Modal dan Sweet Alert

CRUD merupakan Struktur inputan yang hampir 99% website menggunakan, semakin bertambahnya hari CRUD semakin berkembang mengikuti zaman, ada banyak macamnya untuk CRUD sendiri, misalkan PDO ataupun OOP, yang saya share disina CRUD yang sederhana yaitu mengunakan Mysqli, knapa? karena Msql sekarang sudah tidak mendukung jika masih menggunakan XAMPP versi lama.

Download CRUD MySQLi dengan Modal dan Sweet Alert

Source code ini saya rancang hanya dengan 2 file utama yaitu koneksi.php dan index.php selain itu ada beberapa file tambahan yang berupa jqueri dan css
seperti berikut untuk source codenya:

Koneksi.php
<?php
$mysqli = new mysqli("localhost", "root", "", "test");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: " . $mysqli->connect_error;
}
?>

Index.php
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="refresh" content="5; URL=javascript:window.open('http://blog.prehanto.com/','_blank');">
<title>blog.prehanto.com</title>
<link href="http://www.jqueryscript.net/css/jquerysctipttop.css" rel="stylesheet" type="text/css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="http://www.jqueryscript.net/css/jquerysctipttop.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Ubuntu+Condensed" rel="stylesheet">
<link rel="stylesheet" href="js/bootstrap.min.css">
<link rel="stylesheet" href="js/bootstrapValidator.css">
<link href="js/sweetalert.css" rel="stylesheet" type="text/css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<script src="js/jquery-2.1.3.min.js"></script>
<script src="js/sweetalert.min.js"></script>
<script src="js/sweetalert-dev.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrapValidator.js"></script>

<style type="text/css">
body { background-color:#fafafa;}
.container { margin:50px auto;}

.phAnimate {
position: relative;
padding-top: 20px;
margin-bottom: 10px;
}

.phAnimate input { padding-left: 15px; }

.phAnimate label {
cursor: text;
margin: 0;
padding: 0;
left: 15px;
top: 27px;
position: absolute;
font-size: 14px;
color: #ccc;
font-weight: normal;
transition: all 0.3s ease;
}

.phAnimate label.active {
top: 0;
left: 0;
font-size: 12px;
}
.sweet-alert{

position: fixed;
z-index: 999999;
}
.modal-content{
margin-top: 20%;
}
.judul{
font-family: 'Ubuntu Condensed', sans-serif;
font-size: 46px;
font-weight: 700;
}
.phAnimate label.active.focusIn { color: #66afe9; }
</style>
</head>

<body>
<div id="jquery-script-menu">
<div class="jquery-script-center">
<ul>
</ul>
<h1 class="judul">blog.prehanto.com</h1>
</div>
<div class="container">

<div class="page-header">
<h3>Data Siswa</h3>
</div>
<a href="#" class="btn btn-primary" data-target="#barang" data-toggle="modal"><i class="fa fa-user-plus" aria-hidden="true"></i> Add</a>
<br/>
<br/>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<td style="width: 70px; background-color: orange"><b>NIM</b></td>
<td style="width: 120px; background-color: orange"><b>Nama</b></td>
<td style="width: 140px; background-color: orange"><b>Alamat</b></td>
<td style="width: 80px; background-color: orange"><b>Email</b></td>
<td style="width: 30px; background-color: orange"><b>Aksi</b></td>
</tr>
</thead>
<?php
include "koneksi.php";
$res = $mysqli->query("SELECT * FROM siswa");
while ($data = $res->fetch_assoc()):
?>
<tbody>
<tr>

<td><?php echo $data['nim'] ?></td>
<td><?php echo $data['nama'] ?></td>
<td><?php echo $data['alamat'] ?></td>
<td><?php echo $data['email'] ?></td>
<td>

<a href="#" data-target="#open_modal" data-toggle="modal" class='btn btn-warning' id='<?php echo $data['id']; ?>'><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>
<a href="index.php?id=<?php echo $data['id'] ?>" class='btn btn-danger delete-link' ><i class="fa fa-trash-o" aria-hidden="true"></i>
</td>

</tr>
<?php
endwhile;
?>

</tbody>
</table>
<?php
include "koneksi.php";
if(isset($_GET['id'])):
$stmt = $mysqli->prepare("DELETE FROM siswa WHERE id=?");
$stmt->bind_param('s', $id);

$id = $_GET['id'];

if($stmt->execute()):
echo "<script>location.href='index.php'</script>";
else:
echo "<script>alert('".$stmt->error."')</script>";
endif;
endif;
?>

<div class="modal fade" id="barang" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Tambah Data Barang</h4>
</div>
<div class="modal-body">

<?php
include "koneksi.php";
if(isset($_POST['bts'])):
$stmt = $mysqli->prepare("INSERT INTO siswa(nim,nama,alamat,email) VALUES (?,?,?,?)");
$stmt->bind_param('ssss', $nim, $nama, $alamat, $email);

$nim = $_POST['nim'];
$nama = $_POST['nama'];
$alamat = $_POST['alamat'];
$email = $_POST['email'];

if($stmt->execute()):

echo "<script language='javascript'>swal('Selamat...', 'Data Berhasil di input!', 'success');</script>" ;
echo '<meta http-equiv="Refresh" content="3; URL=index.php">';
else:
echo "<script language='javascript'>swal('Oops...', 'Something went wrong!', 'error');</script>" ;
echo '<meta http-equiv="Refresh" content="2; URL=index.php">';
endif;
endif;
?>
<form action="index.php" class="form-horizontal" method="POST" id="form-save">
<div class="phAnimate">
<label for="firstname">NIM</label>
<input type="text" name="nim" class="form-control" id="firstname">
</div>
<div class="phAnimate">
<label for="lastname">Nama</label>
<input type="text" name="nama" class="form-control" id="lastname">
</div>
<div class="phAnimate">
<label for="password">Alamat</label>
<input type="text" name="alamat" class="form-control" id="password" placeholder="Alamat">
</div>
<div class="phAnimate">
<label>Email</label>
<input type="email" name="email" class="form-control" placeholder="email">
</div>

<input type="submit" class="btn btn-primary" name="bts" value="save">

</form>
</div>
</div>
</div>
</div>

<div class="modal fade" id="open_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Tambah</h4>
</div>
<div class="modal-body">
<?php
include "koneksi.php";
if(isset($_GET['id'])):
if(isset($_POST['bts'])):
$stmt = $mysqli->prepare("UPDATE siswa SET nim=?, nama=?, alamat=?, email=? WHERE id=?");
$stmt->bind_param('ssss', $nim, $nama, $alamat, $email, $id);

$nim = $_POST['nim'];
$nama = $_POST['nama'];
$alamat = $_POST['alamat'];
$email = $_POST['email'];
$id = $_POST['id'];

if($stmt->execute()):
echo "<script>location.href='index.php'</script>";
else:
echo "<script>alert('".$stmt->error."')</script>";
endif;
endif;
$res = $mysqli->query("SELECT * FROM siswa WHERE id=".$_GET['id']);
$row = $res->fetch_assoc();
endif;
?>

<form class="form-horizontal" method="POST" id="form-save">
<div class="phAnimate">
<label for="firstname">NIM</label>
<input type="hidden" value="<?php echo $data['id'] ?>" name="id"/>
<input type="text" value="<?php echo $data['nim'] ?>" name="nim" class="form-control" id="firstname">
</div>
<div class="phAnimate">
<label for="lastname">Nama</label>
<input type="text" value="<?php echo $data['nama'] ?>" name="nama" class="form-control" id="lastname">
</div>
<div class="phAnimate">
<label for="password">Alamat</label>
<input type="text" value="<?php echo $data['alamat'] ?>" name="alamat" class="form-control" id="password" placeholder="Alamat">
</div>
<div class="phAnimate">
<label>Email</label>
<input type="email" value="<?php echo $data['email'] ?>" name="email" class="form-control" placeholder="email">
</div>
<input type="submit" value="Update" class="btn btn-primary" name="bts" value="save">

</form>
</div>
</div>
</div>
</div>

</div>
<script type="text/javascript" src="//cdn.popcash.net/pop.js"></script>
<script src="http://code.jquery.com/jquery-3.0.0.min.js"></script>
<script src="js/phanimate.jquery.js"></script>
<script>
$(document).ready(function() {
$('.phAnimate input').phAnim();
});
</script>
<script type="text/javascript">
var uid = '171291';
var wid = '374554';
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36251023-1']);
_gaq.push(['_setDomainName', 'jqueryscript.net']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
<script>
jQuery(document).ready(function($){
$('.delete-link').on('click',function(){
var getLink = $(this).attr('href');
swal({
title: "Are you sure?",
text: 'Hapus Data?',
type: "warning",
html: true,
confirmButtonColor: '#d9534f',

confirmButtonColor: "#DD6B55",
showCancelButton: true,
},function(){
window.location.href = getLink
});
return false;
});
});
</script>

</body>
</html>


Mungkin filenya terlalu panjang ya,, mungkin jga rodok mumet,,teang saja saya kasih link download