PageRenderTime 49ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/magehelp/application/views/impex/update_price.php

https://bitbucket.org/jit_bec/shopifine
PHP | 219 lines | 187 code | 27 blank | 5 comment | 15 complexity | 266db1525d93f07e5ab0f2e9ab0379cf MD5 | raw file
Possible License(s): LGPL-3.0
  1. <!--
  2. To change this template, choose Tools | Templates
  3. and open the template in the editor.
  4. -->
  5. <!DOCTYPE html>
  6. <html>
  7. <html>
  8. <head>
  9. <?php $this->load->view("common/header"); ?>
  10. <style type="text/css">
  11. .menu_item {
  12. display: inline;
  13. }
  14. </style>
  15. <style type="text/css">
  16. #menubar_admin_navigation {
  17. top:49px;
  18. }
  19. #content_area {width:100%;height:auto;}
  20. .logoauth {color:green;}
  21. .shopifine-ui-dialog-buttonset {
  22. float: left;
  23. margin: 1em;
  24. padding-left: 2em;
  25. }
  26. .shopifine-ui-widget-content {
  27. border:none;
  28. }
  29. </style>
  30. <script>
  31. $(function() {
  32. var idsOfSelectedRows =[];
  33. var updateIdsOfSelectedRows = function (id, isSelected) {
  34. var contains = $.inArray(id, idsOfSelectedRows)
  35. //idsOfSelectedRows.contains(id);
  36. if (!isSelected && contains>-1) {
  37. for(var i=0; i<idsOfSelectedRows.length; i++) {
  38. if(idsOfSelectedRows[i] == id) {
  39. idsOfSelectedRows.splice(i, 1);
  40. break;
  41. }
  42. }
  43. }
  44. else if (contains==-1) {
  45. idsOfSelectedRows.push(id);
  46. }
  47. console.log(idsOfSelectedRows);
  48. };
  49. var myGrid = $("#product_price");
  50. myGrid.jqGrid({
  51. url:'index.php/impex/populateProductsPrice',
  52. datatype: 'json',
  53. mtype: 'GET',
  54. colNames:['Barcode','Product Name','Total Cost Inventory','Inventory Qty','Avg Cost Price','VAT',
  55. /*'Salex Tax',*/'Margin Type','Margin Value','Final Price'],
  56. colModel :[
  57. // {name:'product_id', index:'product_id', align:'right',hidden:true},
  58. {name:'barcode', index:'barcode', width:150, align:'right',editable:false},
  59. {name:'product_name', index:'product_name', width:150, align:'right',editable:false},
  60. {name:'inv_total_cost', index:'inv_total_cost', width:120, align:'right'},
  61. {name:'total_balance', index:'total_balance', width:80, align:'right',editable:false},
  62. {name:'inv_cost_price', index:'inv_cost_price', align:'right',width:70},
  63. {name:'vat', index:'vat', width:70, align:'right'},
  64. // {name:'sales_tax', index:'sales_tax', width:70, align:'right',editable:false},
  65. {name:'margin_type', index:'margin_type', align:'right',width:70},
  66. {name:'margin_value', index:'margin_value', width:80, align:'right'},
  67. {name:'default_calculated', index:'default_calculated', width:70, align:'right'}
  68. ],
  69. pager: '#pager',
  70. rowNum:10,
  71. rowList:[10,20,50],
  72. sortname: 'product_id',
  73. sortorder: 'desc',
  74. viewrecords: true,
  75. gridview: true,
  76. ignoreCase:true,
  77. rownumbers:true,
  78. height:'auto',
  79. multiselect:true,
  80. caption: 'Price Calculation Table',
  81. jsonReader : {
  82. root:"productstockdata",
  83. page: "page",
  84. total: "total",
  85. records: "records",
  86. cell: "dprow",
  87. id: "product_id"
  88. },
  89. onSelectRow: function(rowid, status){
  90. updateIdsOfSelectedRows(rowid, status);
  91. },
  92. onSelectAll: function (aRowids, status) {
  93. var i, count, id;
  94. for (i = 0, count = aRowids.length; i < count; i++) {
  95. id = aRowids[i];
  96. updateIdsOfSelectedRows(id, status);
  97. }
  98. }
  99. }).navGrid("#pager",{edit:false,add:false,del:false,search:false},
  100. /* edit Option*/ {},
  101. /* Add Option*/ {},
  102. {},{},{});
  103. myGrid.jqGrid('navButtonAdd','#pager',{
  104. caption:"",
  105. title:"Create CSV To Begin Export Process",
  106. buttonicon:"ui-icon-newwin",
  107. onClickButton : function () {
  108. var rowid = myGrid.jqGrid('getGridParam', 'selarrrow');
  109. var noOfRows = rowid.length;
  110. console.log(rowid);
  111. if (noOfRows == 0){
  112. $( "#modal-warning-none" ).dialog("open");
  113. }
  114. else{
  115. $(".inithide").hide();
  116. $.ajax({
  117. url:'index.php/impex/createExportPriceFile',
  118. method:'post',
  119. data:{selected:idsOfSelectedRows},
  120. success:function(response){
  121. var responseObj = JSON.parse(response);
  122. $(".inithide").hide();
  123. if (responseObj.status == "success"){
  124. $("#successCntnr").slideDown("slow");
  125. $("#success-text").text(responseObj.message);
  126. $("#selected_ids_hidden").val(idsOfSelectedRows);
  127. }
  128. else if (responseObj.status == "error"){
  129. $("#failureCntnr").slideDown("slow");
  130. $("#failure-text").text(responseObj.message);
  131. $("#selected_ids_hidden").val("");
  132. }
  133. },
  134. error:function(response){
  135. var responseObj = JSON.parse(response);
  136. $(".inithide").hide();
  137. $("#failureCntnr").show();
  138. $("#failure-text").text("File Could Not Ve Exported Due To Internal Error");
  139. $("#selected_ids_hidden").val("");
  140. }
  141. })
  142. }
  143. }
  144. });
  145. });
  146. </script>
  147. </head>
  148. <body>
  149. <?php $this->load->view("common/menubar"); ?>
  150. <div id="dialog-confirm" title="Warning" class="inithide">
  151. <p><span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
  152. Please See The Console To See If Processing Complete.Sync Only When The Processing Is Over;Else System Will Be Inconsistent and Sync May Not Work. Is Processing Over?</p>
  153. </div>
  154. <div id="mainCntnr" style="display: block;height: auto;" class="shopifine-ui-dialog ui-dialog-medium ui-widget ui-widget-content ui-corner-all" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-dialog-form">
  155. <div class="table-grid">
  156. <h1 id="table-header-price">Product Price</h1>
  157. <table id="product_price"><tr><td/></tr></table>
  158. <div id="pager"></div>
  159. </div>
  160. <div id="successCntnr" class="inithide">
  161. <h1>Export To CSV For New Product Creation Completed</h1>
  162. <h3 id="success-text"></h3>
  163. <div class="ui-dialog-content" style="width: auto; min-height: 65.1333px; height: auto;" scrolltop="0" scrollleft="0">
  164. <!-- <h1 id="formHeader">Add Delivery Point</h1> -->
  165. <form id="deliverypointform" target="iframeMagmi" method="post" action="<?php echo $server_url ?>/magmi/web/magmi.php">
  166. <input type="hidden" name="logfile" value="progress.txt"/>
  167. <input type="hidden" name="mode" value="<?php echo $mode ?>"/>
  168. <input type="hidden" name="profile" value="<?php echo $profile ?>"/>
  169. <input type="hidden" name="run" value="import"/>
  170. <div class="ui-dialog-buttonpane shopifine-ui-widget-content ui-helper-clearfix">
  171. <div class="shopifine-ui-dialog-buttonset">
  172. <input id="magmiBtn" type="submit" class="shopifine-ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false" value="Process For Magento">
  173. </div>
  174. </div>
  175. </form>
  176. </div>
  177. <iframe id="iframeMagmi" name="iframeMagmi" style="height:900px;width:100%" frameborder="no">
  178. </iframe>
  179. </div>
  180. <?php //else: ?>
  181. <div id="faliureCntnr" class="inithide">
  182. <h1 id ="failure-text"></h1>
  183. </div>
  184. </div>
  185. <?php $this->load->view("partial/footer"); ?>
  186. </body>
  187. </html>
  188. <script>
  189. function setOption(){
  190. $("#mode").val("xcreate");
  191. }
  192. </script>