You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.2 KiB
PHP
81 lines
2.2 KiB
PHP
<?php
|
|
session_start();
|
|
if($_SESSION['validUser'] !== TRUE)
|
|
{
|
|
header("location: ./index.php");
|
|
exit();
|
|
}
|
|
?>
|
|
|
|
<style type='text/css'>
|
|
*{font: 7pt Gill Sans MT, Tahoma, Helvetica, sans-serif;}
|
|
div.container{width:175px; height:80px; padding-top:8px; text-align:center;}
|
|
div.imgbarcode{margin-bottom:3px;}
|
|
div.nama{font-size:1em;}
|
|
div.harga{font-size:1.5em; font-weight:bold;}
|
|
</style>
|
|
|
|
<?php
|
|
/**
|
|
* Halaman untuk mencetak barcode
|
|
*
|
|
*/
|
|
|
|
if(isset($_POST["kkodebarang"]) && isset($_POST["kjml"]) && isset($_POST["knomorbarang"]))
|
|
{
|
|
$namabr = $_POST["knamabarang"];
|
|
$kode = $_POST["kkodebarang"];
|
|
$nomor = $_POST["knomorbarang"];
|
|
$hjual = $_POST["khjual"];
|
|
$jumlah = $_POST["kjml"];
|
|
|
|
for($i = 1; $i<=$jumlah; $i++)
|
|
{
|
|
$barcode = strtoupper($kode);
|
|
print("<div class='container'>");
|
|
print("<div class='imgbarcode'><img src=\"./barcode.php?code=$barcode\"/></div>");
|
|
print("<div class='nama'>".strtoupper($namabr)."</div>");
|
|
print("<div class='harga'>Rp. ".number_format($hjual,0,',','.')."</div>");
|
|
print("</div><br/>");
|
|
$string = $string.$barcode.",".strtoupper($namabr).",".number_format($hjual,0,',','.')."\n";
|
|
}
|
|
}
|
|
else if(isset($_POST["fkodebarang"]) && isset($_POST["fjml"]) && isset($_POST["count"]))
|
|
{
|
|
$kode = $_POST["fkodebarang"];
|
|
$namabr = $_POST["fnamabarang"];
|
|
$nomor = $_POST["fnomor"];
|
|
$jumlah = $_POST["fjml"];
|
|
$hjual = $_POST["fhjual"];
|
|
$count = $_POST["count"];
|
|
|
|
for($i = 0; $i<$count; $i++)
|
|
{
|
|
$barcode = $kode[$i];
|
|
for($j = 0; $j<$jumlah[$i]; $j++)
|
|
{
|
|
print("<div class='container'>");
|
|
print("<div class='imgbarcode'><img src=\"./barcode.php?code=$barcode\"/></div>");
|
|
print("<div class='nama'>".strtoupper($namabr[$i])."</div>");
|
|
print("<div class='harga'>Rp. ".number_format($hjual[$i],0,',','.')."</div>");
|
|
print("</div><br/>");
|
|
$string = $string.$barcode.",".strtoupper($namabr[$i]).",".number_format($hjual[$i],0,',','.')."\n";
|
|
}
|
|
}
|
|
}
|
|
|
|
createFile(substr($string,0,-1));
|
|
|
|
function createFile($contentAdd)
|
|
{
|
|
$filename = '../data/barcode_cetak.csv';
|
|
|
|
$handle = fopen($filename,"wt");
|
|
$somecontent = $contentAdd."\n";
|
|
fwrite($handle,$somecontent);
|
|
fclose($handle);
|
|
|
|
}
|
|
|
|
?>
|