Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- $p = array('1','31','32','51','52');
- if(!(in_array($this->session->userdata('type'),$p))){
- redirect('auth/dashboard');
- }
- $this->load->view('layout/header');
- ?>
- <script type="text/javascript">
- function delete_id(id)
- {
- if(confirm('<?php echo $this->lang->line('product_delete_conform'); ?>'))
- {
- window.location.href='<?php echo base_url('purchase/delete/'); ?>'+id;
- }
- }
- </script>
- <script type="text/javascript">
- function change_status(status, id){
- if(status=='Partial'){
- $('.div_detail').html();
- $('.div_detail').show();
- $.ajax({
- url: "<?php echo base_url('index.php/purchase/getDetail'); ?>",
- type: 'POST',
- data: {
- id : id
- },
- success: function(response){
- $('.div_detail').html(response);
- },
- error: function(xhr) {
- //Do Something to handle error
- alert('error occured!');
- }
- });
- }
- else{
- $('.div_detail').hide();
- }
- }
- </script>
- <div class="content-wrapper">
- <!-- Content Header (Page header) -->
- <section class="content-header">
- <h5>
- <ol class="breadcrumb">
- <li><a href="<?php echo base_url('auth/dashboard'); ?>"><i class="fa fa-dashboard"></i> <?php echo $this->lang->line('header_dashboard'); ?></a></li>
- <li class="active"><?php echo $this->lang->line('header_purchase'); ?></li>
- </ol>
- </h5>
- </section>
- <!-- Main content -->
- <section class="content">
- <div class="row">
- <?php
- if($message = $this->session->flashdata('message')){
- ?>
- <div class="col-sm-12">
- <div class="alert alert-success">
- <button class="close" data-dismiss="alert" type="button">×</button>
- <?php echo $message; ?>
- <div class="alerts-con"></div>
- </div>
- </div>
- <?php
- }
- ?>
- <div class="col-md-12">
- <div class="box">
- <div class="box-header with-border">
- <h3 class="box-title"><?php echo $this->lang->line('purchase_list_purchase'); ?></h3>
- <?php if ($this->session->flashdata('success')) { ?>
- <div class="alert alert-success"> <?= $this->session->flashdata('success') ?> </div>
- <?php } ?>
- <?php if ($this->session->flashdata('fail')) { ?>
- <div class="alert alert-warning"> <?= $this->session->flashdata('fail') ?> </div>
- <?php } ?>
- <a class="btn btn-sm btn-danger pull-right" style="margin: 10px" href="<?php echo base_url('document/lists/po');?>">Document List</a>
- <a class="btn btn-sm btn-info pull-right" style="margin: 10px" href="<?php echo base_url('purchase/add');?>" title="Add New Purchase"><?php echo $this->lang->line('purchase_add_new_purchase'); ?></a>
- </div>
- <div class="box-body outer-scroll">
- <div class="inner-scroll">
- <table id="index" class="table table-bordered table-striped">
- <thead>
- <tr>
- <th><?php echo $this->lang->line('product_no'); ?></th>
- <th><?php echo $this->lang->line('purchase_date'); ?></th>
- <th><?php echo $this->lang->line('purchase_reference_no').'/No Permintaan'; ?></th>
- <th><?php echo $this->lang->line('purchase_supplier').'/Vendor'; ?></th>
- <th><?php echo $this->lang->line('purchase_purchase_status'); ?></th>
- <th>Status</th>
- <th><?php echo $this->lang->line('purchase_grand_total'); ?></th>
- <th><?php echo $this->lang->line('product_action'); ?></th>
- </tr>
- </thead>
- <tbody>
- <?php foreach ($data as $row) {
- // $data->total=number_format((float)$data->total,0,',','.');
- $id= $row->purchase_id; ?>
- <tr>
- <td></td>
- <td><?= date("d-m-Y", strtotime($row->podate)) ?></td>
- <td>
- <a href="<?= base_url('purchase/view/'.$id) ?>"><?= $row->reference_no ?></a>
- </td>
- <td><?php echo $row->supplier_name; ?></td>
- <td align="center">
- <?= status($row->purchase_id) ?>
- </td>
- <td align="middle">
- <?php if($row->status==1) { echo "Revisi"; }
- else if($row->status==2) { echo "Disetujui"; }
- else if($row->status==3) { echo "Ditolak"; }
- else if($row->status==4) { echo "Draft"; }
- else { echo "Dibuat"; }
- ?>
- </td>
- <td align="right"><?php echo $this->session->userdata('symbol').$row->total=number_format(($row->total),2); ?></td>
- <td align="center">
- <div class="dropdown">
- <button type="button" class="btn btn-default gropdown-toggle" data-toggle="dropdown">
- <?php echo $this->lang->line('product_action'); ?>
- <span class="caret"></span>
- </button>
- <ul class="dropdown-menu dropdown-menu-right">
- <!-- <li>
- <a href="<?php echo base_url('purchase/view/');?><?php echo $id; ?>"><i class="fa fa-file-text-o"></i><?php echo $this->lang->line('purchase_purchase_details'); ?></a>
- </li> -->
- <?php if($row->status==0 || $row->status==1){ ?>
- <li>
- <a href="<?php echo base_url('purchase/ditolak/'); ?><?php echo $id; ?>"><i class="fa fa-edit"></i>Ditolak</a>
- </li>
- <?php } if($row->status==0 || $row->status==1){ ?>
- <li>
- <a href="<?php echo base_url('purchase/disetujui/'); ?><?php echo $id; ?>"><i class="fa fa-close"></i>Disetujui</a>
- </li>
- <?php } if($row->status==0 || $row->status==1 || $row->status==4){ ?>
- <li>
- <a href="<?php echo base_url('purchase/edit/'); ?><?php echo $id; ?>"><i class="fa fa-edit"></i><?php echo $this->lang->line('purchase_edit_purchase'); ?></a>
- </li>
- <?php } if($row->status==0 || $row->status==2){ ?>
- <li>
- <a href="<?php echo base_url('purchase/revisi/'); ?><?php echo $id; ?>"><i class="fa fa-edit"></i>Revisi Purchase</a>
- </li>
- <?php } ?>
- <!-- <li>
- <a href="<?php echo base_url('purchase/pdf/');?><?php echo $id; ?>" target="_blank "><i class="fa fa-file-pdf-o"></i><?php echo $this->lang->line('purchase_download_as_pdf'); ?></a>
- </li> -->
- <!-- <li>
- <a href="<?php echo base_url('purchase/email/');?><?php echo $id; ?>"><i class="fa fa-envelope"></i><?php echo $this->lang->line('purchase_email_purchase'); ?></a>
- </li> -->
- <li>
- <a href="" data-toggle="modal" data-target="#voidModal<?php echo $id;?>"> <i class="fa fa-edit"></i>+ Input Void</a>
- </li>
- <li>
- <a href="" data-toggle="modal" data-target="#closepoModal<?php echo $id;?>"> <i class="fa fa-edit"></i>x Close PO</a>
- </li>
- <li>
- <a href="<?php echo base_url('purchase/delete_po/'.$id) ?>" class="btn-hapus"> <i class="fa fa-trash"></i>x Delete PO</a>
- </li>
- <!-- <li>
- <a href="" data-toggle="modal" data-target="#shippingModal<?php echo $id;?>"> <i class="fa fa-edit"></i>Shipping</a>
- </li> -->
- <!-- <?php if ($row->status == "2") { ?>
- <li>
- <a href="<?= base_url('document/lists/po/'.$id) ?>"> <i class="fa fa-file"></i>Document</a>
- </li>
- <?php } ?> -->
- <?php if(strpos(status($row->purchase_id), 'Shipping')) { ?>
- <li>
- <a href="" data-toggle="modal" data-target="#cleranceModal<?php echo $id;?>"> <i class="fa fa-edit"></i>Costum Clearence</a>
- </li>
- <?php } ?>
- <!-- <li>
- <a href="javascript:delete_id(<?php echo $id;?>)"><i class="fa fa-trash-o"></i><?php echo $this->lang->line('purchase_delete_purchase'); ?></a>
- </li> -->
- </ul>
- </div>
- </td>
- </tr>
- <?php } ?>
- </tbody>
- <tfoot>
- <tr>
- <th><?php echo $this->lang->line('product_no'); ?></th>
- <th><?php echo $this->lang->line('purchase_date'); ?></th>
- <th><?php echo $this->lang->line('purchase_reference_no').'/No Permintaan'; ?></th>
- <th><?php echo $this->lang->line('purchase_supplier').'/Vendor'; ?></th>
- <th><?php echo $this->lang->line('purchase_purchase_status'); ?></th>
- <th>Status</th>
- <th><?php echo $this->lang->line('purchase_grand_total'); ?></th>
- <th><?php echo $this->lang->line('product_action'); ?></th>
- </tr>
- </tfoot>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </section>
- </div>
- <?php
- foreach ($data as $row)
- {
- $id= $row->purchase_id;
- ?>
- <div id="voidModal<?php echo $id;?>" class="modal fade" role="dialog">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal">×</button>
- Confirm Void Data
- </h4>
- </div>
- <div class="modal-body">
- <div class="control-group">
- <div class="controls">
- <div class="tabbable">
- <div class="box-body">
- <div class="row">
- <form method="post" action="<?php echo base_url('purchase/editVoid');?>">
- <input type="hidden" name="id" id="id" value="<?php echo $row->purchase_id;?>">
- <div class="col-md-9">
- <div class="form-group">
- <label for="customer_name">
- <?php echo "Are you sure to void this item ".$row->reference_no." ?"; ?>
- </label>
- </div>
- <div class="form-group">
- <label for="voiddesc">
- <?php echo "Description of Void"; ?>
- </label>
- <textarea class="form-control" id="voiddesc" rows="4" name="voiddesc"><?php echo set_value('address'); ?></textarea>
- </div>
- </div>
- <div class="col-sm-12">
- <div class="box-footer">
- <input type="submit" id="btn_submit" class="btn btn-info" value="Confirm">
- <span class="btn btn-default" id="cancel" style="margin-left: 2%" data-dismiss="modal">
- <?php echo "Cancel"; ?>
- </span>
- </div>
- </div>
- </form>
- </div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $this->lang->line('product_close'); ?></button>
- </div>
- </div>
- </div>
- </div> <!-- /controls -->
- </div> <!-- /control-group -->
- </div>
- </div>
- </div>
- <div id="closepoModal<?php echo $id;?>" class="modal fade" role="dialog">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal">×</button>
- Confirm Close PO
- </h4>
- </div>
- <div class="modal-body">
- <div class="control-group">
- <div class="controls">
- <div class="tabbable">
- <div class="box-body">
- <div class="row">
- <form method="post" action="<?php echo base_url('purchase/editClosepo');?>">
- <input type="hidden" name="id" id="id" value="<?php echo $row->purchase_id;?>">
- <div class="col-md-9">
- <div class="form-group">
- <label for="customer_name">
- <input type="hidden" name="reference_no" value="<?php echo $row->reference_no; ?>">
- </label>
- </div>
- <div class="form-group">
- <label for="voiddesc">
- <?php echo "Description of Close PO"; ?>
- </label>
- <textarea class="form-control" id="closepo" rows="6" name="closepo"><?php echo set_value('address'); ?></textarea>
- </div>
- </div>
- <div class="col-sm-12">
- <div class="box-footer">
- <input type="submit" id="btn_submit" class="btn btn-info" value="Confirm">
- <span class="btn btn-default" id="cancel" style="margin-left: 2%" data-dismiss="modal">
- <?php echo "Cancel"; ?>
- </span>
- </div>
- </div>
- </form>
- </div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $this->lang->line('product_close'); ?></button>
- </div>
- </div>
- </div>
- </div> <!-- /controls -->
- </div> <!-- /control-group -->
- </div>
- </div>
- </div>
- <div id="shippingModal<?php echo $id;?>" class="modal fade" role="dialog">
- <div class="modal-dialog">
- <!-- Modal content-->
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal">×</button>
- <h4><!-- <?php echo $this->lang->line('product_hsn_sac_lookup'); ?> -->
- Add Shipping Data
- </h4>
- </div>
- <div class="modal-body">
- <div class="control-group">
- <div class="controls">
- <div class="tabbable">
- <div class="box-body">
- <div class="row">
- <form method="post" action="<?php echo base_url('purchase/editShipping');?>" enctype="multipart/form-data">
- <input type="hidden" name="id" id="id" value="<?php echo $row->purchase_id;?>">
- <div class="col-md-9">
- <div class="form-group">
- <label for="customer_name">
- <?php echo "Shipping Data :".$row->reference_no." ?"; ?>
- </label>
- </div>
- </div>
- <div class="col-md-9">
- <div class="form-group">
- <label for="shipstatus"><!-- Country -->
- <?php echo "Status"; ?>
- </label>
- <select class="form-control select2" id="shipstatus" name="shipstatus" style="width: 100%;" onchange="change_status(this.value, <?php echo $id; ?>)">
- <option value="Full">Full</option>
- <option value="Partial">Partial</option>
- </select>
- </div>
- </div>
- <div class="col-md-9">
- <div class="form-group">
- <label for="awb">
- <?php echo "AWB/HAWB"; ?>
- </label>
- <input type="text" class="form-control" id="shipawb" name="shipawb" value="<?php echo set_value('customer_name'); ?>">
- </div>
- </div>
- <div class="col-md-9">
- <div class="form-group">
- <label for="shipdate">
- <?php echo "Date"; ?>
- </label>
- <input type="text" class="form-control datepicker" id="shipdate" name="shipdate" value="<?php echo set_value('customer_name'); ?>">
- </div>
- </div>
- <div class="col-md-9">
- <div class="form-group">
- <label for="trackno">
- <?php echo "Tracking No"; ?>
- </label>
- <input type="text" class="form-control" id="shiptrackno" name="shiptrackno" value="<?php echo set_value('customer_name'); ?>">
- </div>
- </div>
- <div class="col-md-9">
- <div class="form-group">
- <label for="courier">
- <?php echo "Courier"; ?>
- </label>
- <input type="text" class="form-control" id="shipcourier" name="shipcourier" value="<?php echo set_value('customer_name'); ?>">
- </div>
- </div>
- <div class="col-md-9">
- <div class="form-group">
- <label for="freight">
- <?php echo "Freight"; ?>
- </label>
- <input type="text" class="form-control" id="shipfreight" name="shipfreight" value="<?php echo set_value('customer_name'); ?>">
- </div>
- </div>
- <div class="col-md-9">
- <div class="form-group">
- <label for="shipfile">
- <?php echo "Attach File"; ?>
- </label>
- <input type="file" class="form-control" id="shipfile" name="shipfile" value="<?php echo set_value('customer_name'); ?>">
- </div>
- </div>
- <div class="col-md-9">
- <div class="form-group">
- <label for="shipto">
- <?php echo "Ship TO"; ?>
- </label>
- <input type="text" class="form-control" id="shipto" name="shipto" value="<?php echo set_value('customer_name'); ?>">
- </div>
- </div>
- <div class="div_detail">
- </div>
- <div class="col-sm-12">
- <div class="box-footer">
- <input type="submit" id="btn_submit" class="btn btn-info" value="Confirm">
- <span class="btn btn-default" id="cancel" style="margin-left: 2%" data-dismiss="modal">
- <?php echo "Cancel"; ?>
- </span>
- </div>
- </div>
- </form>
- </div>
- <!-- /.box-body -->
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $this->lang->line('product_close'); ?></button>
- </div>
- </div>
- </div>
- </div> <!-- /controls -->
- </div> <!-- /control-group -->
- </div>
- </div>
- </div>
- <div id="cleranceModal<?php echo $id;?>" class="modal fade" role="dialog">
- <div class="modal-dialog">
- <!-- Modal content-->
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal">×</button>
- <h4><!-- <?php echo $this->lang->line('product_hsn_sac_lookup'); ?> -->
- Add Clerance Data
- </h4>
- </div>
- <div class="modal-body">
- <div class="control-group">
- <div class="controls">
- <div class="tabbable">
- <div class="box-body">
- <div class="row">
- <form method="post" action="<?php echo base_url('purchase/editClerance');?>" enctype="multipart/form-data">
- <input type="hidden" name="id" id="id" value="<?php echo $row->purchase_id;?>">
- <div class="col-md-9">
- <div class="form-group">
- <label for="customer_name">
- <?php echo "Clerance Data :".$row->reference_no." ?"; ?>
- </label>
- </div>
- </div>
- <div class="col-md-9">
- <div class="form-group">
- <label for="awb">
- <?php echo "AWB/HAWB"; ?>
- </label>
- <input type="text" class="form-control" id="cleranceawb" name="cleranceawb" value="<?php echo set_value('customer_name'); ?>">
- </div>
- </div>
- <div class="col-md-9">
- <div class="form-group">
- <label for="clerance">
- <?php echo "Date Of Arrival On Port"; ?>
- </label>
- <input type="text" class="form-control datepicker" id="clerancedate" name="clerancedate" value="<?php echo set_value('customer_name'); ?>">
- </div>
- </div>
- <div class="col-md-9">
- <div class="form-group">
- <label for="trackno">
- <?php echo "Tracking No"; ?>
- </label>
- <input type="text" class="form-control" id="clerancetrackno" name="clerancetrackno" value="<?php echo set_value('customer_name'); ?>">
- </div>
- </div>
- <div class="col-md-9">
- <div class="form-group">
- <label for="courier">
- <?php echo "Courier"; ?>
- </label>
- <input type="text" class="form-control" id="clerancecourier" name="clerancecourier" value="<?php echo set_value('customer_name'); ?>">
- </div>
- </div>
- <div class="col-md-9">
- <div class="form-group">
- <label for="freight">
- <?php echo "Freight"; ?>
- </label>
- <input type="text" class="form-control" id="clerancefreight" name="clerancefreight" value="<?php echo set_value('customer_name'); ?>">
- </div>
- </div>
- <div class="col-md-9">
- <div class="form-group">
- <label for="shipfile">
- <?php echo "Attach File"; ?>
- </label>
- <input type="file" class="form-control" id="clerancefile" name="clerancefile" value="<?php echo set_value('customer_name'); ?>">
- </div>
- </div>
- <div class="col-md-9">
- <div class="form-group">
- <label for="clerancepib">
- <?php echo "PIB no"; ?>
- </label>
- <input type="text" class="form-control" id="clerancepib" name="clerancepib" value="<?php echo set_value('customer_name'); ?>">
- </div>
- </div>
- <div class="col-md-9">
- <div class="form-group">
- <label for="clerancepib">
- <?php echo "Estimate Duty And Tax"; ?>
- </label>
- <input type="text" class="form-control" id="dutytax" name="dutytax" value="<?php echo set_value('customer_name'); ?>">
- </div>
- </div>
- <div class="col-sm-12">
- <div class="box-footer">
- <input type="submit" id="btn_submit" class="btn btn-info" value="Confirm">
- <span class="btn btn-default" id="cancel" style="margin-left: 2%" data-dismiss="modal">
- <?php echo "Cancel"; ?>
- </span>
- </div>
- </div>
- </form>
- </div>
- <!-- /.box-body -->
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $this->lang->line('product_close'); ?></button>
- </div>
- </div>
- </div>
- </div> <!-- /controls -->
- </div> <!-- /control-group -->
- </div>
- </div>
- </div>
- <!-- modal hapus -->
- <div class="modal fade" id="modal-hapus" tabindex="-1" role="dialog" aria-labelledby="modal-notification" aria-hidden="true">
- <div class="modal-dialog modal-default modal-dialog-centered modal-" role="document">
- <div class="modal-content bg-gradient-danger">
- <div class="modal-header">
- <h6 class="modal-title" id="modal-title-notification">Your attention is required</h6>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
- <div class="py-3 text-center">
- <i class="ni ni-bell-55 ni-3x"></i>
- <h4 class="heading mt-4">Apakah kamu yakin ingin menghapus data ini?</h4>
- </div>
- </div>
- <div class="modal-footer">
- <form action="" method="post">
- <p>
- <button type="submit" class="btn btn-danger btn-flat btn-sm menu-sidebar">Ok, Hapus</button>
- <button type="button" class="btn btn-link text-white ml-auto" data-dismiss="modal">Close</button>
- </p>
- </form>
- </div>
- </div>
- </div>
- </div>
- <?php } ?>
- <?php
- $this->load->view('layout/footer2');
- ?>
- <script type="text/javascript">
- $(document).ready(function(){
- $('body').on('click','.btn-hapus',function(e){
- e.preventDefault();
- var url = $(this).attr('href');
- $('#modal-hapus').find('form').attr('action',url);
- $('#modal-hapus').modal();
- });
- });
- </script>
Add Comment
Please, Sign In to add comment