PageRenderTime 42ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/magehelp/application/views/procurement/purchaseorder/received/received_order_grid_1.php

https://bitbucket.org/jit_bec/shopifine
PHP | 313 lines | 248 code | 44 blank | 21 comment | 12 complexity | 23448ee7c995ece8e796ca170ace7943 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/populateReceipts?status=readytoinvoicememo",
  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:100, align:'right',editable:false},
  107. {name:'supplier_receipt_number',width:140, 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:100, 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:100, align:'right'},
  114. {name:'quote_reference', index:'quote_reference',editable:false, width:100, 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. //
  153. var settingObj = {grid_id:subgrid_table_id,pager:pager_id,multiselect:false};
  154. var hiddenObj = {line_reference:true,pp_quantity:true,pp_value:true,receiving_notes:true,returned_notes:true};
  155. prepareReceiptItemsGrid(settingObj,{oper:'receipt',receiptId:row_id},false,{},hiddenObj)
  156. }
  157. }).navGrid("#pager",{edit:false,add:false,view:false,del:false,search:false},{height:280,reloadAfterSubmit:false,closeAfterEdit:true,recreateForm:true,checkOnSubmit:true},{},{},{},{});
  158. myGrid.jqGrid('navButtonAdd','#pager',{
  159. caption:"",
  160. title:"Create Invoice And Memo" ,
  161. buttonicon:"ui-icon-note",
  162. id:"add_orders",
  163. onClickButton : function () {
  164. var selectRows = myGrid.getGridParam('selarrrow');
  165. var noOfRows = selectRows.length;
  166. var orderId = 0;
  167. var mismatch = 0;
  168. if (noOfRows ==0){
  169. $( "#modal-warning" ).dialog("open");
  170. }
  171. else if (noOfRows > 0){
  172. for (i=0;i<noOfRows;i++){
  173. //console.log(selectRows[i]);
  174. var newOrderId = myGrid.getCell(selectRows[i],'order_id');
  175. //console.log(newOrderId);
  176. if (orderId==0){
  177. orderId = newOrderId;
  178. }
  179. else if (newOrderId!=orderId){
  180. $( "#modal-warning-order" ).dialog("open");
  181. mismatch = 1;
  182. break;
  183. }
  184. }
  185. if (mismatch==0){
  186. $.ajax({
  187. type:"POST",
  188. url:"index.php/procurement/createInvoiceMemoUpdateOrderReceipt",
  189. data:{receipt_ids:selectRows,
  190. order_id:orderId},
  191. success:function (jqXHR){
  192. emptyMessages();
  193. var jsonRes = JSON.parse(jqXHR);
  194. if (jsonRes.invoice_id!=null){
  195. showSuccessMessage("Invoice No Inv-" + jsonRes.invoice_id + " Is Created Successfully");
  196. }
  197. if (jsonRes.memo_id!=null){
  198. showSuccessMessage("CreditMemo No CM-" + jsonRes.memo_id + " Is Created Successfully");
  199. }
  200. myGrid.trigger("reloadGrid");
  201. }
  202. })
  203. }
  204. }
  205. }
  206. });
  207. myGrid.jqGrid('navButtonAdd','#pager',{
  208. caption:"",
  209. title:"Submit For Approval",
  210. buttonicon:"ui-icon-flag",
  211. id:"approved_orders",
  212. onClickButton : function () {
  213. var selectRows = myGrid.getGridParam('selarrrow');
  214. var noOfRows = selectRows.length;
  215. if (noOfRows ==0){
  216. $( "#modal-warning" ).dialog("open");
  217. }
  218. else
  219. $.ajax({
  220. type:"POST",
  221. url:"index.php/procurement/submitForApprovalBeforeInvoice",
  222. data:{receipt_ids:selectRows
  223. },
  224. success:function (jqXHR){
  225. emptyMessages();
  226. showSuccessMessage(" Selected Records Have Been Submitted For Approval");
  227. myGrid.trigger("reloadGrid");
  228. },
  229. error:function (jqXHR){
  230. emptyMessages();
  231. showErrorMessage(" Selected Records Could Not Be Submitted For Approval Due To Internal Error");
  232. }
  233. })
  234. }
  235. });
  236. myGrid.jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch : "cn"});
  237. //$("#del_orders").insertAfter("#add_orders");
  238. $( "#modal-warning" ).dialog({
  239. autoOpen:false,
  240. height: 80,
  241. modal: true
  242. });
  243. $( "#modal-warning-order" ).dialog({
  244. autoOpen:false,
  245. height: 80,
  246. modal: true
  247. });
  248. });
  249. </script>
  250. </head>
  251. <body>
  252. <?php $this->load->view("common/menubar"); ?>
  253. <div id="modal-warning" title="Warning">
  254. <p>Please Select Row(s)</p>
  255. </div>
  256. <div id="modal-warning-order" title="Warning">
  257. <p>Please Select Receipt with The Same Order Reference</p>
  258. </div>
  259. <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">
  260. <?php $this->load->view("common/message"); ?>
  261. <div class="table-grid">
  262. <h1 id="table header">Create Invoice</h1>
  263. <table id="orders"><tr><td/></tr></table>
  264. <div id="pager"></div>
  265. </div>
  266. </div>
  267. <?php $this->load->view("partial/footer"); ?>
  268. </body>
  269. </html>