fin2@agn
BNI-PT
Man-PT
KasKecil
BCA 671
Man 709
Account Tree
db backup
eBook #1
eBook #2
eBook #3
Tax eBook #4
Color
Logout
Mutasi BNI PT
Mutasi Mandiri PT
Mutasi Mandiri 709
Mutasi Mandiri 202
Mutasi BCA 671
Mutasi BCA 471
Mutasi Jago
Action
Transaction
Journal
Report
FilePHP
Tes cURL [1]
Copy This
Save
folder
slug
param
method
body
remark
php
Copy
/home/u902783705/domains/azkapersada.com/public_html/sub/fin/
inc.inventory.php
<main> <div class="container-fluid"> <div class="row align-items-center justify-content-between pt-2"> <div class="col-auto mb-3"> <h2>Inventory</h2> </div> <div class="col-12 col-xl-auto mb-3"> <!--<a class="btn btn-xs btn-color-lime" href="?op=inventory&op2=add">Add inventory</a>--> </div> </div> <?php switch($op2) { case "add"; add(); break; case "add2"; print_r($_POST); $sql4 = "select * from inventory order by id desc limit 1"; $res4 = mysqli_query($db, $sql4); $rw4 = mysqli_fetch_assoc($res4); $id2=$rw4['id']+1; $udata=array( 'id'=>$id2, 'name'=>$_POST['name'], 'brand'=>$_POST['brand'], 'qty'=>$_POST['qty'], 'unit'=>$_POST['unit'], 'remark'=>$_POST['remark'], 'position'=>$_POST['position'], 'group'=>$_POST['group'], 'condition'=>$_POST['condition'], 'purchase_date'=>strtotime($_POST['purchase_date']), 'will_age'=>$_POST['will_age'], 'price_per_unit'=>$_POST['price_per_unit'], //'value'=>$_POST['value'], 'create_at'=>time(), ); Insert($db,"inventory",$udata,1); listinventory($q,$col,$q2,$col2,$sortby,$sort,$page); break; case "edit"; edit($_GET['id']); break; case "edit2"; //echo "<pre>"; print_r($_POST); echo "</pre>"; $udata=array( 'name'=>$_POST['name'], 'brand'=>$_POST['brand'], 'qty'=>$_POST['qty'], 'unit'=>$_POST['unit'], 'remark'=>$_POST['remark'], 'position'=>$_POST['position'], 'group'=>$_POST['group'], 'condition'=>$_POST['condition'], 'purchase_date'=>strtotime($_POST['purchase_date']), 'will_age'=>$_POST['will_age'], 'price_per_unit'=>$_POST['price_per_unit'], 'value'=>$_POST['price_per_unit']*$_POST['qty'], 'update_at'=>time(), ); Update($db,"inventory",$udata,"id=".$_POST['id'],0); //echo "<pre>"; print_r($_FILES); echo "</pre>"; if(isset($_FILES['file']['tmp_name']) && ($_FILES['file']['tmp_name']!='')) { UploadImage($_POST,$_FILES,'inventory'); } listinventory($q,$col,$q2,$col2,$sortby,$sort,$page); break; case "del"; $udata=array( 'st'=>0, 'update_at'=>time(), ); Update($db,"inventory",$udata,"id=".$_GET['id'],0); listinventory($q,$col,$q2,$col2,$sortby,$sort,$page); break; case "reset"; $udata=array( 'st'=>1, 'update_at'=>time(), ); Update($db,"inventory",$udata,"",0); listinventory($q,$col,$q2,$col2,$sortby,$sort,$page); case "list"; default; listinventory($q,$col,$q2,$col2,$sortby,$sort,$page); } ?> </div> </main> <?php function listinventory($q,$col,$q2,$col2,$sortby,$sort,$page) { global $db,$ar; //print_r($ar); ?> <h3>List</h3> <table class="table table-bordered table-striped" id="dataTable_7d" width="100%" cellspacing="0"> <thead> <tr class="table-primary"> <th>ID</th> <th>Name</th> <th>Brand</th> <th>Group</th> <th>Lokasi</th> <th>Qty</th> <th>WillAge</th> <th>Value</th> <th>Update</th> <th>Trx</th> <th>Act</th> <th>Menu</th> </tr> </thead> <tbody> <?php $sql = "select * from inventory where st>0 "; if($col!='') { $sql .= " and ".$col."='".$q."' "; } if($col2!='') { $sql .= " and ".$col2."='".$q2."' "; } $sql .= " order by ".$sortby." ".$sort." "; $res = mysqli_query($db, $sql); //echo $sql; $j_balance=0; while($rw = mysqli_fetch_assoc($res)) { $j_balance=$j_balance+$rw['value']; ?> <tr> <td><?=$rw['id'];?></td> <td><?=$rw['name'];?></td> <td><?=$rw['brand'];?></td> <td><?=$rw['group'];?></td> <td><?=$rw['position'];?></td> <td><?=$rw['qty'];?></td> <td><?=$rw['will_age'];?></td> <td class="text-right"><?=ang2($rw['value']);?></td> <td><?=date("y-m-d h:i:s",$rw['purchase_date']);?></td> <td><a href="?op=transaction&op2=edit&id=<?=$rw['transaction_id'];?>"><?=$rw['transaction_id'];?></a></td> <td><a href="?op=action&op2=edit&id=<?=$rw['action_id'];?>"><?=$rw['action_id'];?></a></td> <td nowrap> <a class="btn btn-xs btn-warning" href="?op=inventory&op2=edit&id=<?=$rw['id'];?>">edit</a> </td> </tr> <?php } ?> </tbody> <tfoot> <tr class="table-danger"> <th colspan="7"></th> <th class="text-right"><?=ang2($j_balance);?></th> <th colspan="4"></th> </tr> </tfoot> </table> <?php } function edit($id) { global $db,$ar; $sql = "select * from inventory where id=".$id; $res = mysqli_query($db, $sql); //echo $sql; $rw = mysqli_fetch_assoc($res); ?> <h3>Edit</h3> <form action="index.php?op=inventory&op2=edit2" method="post" enctype="multipart/form-data"> <input type="hidden" name="id" value="<?=$id;?>"> <input type="hidden" name="file_type" value="image"> <div class="form-group row"> <label for="name" class="col-sm-1 col-form-label">Name</label> <div class="col-sm-4"> <input type="text" value="<?=$rw['name'];?>" class="form-control" name="name"> </div> <label for="brand" class="col-sm-1 col-form-label">Brand</label> <div class="col-sm-4"> <input type="text" value="<?=$rw['brand'];?>" class="form-control" name="brand"> </div> <label for="qty" class="col-sm-1 col-form-label">Qty</label> <div class="col-sm-1"> <input type="text" value="<?=$rw['qty'];?>" class="form-control" name="qty"> </div> </div> <div class="form-group row"> <label for="price_per_unit" class="col-sm-1 col-form-label">Price</label> <div class="col-sm-4"> <input type="text" value="<?=$rw['price_per_unit'];?>" class="form-control" name="price_per_unit"> </div> <label for="purchase_date" class="col-sm-2 col-form-label">Purchase Date</label> <div class="col-sm-3"> <input type="date" value="<?=date("Y-m-d",$rw['purchase_date']);?>" class="form-control" name="purchase_date"> </div> <label for="unit" class="col-sm-1 col-form-label">Unit/satuan</label> <div class="col-sm-1"> <input type="text" value="<?=$rw['unit'];?>" class="form-control" name="unit"> </div> </div> <div class="form-group row"> <label for="position" class="col-sm-1 col-form-label">Position</label> <div class="col-sm-4"> <input type="text" value="<?=$rw['position'];?>" class="form-control" name="position"> </div> <label for="condition" class="col-sm-1 col-form-label">Condition</label> <div class="col-sm-3"> <input type="text" value="<?=$rw['condition'];?>" class="form-control" name="condition"> </div> <label for="will_age" class="col-sm-2 col-form-label">Will Age (th)</label> <div class="col-sm-1"> <input type="text" value="<?=$rw['will_age'];?>" class="form-control" name="will_age"> </div> </div> <div class="form-group row"> <label for="group" class="col-sm-1 col-form-label">Group</label> <div class="col-sm-3"> <input type="text" value="<?=$rw['group'];?>" class="form-control" name="group"> </div> <label for="remark" class="col-sm-1 col-form-label">Remark</label> <div class="col-sm-7"> <input type="text" value="<?=$rw['remark'];?>" class="form-control" name="remark"> </div> </div> <div class="form-group row"> <label for="file" class="col-sm-1 col-form-label">Foto</label> <div class="col-sm-4"> <div class="input-group"> <div class="custom-file"> <input type="file" class="custom-file-input" name="file" id="file" aria-describedby="file1"> <label class="custom-file-label" for="file">Choose file</label> </div> </div> </div> </div> <div class="form-group row"> <div class="col-sm-10 offset-sm-2 text-right"> <a href="?op=inventory&op2=del&id=<?=$id;?>" class="btn btn-danger">Delete</a> <button type="submit" name="submit" class="btn btn-primary">Update</button> </div> </div> </form> <?php echo viewImage('inventory',$id); } function add() { global $db,$ar; ?> <h3>Add</h3> <form action="index.php?op=inventory&op2=add2" method="post" enctype="multipart/form-data"> <div class="form-group row"> <label for="name" class="col-sm-1 col-form-label">Name</label> <div class="col-sm-4"> <input type="text" class="form-control" name="name"> </div> <label for="brand" class="col-sm-1 col-form-label">Brand</label> <div class="col-sm-4"> <input type="text" class="form-control" name="brand"> </div> <label for="qty" class="col-sm-1 col-form-label">Qty</label> <div class="col-sm-1"> <input type="text" class="form-control" name="qty"> </div> </div> <div class="form-group row"> <label for="price_per_unit" class="col-sm-1 col-form-label">Price</label> <div class="col-sm-4"> <input type="text" class="form-control" name="price_per_unit"> </div> <label for="purchase_date" class="col-sm-2 col-form-label">Purchase Date</label> <div class="col-sm-3"> <input type="date" class="form-control" name="purchase_date"> </div> <label for="unit" class="col-sm-1 col-form-label">Unit/satuan</label> <div class="col-sm-1"> <input type="text" class="form-control" name="unit"> </div> </div> <div class="form-group row"> <label for="position" class="col-sm-1 col-form-label">Position</label> <div class="col-sm-4"> <input type="text" class="form-control" name="position"> </div> <label for="condition" class="col-sm-1 col-form-label">Condition</label> <div class="col-sm-3"> <input type="text" class="form-control" name="condition"> </div> <label for="will_age" class="col-sm-2 col-form-label">Will Age (th)</label> <div class="col-sm-1"> <input type="text" class="form-control" name="will_age"> </div> </div> <div class="form-group row"> <label for="group" class="col-sm-1 col-form-label">Group</label> <div class="col-sm-3"> <input type="text" class="form-control" name="group"> </div> <label for="remark" class="col-sm-1 col-form-label">Remark</label> <div class="col-sm-7"> <input type="text" class="form-control" name="remark"> </div> </div> <div class="form-group row"> <div class="col-sm-10 offset-sm-2 text-right"> <button type="submit" name="submit" class="btn btn-primary">Add</button> </div> </div> </form> <?php } ?>