fadlyshafa

Untitled

Jun 24th, 2020
63
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. $p = array('1','41','42','51','52','31','32');
  4. if(!(in_array($this->session->userdata('type'),$p))){
  5. redirect('auth/dashboard');
  6. }
  7. $this->load->view('layout/header');
  8. ?>
  9. <script type="text/javascript">
  10. function delete_id(id)
  11. {
  12. if(confirm('<?php echo $this->lang->line('product_delete_conform'); ?>'))
  13. {
  14. window.location.href='<?php echo base_url('finance/delete_bill/'); ?>'+id;
  15. }
  16. }
  17. </script>
  18. <div class="content-wrapper">
  19. <!-- Content Header (Page header) -->
  20. <section class="content-header">
  21. <h5>
  22. <ol class="breadcrumb">
  23. <li><a href="<?php echo base_url('auth/dashboard'); ?>"><i class="fa fa-dashboard"></i> <?php echo $this->lang->line('header_dashboard'); ?></a></li>
  24. <li><a href="<?php echo base_url('finance/billing'); ?>">Billing</a></li>
  25. <li class="active">View</li>
  26. </ol>
  27. </h5>
  28. </section>
  29. <!-- Main content -->
  30. <section class="content">
  31. <div class="row">
  32. <!-- right column -->
  33. <div class="col-md-12">
  34. <div class="box">
  35. <div class="box-header with-border">
  36. <h3 class="box-title"><?php echo $this->lang->line('purchase_purchase_details'); ?></h3>
  37. </div>
  38. <!-- /.box-header -->
  39. <div class="box-body">
  40. <div class="col-sm-12 well well-sm">
  41. <div class="col-sm-6">
  42. <div class="col-sm-2">
  43. <i class="fa fa-3x fa-truck padding010 text-muted"></i>
  44. </div>
  45. <div class="col-sm-10">
  46. <b><h4><?php echo $data[0]->supplier_name; ?></h4></b>
  47. <?php echo $data[0]->supplier_address; ?>
  48. <br>
  49. <?php echo $data[0]->supplier_city; ?>
  50. <br>
  51. <?php echo $data[0]->supplier_country; ?>
  52. <br><br>
  53. <?php echo $this->lang->line('purchase_mobile')." : ".$data[0]->supplier_mobile; ?>
  54. <br>
  55. <?php echo $this->lang->line('company_setting_email')." : ".$data[0]->supplier_email; ?>
  56. </div>
  57. </div>
  58. <div class="col-sm-6">
  59. <div class="col-sm-2">
  60. <i class="fa fa-3x fa-building-o padding010 text-muted"></i>
  61. </div>
  62. <div class="col-sm-10">
  63. <b><h4><?php echo $company[0]->name; ?></h4></b>
  64. <?php echo $data[0]->warehouse_name; ?>
  65. <br>
  66. <?php echo $data[0]->branch_address; ?>
  67. <br>
  68. <?php echo $data[0]->branch_city; ?>
  69. <br><br>
  70. <?php echo $this->lang->line('purchase_mobile')." : ".$company[0]->phone; ?>
  71. <br>
  72. <?php echo $this->lang->line('company_setting_email')." : ".$company[0]->email; ?>
  73. </div>
  74. </div>
  75. </div>
  76. <div class="col-sd-12">
  77. <div class="col-sm-4">
  78. <div class="col-sm-2">
  79. <i class="fa fa-3x fa-file-text-o padding010 text-muted"></i>
  80. </div>
  81. <div class="col-sm-10">
  82. <?php
  83. foreach ($quotation as $qrow) {
  84. $qrefno[$qrow->quotation_id] = $qrow->reference_no;
  85. }
  86. $sqrq = array();
  87. if (@unserialize($data[0]->reference_no)) {
  88. $arq = @unserialize($data[0]->reference_no);
  89. for ($in = 0; $in < count($arq); $in++) {
  90. $sqrq[] = $qrefno[$arq[$in]];
  91. }
  92. $refno = implode(',', $sqrq);
  93. }
  94. ?>
  95.  
  96. <b><?php echo $this->lang->line('purchase_date')." : ".$data[0]->date; ?></b>
  97. <br>
  98. <b>Status</b>
  99. <span class="label label-success"><?php
  100. if($data[0]->status==0)
  101. {
  102. echo "Created";
  103. }
  104. else if($data[0]->status==1)
  105. {
  106. echo $this->lang->line('purchase_received');
  107. }
  108. else if($data[0]->status==2)
  109. {
  110. echo "Shipping";
  111. }
  112. else if($data[0]->status==3)
  113. {
  114. echo "Clearence";
  115.  
  116. }
  117. else if($data[0]->status==4)
  118. {
  119. echo "Void";
  120. }
  121. else if($data[0]->status==5)
  122. {
  123. echo "Done";
  124. }
  125. else if($data[0]->status==6)
  126. {
  127. echo "Close PO";
  128. }
  129.  
  130. ?></span>
  131. <b>&nbsp;
  132. </div>
  133. </div>
  134. <div class="col-sm-4">
  135. <div class="col-sm-2">
  136. <i class="fa fa-3x fa-file-text-o padding010 text-muted"></i>
  137. </div>
  138. <div class="col-sm-10">
  139. <b><h4><?php echo $data[0]->reference_no; ?></h4></b>
  140.  
  141. <b>Payment Status</b>
  142. <?php if($data[0]->status == 5){ ?>
  143. <span class="label label-success"><?php echo "Paid"; ?></span>
  144. <?php }else{ ?>
  145. <span class="label label-warning"><?php echo "Unpaid"; ?></span>
  146. <?php } ?>
  147. <br>
  148. <b>&nbsp;
  149. </div>
  150. </div>
  151. </div>
  152. <form id="myForm">
  153. <div class="col-sm-12" style="overflow-y: auto;">
  154. <table class="table table-hover table-bordered">
  155. <thead>
  156. <th style="text-align: center;"><?php echo $this->lang->line('product_no'); ?></th>
  157. <th width="20%"><?php echo $this->lang->line('product_description'); ?></th>
  158. <th width="20%">Code</th>
  159. <th style="text-align: center;"><?php echo $this->lang->line('product_quantity'); ?></th>
  160. <th style="text-align: center;">UOM</th>
  161. <th style="text-align: center;"><?php echo $this->lang->line('product_cost'); ?></th>
  162. <th style="text-align: center;"><?php echo $this->lang->line('purchase_total_harga').'Total Harga'; ?></th>
  163. <th style="text-align: center;">Total Bayar</th>
  164. <th style="text-align: center;"><?php echo $this->lang->line('header_discount'); ?></th>
  165. <th style="text-align: center;"><?php echo $this->lang->line('purchase_taxable_value').'/Pajak'; ?></th>
  166. <th style="text-align: center;"><?php echo $this->lang->line('header_tax').'/PPH Pajak'; ?></th>
  167. <th style="text-align: center;"><?php echo $this->lang->line('purchase_total'); ?></th>
  168. </thead>
  169. <tbody>
  170. <?php $i = 1; $tax=0; $disc=0; $tot = 0;foreach ($items as $value) { ?>
  171. <tr>
  172. <td align="center"><?php echo $i;?></td>
  173. <td><?= $value->nama_produk ?></td>
  174. <td align="center"><?= $value->kode_produk ?></td>
  175. <td align="center"><?php echo $value->quantityreal; ?></td>
  176. <td align="center"><?php echo $value->unit; ?></td>
  177. <td align="right"><?php echo $this->session->userdata('symbol').$value->price; ?></td>
  178. <td align="right"><?php echo $this->session->userdata('symbol').$value->gross_total; ?></td>
  179. <td align="right"><input type="text" id="total_payment" name="total_payment" class="total_payment" value="0"></td>
  180. <td align="right"><?php echo $this->session->userdata('symbol').$value->discount_value; ?></td>
  181. <td align="right"><?php echo $this->session->userdata('symbol').($value->gross_total - $value->discount_value); ?></td>
  182. <td align="right"><?php echo $this->session->userdata('symbol').$value->tax; ?></td>
  183. <td align="right"><?php echo $this->session->userdata('symbol').($value->gross_total - $value->discount_value + $value->tax); ?></td>
  184. </tr>
  185. <?php $i++;
  186. $tot += $value->gross_total;
  187. $disc += $value->discount_value;
  188. $tax += $value->tax;
  189. } ?>
  190.  
  191.  
  192. <?php foreach ($serviceitems as $value) { ?>
  193. <tr>
  194. <td align="center"><?php echo $i;?></td>
  195. <td><?php echo @$value->service_title.'('.@$value->reference_no.')'; ?></td>
  196. <td align="center"><?php ?></td>
  197. <td align="center"><?php echo $value->quantity; ?></td>
  198. <td align="right"><?php echo $this->session->userdata('symbol').$value->price; ?></td>
  199. <td align="right"><?php echo $this->session->userdata('symbol').$value->gross_total; ?></td>
  200. <td align="right"><?php echo $this->session->userdata('symbol').$value->discount; ?></td>
  201. <td align="right"><?php echo $this->session->userdata('symbol').($value->gross_total - $value->discount); ?></td>
  202. <td align="right"><?php echo $this->session->userdata('symbol').$value->tax; ?></td>
  203. <td align="right"><?php echo $this->session->userdata('symbol').($value->gross_total - $value->discount + $value->tax); ?></td>
  204. </tr>
  205. <?php $i++;
  206. $tot += $value->gross_total;
  207. $disc += $value->discount;
  208. $tax += $value->tax;
  209. } ?>
  210.  
  211. <tr>
  212. <td colspan="10" align="right"><b><?php echo $this->lang->line('purchase_total_value').'/Total Harga'; ?></b></td>
  213. <td align="right" colspan="10"><?php echo $this->session->userdata('symbol').$tot; ?></td>
  214. </tr>
  215. <tr>
  216. <td colspan="10" align="right"><b><?php echo $this->lang->line('purchase_total_discount'); ?></b></td>
  217. <td align="right" colspan="10"><?php echo $this->session->userdata('symbol').$disc;?></td>
  218. </tr>
  219. <tr>
  220. <?php
  221. @$tdsk = ((($data[0]->diskonpersen*$tot)/100)+$data[0]->diskon);
  222. ?>
  223. <td colspan="10" align="right"><b><?php echo "Total Diskon Umum"; ?></b></td>
  224. <td align="right" colspan="10"><?php echo $this->session->userdata('symbol').$tdsk;?></td>
  225. </tr>
  226. <tr>
  227. <td colspan="10" align="right"><b><?php echo $this->lang->line('purchase_total_tax').'/Total Pajak'; ?></b></td>
  228. <td align="right" colspan="10"><?php echo $this->session->userdata('symbol').$tax;?></td>
  229. </tr>
  230. <tr>
  231. <td colspan="1">No</td>
  232. <td colspan="2">Jenis Biaya</td>
  233. <td colspan="2">Keterangan</td>
  234. <td colspan="2">File</td>
  235. <td colspan="2">Nominal</td>
  236. <td colspan="4"></td>
  237. </tr>
  238. <?php $i= 1; $biayatot = 0; foreach ($purchase_biaya as $biaya) { ?>
  239. <tr>
  240. <td align="center"><?php echo $i;?></td>
  241. <td colspan="2"><?php echo $biaya->jenis_biaya; ?></td>
  242. <td colspan="2"><?php echo $biaya->keterangan; ?></td>
  243. <td colspan="2"><a href="<?php echo base_url('assets/doc/');?><?php echo $biaya->file_upload; ?>"><?php echo $biaya->file_upload; ?></a> </td>
  244. <td colspan="2"><?php echo $biaya->nominal; ?></td>
  245. <td colspan="4"></td>
  246. <?php $i++; $biayatot += $biaya->nominal; }?>
  247. </tr>
  248. <tr>
  249. <td colspan="10" align="right"><b><?php echo "Total Biaya"; ?></b></td>
  250. <td align="right" colspan="10"><?php echo $this->session->userdata('symbol').$biayatot;?></td>
  251. </tr>
  252. <tr>
  253. <td colspan="10" align="right"><b><?php echo "Balance / Total Amount"; ?></b></td>
  254. <td align="right" colspan="10"><?php echo $this->session->userdata('symbol').(($tot-$disc-$tdsk)+$tax+$biayatot);?></td>
  255. </tr>
  256. <tr>
  257. <td colspan="10" align="right"><b><?php echo "Currency Total "; ?></b></td>
  258. <td align="right" colspan="10"><?php echo @$data[0]->symbol.number_format(((($tot-$disc-$tdsk)+$tax+$biayatot)/$data[0]->nominal), 2);; ?></td>
  259. </tr>
  260.  
  261. </tbody>
  262. </table>
  263. </div>
  264. <div class="col-sm-12">
  265. <div class="buttons">
  266. <div class="btn-group btn-group-justified">
  267. <div class="btn-group">
  268. <a class="tip btn btn-success" href="<?php echo base_url('finance/billpdf/');?><?php echo $data[0]->purchase_id; ?>" title="Download as PDF" target="_blank">
  269. <i class="fa fa-download"></i>
  270. <span class="hidden-sm hidden-xs"><?php echo $this->lang->line('product_alert_pdf'); ?></span>
  271. </a>
  272. </div>
  273. <div class="btn-group">
  274. <a class="tip btn btn-success" href="<?php echo base_url('finance/billword/');?><?php echo $data[0]->purchase_id; ?>" title="Download as Word" target="_blank">
  275. <i class="fa fa-download"></i>
  276. <span class="hidden-sm hidden-xs">M Word</span>
  277. </a>
  278. </div>
  279. <?php
  280. if($data[0]->status != 7){
  281. ?>
  282. <div class="btn-group">
  283. <a type="submit" class="tip btn btn-warning tip btn-payment">
  284. <i class="fa fa-money"></i>
  285. <span class="hidden-sm hidden-xs">Add Payment</span>
  286. </a>
  287. </div>
  288. <?php } ?>
  289. </div>
  290. </form>
  291. </div>
  292. </div>
  293.  
  294. </div>
  295. <!-- /.box-body -->
  296. </div>
  297. <!-- /.box -->
  298. </div>
  299. <!--/.col (right) -->
  300. </div>
  301. <!-- /.row -->
  302. </section>
  303. <!-- /.content -->
  304. </div>
  305. <!-- /.content-wrapper -->
  306. <div id="modalPayment" class="modal fade" role="dialog">
  307. <div class="modal-dialog">
  308. <!-- Modal content-->
  309. <div class="modal-content">
  310. <div class="modal-header">
  311. <button type="button" class="close" data-dismiss="modal">&times;</button>
  312. Add Payment
  313. </h4>
  314. </div>
  315. <div class="modal-body">
  316. <div class="control-group">
  317. <div class="controls">
  318. <div class="tabbable">
  319. <div class="box-body">
  320. <div class="row">
  321. <form method="post" action="<?php echo base_url('finance/addBilling');?>" enctype="multipart/form-data">
  322. <input type="hidden" name="id" id="id" value="<?php echo $purchase_id;?>">
  323.  
  324. <div class="col-md-12">
  325. <div class="form-group">
  326. <label for="awb">
  327. <?php echo "Payment Date"; ?>
  328. </label>
  329. <input type="text" class="form-control datepicker" id="payment_date" name="payment_date" value="">
  330. </div>
  331.  
  332. <div class="form-group">
  333. <label for="awb">
  334. <?php echo "Payment Amount"; ?>
  335. </label>
  336. <input type="text" class="form-control" id="paymentamount" name="peymentamount" value="<?php echo $tot;?>" readonly>
  337. </div>
  338. </div>
  339. <div class="col-md-12">
  340. <div class="form-group">
  341. <label for="shipstatus"><!-- Country -->
  342. <?php echo "Status"; ?>
  343. </label>
  344. <select class="form-control select2" id="paymentmethod" name="paymentmethod">
  345. <option value="">Payment Method</option>
  346. <option value="manualtransfer">Manual Transfer</option>
  347. <option value="cheque">Cheque</option>
  348. <option value="cash">Cash</option>
  349. </select>
  350. </div>
  351. </div>
  352. <div class="col-md-12">
  353. <div class="form-group">
  354. <label for="account"><!-- Country -->
  355. <?php echo "Bank Account"; ?>
  356. </label>
  357. <select class="form-control select2" id="account_id" name="account_id">
  358. <option value="">Select Account</option>
  359. <?php
  360. foreach ($account as $value) {
  361. echo "<option value='$value->id'" . set_select('id', $value->id) . ">$value->account_no - $value->group_title</option>";
  362. }
  363. ?>
  364. </select>
  365. </div>
  366. </div>
  367. <div class="col-md-12">
  368. <div class="form-group">
  369. <label for="paymentfile">
  370. <?php echo "Attach File"; ?>
  371. </label>
  372. <input type="file" class="form-control" id="paymentfile" name="paymentfile">
  373. </div>
  374. </div>
  375. <div class="col-md-12">
  376. <div class="form-group">
  377. <label for="awb">
  378. <?php echo "Payment Description"; ?>
  379. </label>
  380. <input type="text" class="form-control" id="paymentdescription" name="peymentdescription">
  381. </div>
  382. </div>
  383. <div class="col-sm-12">
  384. <div class="box-footer">
  385. <input type="submit" id="btn_submit" class="btn btn-info" value="Confirm">&nbsp;&nbsp;&nbsp;
  386. <span class="btn btn-default" id="cancel" style="margin-left: 2%" data-dismiss="modal">
  387. <?php echo "Cancel"; ?>
  388. </span>
  389. </div>
  390. </div>
  391.  
  392. <div class="list-total-payment">
  393.  
  394. </div>
  395.  
  396. </form>
  397. </div>
  398. <!-- /.box-body -->
  399. </div>
  400. <div class="modal-footer">
  401. <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $this->lang->line('product_close'); ?></button>
  402. </div>
  403. </div>
  404. </div>
  405. </div> <!-- /controls -->
  406. </div> <!-- /control-group -->
  407. </div>
  408. </div>
  409. </div>
  410. <script type="text/javascript">
  411. $(document).ready(function() {
  412. //datepicker
  413. $('.datepicker').datepicker({
  414. autoclose: true,
  415. format: "yyyy-mm-dd",
  416. todayHighlight: true,
  417. orientation: "auto",
  418. todayBtn: true,
  419. todayHighlight: true,
  420. });
  421. });
  422. </script>
  423. <!-- close datepicker -->
  424. <script type="text/javascript">
  425. $(document).ready(function(){
  426.  
  427. // var total_payment = 0
  428. // $('#total_payment').each(function(i,v){
  429. // var total = $(this).val();
  430. // total = parseInt(total);
  431.  
  432. // total_payment += total;
  433. // });
  434. // console.log(total_payment);
  435.  
  436. $('.btn-payment').click(function(e){
  437. e.preventDefault();
  438.  
  439. var total = 0;
  440. var total_awal = <?php echo $tot; ?>
  441. // total_awal = parseInt(total_awal);
  442. $('.total_payment').each(function(i,v){
  443. var nilai = parseInt($(this).val());
  444. total += nilai;
  445.  
  446. var input = '<input type="hidden" name="total_payment_new[]" value="'+nilai+'">';
  447. $('.list-total-payment').append(input);
  448. });
  449.  
  450. var total_akhir = total + total_awal;
  451. // alert(total_akhir);
  452.  
  453. $('#modalPayment').find("input[name='peymentamount']").val(total_akhir);
  454.  
  455. $('#modalPayment').modal();
  456. })
  457.  
  458.  
  459. });
  460. </script>
  461. <?php
  462. $this->load->view('layout/footer-min');
  463. ?>
RAW Paste Data