PageRenderTime 53ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/magehelp/application/views/procurement/purchase_order_grid_bk.php

https://bitbucket.org/jit_bec/shopifine
PHP | 373 lines | 248 code | 53 blank | 72 comment | 3 complexity | 0e86e499aa2faca2d063a28df4a18069 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:30%;
  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: 45em;
  22. }
  23. .ui-combobox-input{
  24. width:23em;
  25. }
  26. #supplierOp-input{
  27. width:10em;
  28. }
  29. #warehouseOp-input{
  30. width:10em;
  31. }
  32. .calculated {
  33. color: green;
  34. font-size: 90%;
  35. }
  36. .row{
  37. width:95%;
  38. }
  39. .shopifine-ro-label {
  40. float: left;
  41. padding-right: 0.5em;
  42. width: 50%;
  43. word-wrap: break-word;
  44. color:#2E6E9E;
  45. }
  46. .shopifine-output {
  47. float: right;
  48. width: 45%;
  49. word-wrap: break-word;
  50. font-weight:bold;
  51. }
  52. </style>
  53. <script type="text/javascript">
  54. $(function() {
  55. //form validation
  56. $("#quoteForm").validate();
  57. $("#itemForm").validate();
  58. // datepicker for Add Form
  59. function quotegriddates(id){
  60. jQuery("#"+id+"_needed_by_date","#orders").datepicker({dateFormat:"yy-mm-dd",minDate:0});
  61. }
  62. //end datepicker
  63. var myGridPkd = $("#lineItems");
  64. $( "#dialog-form" ).dialog({
  65. autoOpen: false,
  66. height: 'auto',
  67. width: '52%',
  68. modal: true,
  69. buttons: {
  70. "DoneButton": {
  71. id:"doneBtn",
  72. text:"Create Quote",
  73. click:function() {
  74. var isValid = $("#quoteForm").valid();
  75. if (isValid){
  76. $.ajax({url:"index.php/procurement/createPO",
  77. type:"POST",
  78. data:{ orderId:$("#orderId").val(),
  79. supplierId:$("#supplierOp").val(),
  80. warehouseId:$("#warehouseOp").val(),
  81. reqdate:$("#reqdate").val(),
  82. notes:$("#desc").val()
  83. },
  84. success:function(response)
  85. {}
  86. }) //end ajax
  87. if ($("#orderId").val()!=""){
  88. $( this ).dialog( "close" );
  89. }
  90. } //end ifvalid
  91. }}, //end of Create button
  92. Cancel: function() {
  93. $("#orderId").val("");
  94. $( this ).dialog( "close" );
  95. }
  96. },//end buttons
  97. open: function(){
  98. $('#tabs-movie').tabs({
  99. create: function(e, ui) {
  100. $('#closeBtn').click(function() {
  101. $('#dialog-form').dialog('close');
  102. });
  103. }
  104. });
  105. $(this).parent().children('.ui-dialog-titlebar').remove();
  106. // $.ajax({
  107. // method:"POST",
  108. // url:'index.php/procurement/getOrderDetails',
  109. // data:{orderId: myGrid.getGridParam('selrow')},
  110. // success:function(response){
  111. // console.log(response);
  112. // var resJson = JSON.parse(response);
  113. // console.log(resJson);
  114. //
  115. // $("#supplierOP").text(resJson.quote_supplier_name);
  116. // $("#warehouseOP").text(resJson.quote_warehouse);
  117. // $("#quoteOP").text(resJson.quote_reference);
  118. // $("#raisedByOP").text(resJson.quote_raised_by_name);
  119. // $("#approvedByOP").text(resJson.quote_approved_by_name);
  120. // $("#estValueOP").text(resJson.quote_estimated_value);
  121. // }
  122. // })
  123. // $("#lineItems").jqGrid({
  124. // url:'index.php/procurement/populateOrderItems',
  125. // datatype: 'json',
  126. // mtype: 'POST',
  127. // postData:{orderId: myGrid.getGridParam('selrow')},
  128. // colNames:['Product','Quantity','Need By Date','Expected Price','Estimated Value',/*'Notes'*/],
  129. // colModel :[
  130. // {name:'name', index:'name',editable:false, width:80, align:'right'},
  131. // {name:'quoted_quantity', index:'quoted_quantity', editable:true,width:140, align:'right'},
  132. // {name:'needed_by_date',index:'needed_by_date',editable:true, width:80, align:'right'},
  133. // {name:'expected_price',index:'expected_price',editable:true, width:80, align:'right'},
  134. // {name:'estimated_value', index:'estimated_value',editable:false, width:80, align:'right'},
  135. //// {name:'comments', index:'comments',editable:true, width:180, align:'right'}
  136. //
  137. // ],
  138. // pager: '#pagerPk',
  139. // rowNum:10,
  140. // rowList:[5,10,20],
  141. // sortname: 'id',
  142. // sortorder: 'desc',
  143. // viewrecords: true,
  144. // gridview: true,
  145. // ignoreCase:true,
  146. // rownumbers:true,
  147. // height:'auto',
  148. // width:'50%',
  149. // caption: 'Line Items',
  150. //
  151. // jsonReader : {
  152. // root:"quoteitemdata",
  153. // page: "page",
  154. // total: "total",
  155. // records: "records",
  156. // cell: "dprow",
  157. // id: "id"
  158. // }
  159. //
  160. // }).navGrid("#pagerPk",{edit:false,add:false,del:true,search:false},{},{},{},{},{});
  161. },
  162. close: function() {
  163. //allFields.val( "" ).removeClass( "ui-state-error" );
  164. $("#quoteForm").data('validator').resetForm();
  165. $("#quoteForm")[0].reset();
  166. myGridPkd.jqGrid("GridUnload");
  167. $("pkdheader").hide();
  168. $("#doneBtn > span").text("Create Quote");
  169. $("#orders").trigger("reloadGrid");
  170. }
  171. });
  172. // Main Request For Quotation Grid
  173. var myGrid = $("#orders"),lastsel2;
  174. var editparameters = {
  175. "keys" : true,
  176. "oneditfunc" : quotegriddates,
  177. "successfunc" : function(){
  178. lastsel2=undefined;
  179. myGrid.trigger("reloadGrid");
  180. return true;
  181. },
  182. "aftersavefunc" : null,
  183. "errorfunc": function(){
  184. lastsel2=undefined;
  185. //myGrid.trigger("reloadGrid");
  186. },
  187. "afterrestorefunc" : null,
  188. "restoreAfterError" : true,
  189. "mtype" : "POST"
  190. };
  191. myGrid.jqGrid({
  192. url:'index.php/procurement/populatePO',
  193. datatype: 'json',
  194. mtype: 'GET',
  195. colNames:['Reference','Supplier','Estimated Value',/*'Owner',*/'Status','Raised By',/*'Owner',*/'Needed By Date'],
  196. colModel :[
  197. {name:'reference', index:'reference', width:80, align:'right',editable:false},
  198. {name:'quote_supplier_name', index:'supplier_name', width:140, align:'right',editable:false},
  199. {name:'quote_estimated_value', index:'estimated_value', width:100, align:'right',editable:false,editoptions:{size:"20",maxlength:"30"}},
  200. // {name:'owner', index:'owner', width:140, align:'right',editable:true,editoptions:{size:"20",maxlength:"30"}},
  201. {name:'status', index:'status', width:60, align:'right',editable:false,editoptions:{size:"20",maxlength:"30"}},
  202. {name:'quote_raised_by_name', index:'raised_by_name',editable:false, width:80, align:'right'},
  203. // {name:'owner_name', index:'owner_name',editable:false, width:80, align:'right'},
  204. {name:'quote_needed_by_date', index:'needed_by_date',editable:false, width:120, sorttype:'date'}
  205. ],
  206. pager: '#pager',
  207. rowNum:10,
  208. rowList:[5,10,20],
  209. sortname: 'id',
  210. sortorder: 'desc',
  211. viewrecords: true,
  212. gridview: true,
  213. multiselect:true,
  214. ignoreCase:true,
  215. rownumbers:true,
  216. height:'auto',
  217. width:680,
  218. caption: 'Request For Quote',
  219. jsonReader : {
  220. root:"quotedata",
  221. page: "page",
  222. total: "total",
  223. records: "records",
  224. cell: "dprow",
  225. id: "id"
  226. },
  227. onSelectRow: function(id){if(id && id!==lastsel2){
  228. myGrid.restoreRow(lastsel2);
  229. myGrid.editRow(id,editparameters);
  230. lastsel2=id;
  231. }
  232. }
  233. ,editurl:'index.php/procurement/modifyOrder'
  234. ,subGrid:true,
  235. subGridRowExpanded: function(subgrid_id, row_id) {
  236. // we pass two parameters
  237. // subgrid_id is a id of the div tag created whitin a table data
  238. // the id of this elemenet is a combination of the "sg_" + id of the row
  239. // the row_id is the id of the row
  240. // If we wan to pass additinal parameters to the url we can use
  241. // a method getRowData(row_id) - which returns associative array in type name-value
  242. // here we can easy construct the flowing
  243. var subgrid_table_id, pager_id;
  244. subgrid_table_id = subgrid_id+"_t";
  245. pager_id = "p_"+subgrid_table_id;
  246. $("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>");
  247. jQuery("#"+subgrid_table_id).jqGrid({
  248. url:'index.php/procurement/populateOrderItems?q=2&orderId='+row_id,
  249. datatype: 'json',
  250. colNames:['Product','Quantity','Need By Date','Unit Price','Estimated Value','Notes'],
  251. colModel :[
  252. {name:'name', index:'name',editable:false, width:120, align:'right'},
  253. {name:'quoted_quantity', index:'quoted_quantity', editable:false,width:50, align:'right'},
  254. {name:'needed_by_date',index:'needed_by_date',editable:false, width:80, align:'right'},
  255. {name:'expected_price',index:'expected_price',editable:false, width:50, align:'right'},
  256. {name:'estimated_value', index:'estimated_value',editable:false, width:60, align:'right'},
  257. {name:'comments', index:'comments',editable:false, width:180, align:'right'}
  258. ],
  259. rowNum:20,
  260. pager: pager_id,
  261. sortname: 'id',
  262. sortorder: "asc",
  263. height: '100%',
  264. jsonReader : {
  265. root:"quoteitemdata",
  266. page: "page",
  267. total: "total",
  268. records: "records",
  269. cell: "dprow",
  270. id: "id"
  271. }
  272. });
  273. jQuery("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{edit:false,add:false,del:false,search:false,view:true});
  274. }
  275. }).navGrid("#pager",{edit:false,add:false,view:true,del:true,search:false},{height:280,reloadAfterSubmit:false,closeAfterEdit:true,recreateForm:true,checkOnSubmit:true},{},{},{},{});
  276. myGrid.jqGrid('navButtonAdd','#pager',{
  277. caption:"",
  278. title:"Create Product",
  279. buttonicon:"ui-icon-plus",
  280. id:"add_orders",
  281. onClickButton : function () {
  282. $( "#dialog-form" ).dialog( "open" );
  283. }
  284. });
  285. myGrid.jqGrid('navButtonAdd','#pager',{
  286. caption:"",
  287. title:"Generate Purchase Order",
  288. buttonicon:"ui-icon-cart",
  289. id:"po_orders",
  290. onClickButton : function () {
  291. $( "#dialog-form" ).dialog( "open" );
  292. }
  293. });
  294. myGrid.jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch : "cn"});
  295. $("#del_orders").insertAfter("#add_orders");
  296. });
  297. </script>
  298. </head>
  299. <body>
  300. <?php $this->load->view("common/menubar"); ?>
  301. <div id ="dialog-form">
  302. <h1 id="formHeader">Purchase Order Details</h1>
  303. <div id="tabs-movie">
  304. <ul>
  305. <li><a href="form.html">Information</a></li>
  306. <li><a href="notes.html">Cast List</a></li>
  307. <li class="ui-tabs-close-button"><button id="closeBtn">X</button></li>
  308. </ul>
  309. </div>
  310. </div>
  311. <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">
  312. <div class="table-grid">
  313. <h1 id="table header">Request For Quotations</h1>
  314. <table id="orders"><tr><td/></tr></table>
  315. <div id="pager"></div>
  316. </div>
  317. </div>
  318. <?php $this->load->view("partial/footer"); ?>
  319. </body>
  320. </html>