Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.13 KB | None | 0 0
  1. <?php
  2. $pop_no = null;
  3. $mon_popno = null;
  4. $nrows = count( $records );
  5. $KECIL = 0;
  6. $totalColumns = 20;
  7. // var_dump( $records );
  8. ?>
  9. <style>
  10. /*.datatable { width: 3000px;}*/
  11. .c_overflow { overflow-x: scroll;}
  12. .price-number { text-align: right; }
  13. .number-header { text-align: center; }
  14. .hidingrow { display: none; }
  15. .right { text-align: right; }
  16. .center { text-align: center; }
  17. .mytable thead tr th { vertical-align: top; }
  18. ::-webkit-scrollbar {
  19. width: 10px;
  20. height: 10px;
  21. -webkit-appearance: none;
  22. }
  23. ::-webkit-scrollbar-thumb {
  24. border-radius: 8px;
  25. background-color: rgba(0,0,0,.5);
  26. -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
  27. }
  28. </style>
  29. <p>Record: <?php echo $nrows ?></p>
  30. <p class="hidingrow this-month"><?php echo date('F') ?></p>
  31. <table class="table datatable table-bordered table-hover mytable compact" cellspacing="0">
  32. <thead>
  33. <tr>
  34. <th width="20px">No</th>
  35. <th width="80px"><?php echo lang('label_date') ?></th>
  36. <th width="120px"><?php echo lang('label_sj_no') ?></th>
  37. <th width="100px"><?php echo lang('label_status') ?></th>
  38. <th width="70px"><?php echo lang('Approve') ?></th>
  39. <th width="80px"><?php echo lang('label_itemno') ?></th>
  40. <th width="300px"><?php echo lang('label_itemname') ?></th>
  41. <th width="50px" class="right"><?php echo lang('label_qty') ?></th>
  42. <th width="70px"><?php echo lang('label_uom') ?></th>
  43. <th width="100px"><?php echo lang('DlvOrderNo') ?></th>
  44.  
  45. <th width="100px"><?php echo lang('label_so_no') ?></th>
  46. <th width="300px"><?php echo lang('label_remark') ?></th>
  47. <!-- <th width="150px"><?php echo lang('label_date') ?></th> -->
  48. <th width="250px"><?php echo lang('Customer') ?></th>
  49. <th width="200px"><?php echo lang('Customer').' '.lang('Area') ?></th>
  50. <!-- <th width="150px"><?php echo lang('label_date') ?></th> -->
  51. <th width="150px"><?php echo lang('label_pengangkut') ?></th>
  52. <th width="150px"><?php echo lang('label_kontainer_no') ?></th>
  53. <th width="100px"><?php echo lang('label_kendaraan_no') ?></th>
  54. <th width="200px"><?php echo lang('label_warehouse') ?></th>
  55.  
  56. <?php if( ISSET2_('is_viewmoney')): ?>
  57. <th width="200px" class="right"><?php echo lang('label_price') ?></th>
  58. <th width="200px" class="right"><?php echo lang('label_amount') ?></th>
  59. <?php endif; ?>
  60. </tr>
  61. </thead>
  62. <tbody>
  63. <?php $index = 1; ?>
  64. <?php $iiRow = 0; ?>
  65. <?php $prevref = ''; ?>
  66. <?php $grandtotal = 0; ?>
  67. <?php $totAmount = 0; ?>
  68. <?php
  69. if (ISSET2_('is_viewmoney')) {
  70. $totalColumns;
  71. } else {
  72. $totalColumns = $totalColumns - 2;
  73. }
  74.  
  75. $wrapColumns = $totalColumns - 1;
  76. $wrapCol = '';
  77. for ($i=1; $i < $wrapColumns; $i++) {
  78. $wrapCol .= "<td class='hidingrow'></td>";
  79. }
  80. ?>
  81.  
  82. <?php for( $iRow =0; $iRow < $nrows; $iRow++): ?>
  83. <?php $iiRow = $iRow ?>
  84.  
  85. <!-- Handle subtotal -->
  86. <?php if( $mon_popno != $records[$iRow]->HNO_BUK AND $iRow > 0 and ISSET2_('is_viewmoney')): ?>
  87. <tr>
  88. <td colspan="<?php echo $wrapColumns ?>" style="background-color: #ccc;">
  89. <strong>Total</strong>
  90. </td>
  91. <?php echo $wrapCol; ?>
  92. <td class="right">
  93. <strong><?php echo number_format($totAmount); ?></strong>
  94. </td>
  95. </tr>
  96. <?php $mon_popno = $records[$iRow]->HNO_BUK; ?>
  97. <?php $totAmount = 0; ?>
  98. <?php else: ?>
  99. <?php $mon_popno = $records[$iRow]->HNO_BUK; ?>
  100. <?php endif; ?>
  101.  
  102.  
  103. <?php $amount = $records[$iRow]->Harga * $records[$iRow]->Qty; ?>
  104. <?php $totAmount += $amount; ?>
  105. <?php $grandtotal += $amount; ?>
  106. <?php $pop_no = ''; ?>
  107.  
  108.  
  109. <tr>
  110. <td><?php echo $index ?></td>
  111. <td><?php list($strdate, $void) = GROUP_VALUE(
  112. $records[$iRow]->HNO_BUK,
  113. $prevref,
  114. date('d-m-Y', strtotime($records[$iRow]->Tgl))
  115. );
  116. echo $strdate; ?></td>
  117. <td><?php list($po_no, $prevref) = GROUP_VALUE(
  118. $records[$iRow]->HNO_BUK,
  119. $prevref,
  120. $records[$iRow]->HNO_BUK
  121. );
  122. // echo '<strong>'.$po_no.'</strong><br>';
  123. echo '<strong class="txno'.$records[$iRow]->ID.'">'.$po_no.'</strong><br>';
  124. ?>
  125. <?php if( $po_no ): ?>
  126. <a class="btn btn-success btn-xs" title="<?php echo lang('label_edit') ?>" href="<?php echo base_url('sj/add_sj_detail/'. $records[$iRow]->ID) ?>"><i class="fa fa-pencil"></i> </a>
  127. <a class="btn btn-info btn-xs voucher" title="<?php echo lang('Voucher') ?>" href="<?php echo $records[$iRow]->ID ?>"><i class="fa fa-print"></i> </a>
  128. <?php if (!$records[$iRow]->is_approve): ?>
  129. <a class="btn btn-primary btn-xs approve" title="<?php echo lang('Approve') ?>" href="<?php echo $records[$iRow]->ID ?>"><i class="fa fa-check"></i> </a>
  130. <?php endif ?>
  131. <a class="btn btn-danger btn-xs processcancel" title="<?php echo lang('label_cancel') ?>" href="<?php echo $records[$iRow]->ID ?>"><i class="fa fa-remove"></i> </a>
  132. <?php endif; ?>
  133. </td>
  134. <td>
  135. <?php if( $po_no ): ?>
  136. <?php echo TX_STATUS($records[$iRow]->ST_Cetak) ?>
  137. <?php endif; ?></td>
  138. <td align="center"><?php echo $records[$iRow]->B_APP ?></td>
  139. <td><?php echo $records[$iRow]->Kobar ?></td>
  140. <td><?php echo $records[$iRow]->ITEM_DESCRIPTION ?></td>
  141. <td class="right"><?php echo QTY_FORMAT_($records[$iRow]->Qty) ?></td>
  142. <td><?php echo ITEM_UOM( $records[$iRow]->Satuan, $records[$iRow]->STN, $records[$iRow]->STN2 ) ?></td>
  143. <td><?php echo $records[$iRow]->Ref ?></td>
  144. <td><?php echo $records[$iRow]->NO_SO ?></td>
  145. <td><?php echo $records[$iRow]->HKET ?></td>
  146. <!-- <td><?php echo date('d-m-Y', strtotime($records[$iRow]->DO_DATE)) ?></td> -->
  147. <td><?php echo $records[$iRow]->NAMA_CUST ?></td>
  148. <td><?php echo $records[$iRow]->CUST_WIL ?></td>
  149. <!-- <td><?php echo date('d-m-Y', strtotime($records[$iRow]->SO_DATE)) ?></td> -->
  150. <td><?php echo $records[$iRow]->NAMA_SOPIR ?></td>
  151. <td><?php echo $records[$iRow]->CATATAN_1 ?></td>
  152. <td><?php echo $records[$iRow]->NO_POLISI ?></td>
  153. <td><?php echo $records[$iRow]->NAMA_GUDANG ?></td>
  154.  
  155. <?php if ( isset($is_viewmoney)): ?>
  156. <td class="right"><?php echo number_format($records[$iRow]->Harga)?></td>
  157. <td class="right"><?php echo number_format($amount)?></td>
  158. <?php endif; ?>
  159. </tr>
  160. <?php $index++; ?>
  161. <?php endfor; ?>
  162.  
  163. <?php if( $nrows > 0 and ISSET2_('is_viewmoney')): ?>
  164. <tr>
  165. <td colspan="<?php echo $wrapColumns ?>" style="background-color: #ccc;">
  166. <strong>Total</strong>
  167. </td>
  168. <?php echo $wrapCol; ?>
  169. <td class="right">
  170. <strong><?php echo number_format($totAmount); ?></strong>
  171. </td>
  172. </tr>
  173. <?php $totAmount = 0; ?>
  174. <?php endif; ?>
  175.  
  176. <?php if( ISSET2_('is_viewmoney')): ?>
  177. <tr>
  178. <td colspan="<?php echo $wrapColumns ?>" style="background-color: #ccc;">
  179. <strong><?php echo lang('label_net') ?></strong>
  180. </td>
  181. <?php echo $wrapCol; ?>
  182. <td class="right">
  183. <strong><?php echo number_format($grandtotal); ?></strong>
  184. </td>
  185. </tr>
  186. <?php endif; ?>
  187. </tbody>
  188. </table>
  189. <div class="col-sm-12">&nbsp;</div>
  190. <div class="col-sm-12">&nbsp;</div>
  191. <div class="recvtable modal fade">
  192. <div class="modal-dialog" style="width: 800px">
  193. <div class="modal-content">
  194. <div class="modal-header">
  195. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  196. <h4 class="modal-title"><?php echo lang('label_receivedqty') ?></h4>
  197. </div>
  198. <div class="modal-body">
  199. <div class="row col-lg-12 recvmutation">Loading...</div>
  200. <div class="row">&nbsp;</div>
  201. <div>&nbsp;</div>
  202. <div>&nbsp;</div>
  203. </div>
  204. <div class="modal-footer">
  205. <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo lang('button_close') ?></button>
  206. </div>
  207. </div><!-- /.modal-content -->
  208. </div><!-- /.modal-dialog -->
  209. </div>
  210. <div class="modal errordialog fade">
  211. <div class="modal-dialog">
  212. <div class="modal-content">
  213. <div class="modal-header">
  214. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  215. <h4 class="modal-title"><?php echo lang('Info') ?></h4>
  216. </div>
  217. <div class="modal-body">
  218. <p class="errorpan"></p>
  219. </div>
  220. <div class="modal-footer">
  221. <button type="button" class="btn btn-default" data-dismiss="modal" ><?php echo lang('button_close') ?></button>
  222. </div>
  223. </div><!-- /.modal-content -->
  224. </div><!-- /.modal-dialog -->
  225. </div>
  226. <div class="voucher_frame hide"></div>
  227. <div class="voucher_modal modal fade"></div>
  228. <script>
  229. $.ajaxSetup({cache: false, async: false});
  230. var totalColom = $('.mytable td').length;
  231. var totalColom1 = $('.mytable th').length;
  232. console.log(totalColom, totalColom1);
  233.  
  234. $(".datacontainer").on("click",".recvqty",function(event){
  235.  
  236. event.preventDefault();
  237. $(".recvtable").modal('show');
  238.  
  239. $(".recvmutation").load("<?php echo base_url('po/recvmutation') ?>/" + $(this).attr('href') + "/" + Math.random(1000000));
  240. });
  241.  
  242. $(".voucher").click(function(event){
  243. var id = $(this).attr('href');
  244. var txno = $(".txno"+id).html();
  245.  
  246. var cnf = confirm("Are you sure want to print "+txno+" ?");
  247. if(cnf) {
  248. $(".voucher_frame").html('<iframe src="<?php echo base_url('sj/voucher_sj_customer')?>/'+ id +'/'+'"></iframe>');
  249. $(".status" + id).html("<?php echo lang('status_print') ?>");
  250. return false;
  251. }
  252.  
  253. return false;
  254. });
  255. $(".approve").click(function(e) {
  256. e.preventDefault();
  257. var id = $(this).attr('href');
  258. var txno = $(".txno"+id).html();
  259.  
  260. var cnf = confirm("Are you sure want to Approve "+txno+" ?");
  261.  
  262. if(cnf) {
  263. $.ajax({
  264. url: '<?php echo base_url('sj/approve_header') ?>/'+id,
  265. success: function(resp) {
  266. var res = JSON.parse(resp);
  267. if(res.error == '1') {
  268. $(".errordialog").modal('show');
  269. $(".errorpan").html(res.message);
  270. } else {
  271. $(".bapp" + id).html(res.bapp);
  272. }
  273. }
  274. });
  275. } else
  276. return false;
  277. });
  278.  
  279. $(".recvmutation").on("click", ".ref", function(event){
  280. event.preventDefault();
  281.  
  282. $(".refmodal").modal('show');
  283.  
  284. $(".podata").load("<?php echo base_url('po/view_pono') ?>/" + $(this).attr('href') + "/" + Math.random(1000000));
  285. });
  286.  
  287. $(".processcancel").click(function(event){
  288.  
  289. event.preventDefault();
  290. var id = $(this).attr('href');
  291. var txno = $(".txno"+id).html();
  292.  
  293. var cnf = confirm("Are you sure to cancel TX: "+txno+"?");
  294.  
  295. if(!cnf)
  296. {
  297. return false;
  298. }
  299.  
  300. $.ajax({
  301. url : "<?php echo base_url('sj/cancel')?>/" + id,
  302. async: false,
  303. success : function(msg){
  304. var res = JSON.parse(msg);
  305. $(".errorpan").html(res.message);
  306. $(".errordialog").modal('show');
  307.  
  308. if(res.error == 0) {
  309. $(".status" + id).html("Batal/Cancel");
  310. $(".errorpan").html(res.message);
  311. $(".errordialog").modal('show');
  312. }
  313. }
  314. });
  315. return false;
  316. });
  317. var excel_file_name = 'SJ Overview ';
  318. var opt_remark = '';
  319.  
  320. if(!$("#search_form input[name='datefrom']").val()) {
  321. opt_remark = 'in ' + $(".this-month").text();
  322. } else {
  323. opt_remark = 'from ' + $("#search_form input[name='datefrom']").val() + ' to ' + $("#search_form input[name='dateto']").val();
  324. }
  325.  
  326. $(".mytable").DataTable({
  327. dom: 'B<i>t',
  328. scrollY: '<?php echo datatable_scrollY() ?>',
  329. scrollX: true,
  330. paging: false,
  331. ordering: false,
  332. bFilter: false,
  333. info: false,
  334. columnDefs: [
  335. { className: "right", targets: [7] },
  336. { className: "center", targets: [1,2,3,4,9,10,16] }
  337. ],
  338. fixedColumns: {
  339. leftColumns: 4
  340. },
  341. buttons: [
  342. {
  343. className: 'btn btn-success',
  344. extend: 'excel',
  345. text: 'Export to Excel',
  346. exportOptions: {
  347. modifier: {
  348. page: 'current'
  349. }
  350. },
  351. filename: excel_file_name.concat(opt_remark)
  352. }
  353. ]
  354. });
  355. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement