PageRenderTime 51ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/opensourcepos/application/views/procurement/purchaseorder/rejected/receipt_rejected_grid.php

https://bitbucket.org/jit_bec/shopifine
PHP | 312 lines | 244 code | 47 blank | 21 comment | 8 complexity | 79ce935c373a96b2a13bea7dd5c31d67 MD5 | raw file
Possible License(s): LGPL-3.0
  1. <html>
  2. <head>
  3. <?php $this->load->view("common/header"); ?>
  4. <!-- <script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>-->
  5. <style>
  6. .column {
  7. float: left;
  8. padding: 1em;
  9. width:45%;
  10. }
  11. .extra-wide{
  12. width:95%;
  13. }
  14. .field{
  15. width:100%;
  16. }
  17. .ui-widget-header {height:12px;}
  18. .quote-column {
  19. float: left;
  20. padding-bottom: 0.5em;
  21. width: 95%;
  22. }
  23. .ui-combobox {
  24. width:14em;
  25. }
  26. .ui-combobox-input{
  27. width:12em;
  28. }
  29. #supplierOp-input{
  30. width:10em;
  31. }
  32. #warehouseOp-input{
  33. width:10em;
  34. }
  35. .calculated {
  36. color: green;
  37. font-size: 90%;
  38. }
  39. .row{
  40. width:95%;
  41. }
  42. .shopifine-ro-label {
  43. float: left;
  44. padding-right: 0.5em;
  45. width: 50%;
  46. word-wrap: break-word;
  47. color:#2E6E9E;
  48. }
  49. .shopifine-output {
  50. float: right;
  51. width: 45%;
  52. word-wrap: break-word;
  53. font-weight:bold;
  54. }
  55. .ui-tabs {
  56. height: 80%;
  57. margin: 0 auto;
  58. width: 70%;
  59. left:0;
  60. }
  61. #notetab {
  62. height:30em;
  63. }
  64. #details {
  65. height:12em;
  66. }
  67. .ui-tabs-nav{
  68. height:22px;
  69. }
  70. .labeldiv {
  71. color: #2E6E9E;
  72. float: left;
  73. font-size: 110%;
  74. font-weight: bold;
  75. margin-right: .5em;
  76. width: 35%;
  77. word-wrap: break-word;
  78. }
  79. .valuediv {
  80. float: left;
  81. font-weight: bold;
  82. width: 45%;
  83. word-wrap: break-word;
  84. }
  85. label.error {
  86. margin-right: .5em;
  87. }
  88. #status-message-li{
  89. color: red;
  90. font-size: 110%;
  91. font-style: italic;
  92. margin: 0 auto;
  93. width: 80%;
  94. }
  95. </style>
  96. <script type="text/javascript">
  97. $(function() {
  98. // Main Request For Quotation Grid
  99. var myGrid = $("#orders");
  100. myGrid.jqGrid({
  101. url:'index.php/procurement/populateReceived',
  102. datatype: 'json',
  103. mtype: 'GET',
  104. colNames:['Receipt Reference','Supplier Receipt','Supplier',/*'Estimated Value','Owner',*/'Status','Order Id','Order Ref','Quote Ref'/*,'Owner','Needed By Date'*/],
  105. colModel :[
  106. {name:'reference', index:'reference', width:80, align:'right',editable:false},
  107. {name:'supplier_receipt_number', index:'supplier_receipt_number',editable:false,align:'right'},
  108. {name:'supplier_name', index:'supplier_name', width:140, align:'right',editable:false},
  109. // {name:'estimated_value', index:'estimated_value', width:100, align:'right',editable:false,editoptions:{size:"20",maxlength:"30"}},
  110. // {name:'owner', index:'owner', width:140, align:'right',editable:true,editoptions:{size:"20",maxlength:"30"}},
  111. {name:'status', index:'status', width:60, align:'right',editable:false,editoptions:{size:"20",maxlength:"30"}},
  112. {name:'order_id', index:'order_id',hidden:true},
  113. {name:'order_reference', index:'order_reference',editable:false, width:80, align:'right'},
  114. {name:'quote_reference', index:'quote_reference',editable:false, width:80, align:'right'},
  115. // {name:'owner_name', index:'owner_name',editable:false, width:80, align:'right'},
  116. // {name:'needed_by_date', index:'needed_by_date',editable:false, width:120, sorttype:'date'}
  117. ],
  118. pager: '#pager',
  119. rowNum:10,
  120. rowList:[5,10,20],
  121. sortname: 'id',
  122. sortorder: 'desc',
  123. viewrecords: true,
  124. gridview: true,
  125. multiselect:true,
  126. ignoreCase:true,
  127. rownumbers:true,
  128. height:'auto',
  129. width:'90%',
  130. caption: 'Receipts',
  131. jsonReader : {
  132. root:"quotedata",
  133. page: "page",
  134. total: "total",
  135. records: "records",
  136. cell: "dprow",
  137. id: "id"
  138. },
  139. subGrid:true,
  140. subGridRowExpanded: function(subgrid_id, row_id) {
  141. // we pass two parameters
  142. // subgrid_id is a id of the div tag created whitin a table data
  143. // the id of this elemenet is a combination of the "sg_" + id of the row
  144. // the row_id is the id of the row
  145. // If we wan to pass additinal parameters to the url we can use
  146. // a method getRowData(row_id) - which returns associative array in type name-value
  147. // here we can easy construct the flowing
  148. var subgrid_table_id, pager_id;
  149. subgrid_table_id = subgrid_id+"_t";
  150. pager_id = "p_"+subgrid_table_id;
  151. $("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>");
  152. jQuery("#"+subgrid_table_id).jqGrid({
  153. url:'index.php/procurement/populateReceiptItems?oper='+"receipt"+'&receiptId='+row_id,
  154. datatype: 'json',
  155. colNames:['Supplier Receipt','Reference','Receipt Id','Order Line Id','Product Id','Product','Qty','Qty Rcvd','Rcvd Value','Qty Rtrnd','Rtrnd Value','Rcvd Notes','Rtrnd Notes'],
  156. colModel :[
  157. {name:'supplier_receipt_number', index:'supplier_receipt_number',editable:false,width:120, align:'right'},
  158. {name:'reference', index:'reference',editable:false,width:60, align:'right'},
  159. {name:'receipt_id', index:'receipt_id',editable:false, hidden:true},
  160. {name:'order_line_id', index:'order_line_id',editable:false, hidden:true},
  161. {name:'product_id', index:'product_id',editable:false, hidden:true},
  162. {name:'name', index:'name',editable:false, width:100, align:'right'},
  163. {name:'ordered_quantity', index:'ordered_quantity', editable:false,width:60, align:'right'},
  164. {name:'received_quantity', index:'received_quantity', editable:false,width:60, align:'right'},
  165. {name:'received_value', index:'received_value',editable:false, width:80, align:'right'},
  166. {name:'returned_quantity', index:'returned_quantity', editable:false,width:60, align:'right'},
  167. {name:'returned_value', index:'returned_value',editable:false, width:80, align:'right'},
  168. {name:'receiving_notes', index:'receiving_notes',editable:false, width:160, align:'right',hidden:true},
  169. {name:'returned_notes', index:'returned_notes', editable:false,width:160, align:'right',hidden:true}
  170. // {name:'comments', index:'comments',editable:false, width:160, align:'right'}
  171. ],
  172. rowNum:20,
  173. pager: pager_id,
  174. sortname: 'id',
  175. sortorder: "asc",
  176. height: '100%',
  177. multiselect:true,
  178. jsonReader : {
  179. root:"receiptitemdata",
  180. page: "page",
  181. total: "total",
  182. records: "records",
  183. cell: "dprow",
  184. id: "id"
  185. }
  186. });
  187. jQuery("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{edit:false,add:false,del:false,search:false,view:true});
  188. }
  189. }).navGrid("#pager",{edit:false,add:false,view:false,del:false,search:false},{height:280,reloadAfterSubmit:false,closeAfterEdit:true,recreateForm:true,checkOnSubmit:true},{},{},{},{});
  190. myGrid.jqGrid('navButtonAdd','#pager',{
  191. caption:"",
  192. title:"Match With Received Goods",
  193. buttonicon:"ui-icon-circle-check",
  194. id:"add_orders",
  195. onClickButton : function () {
  196. var selectRows = myGrid.getGridParam('selarrrow');
  197. var noOfRows = selectRows.length;
  198. var orderId = 0;
  199. var mismatch = 0;
  200. if (noOfRows ==0){
  201. $( "#modal-warning" ).dialog("open");
  202. }
  203. else if (noOfRows > 0){
  204. for (i=0;i<noOfRows;i++){
  205. //console.log(selectRows[i]);
  206. var newOrderId = myGrid.getCell(selectRows[i],'order_id');
  207. //console.log(newOrderId);
  208. if (orderId==0){
  209. orderId = newOrderId;
  210. }
  211. else if (newOrderId!=orderId){
  212. $( "#modal-warning-order" ).dialog("open");
  213. mismatch = 1;
  214. break;
  215. }
  216. }
  217. if (mismatch==0){
  218. $.ajax({
  219. type:"POST",
  220. url:"index.php/procurement/createInvoiceUpdateOrderReceipt",
  221. data:{receipt_ids:selectRows,
  222. order_id:orderId},
  223. success:function (jqXHR){
  224. emptyMessages();
  225. showSuccessMessage("Invoice No Inv-" + jqXHR + " Has Been Created Successfully");
  226. }
  227. })
  228. }
  229. }
  230. }
  231. });
  232. myGrid.jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch : "cn"});
  233. //$("#del_orders").insertAfter("#add_orders");
  234. $( "#modal-warning" ).dialog({
  235. autoOpen:false,
  236. height: 80,
  237. modal: true
  238. });
  239. $( "#modal-warning-order" ).dialog({
  240. autoOpen:false,
  241. height: 80,
  242. modal: true
  243. });
  244. });
  245. </script>
  246. </head>
  247. <body>
  248. <?php $this->load->view("common/menubar"); ?>
  249. <div id="modal-warning" title="Warning">
  250. <p>Please Select Row(s)</p>
  251. </div>
  252. <div id="modal-warning-order" title="Warning">
  253. <p>Please Select Receipt with The Same Order Reference</p>
  254. </div>
  255. <div style="display: block;height: 100%;" class="shopifine-ui-dialog ui-widget ui-widget-content ui-corner-all" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-dialog-form">
  256. <?php $this->load->view("common/message"); ?>
  257. <div class="table-grid">
  258. <h1 id="table header">Create Invoice</h1>
  259. <table id="orders"><tr><td/></tr></table>
  260. <div id="pager"></div>
  261. </div>
  262. </div>
  263. <?php $this->load->view("partial/footer"); ?>
  264. </body>
  265. </html>