PageRenderTime 45ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/jit_bec/shopifine
PHP | 426 lines | 355 code | 59 blank | 12 comment | 3 complexity | 56f2b1143b8f72149a13c626b39701eb 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. .base-column{
  12. width:100%;
  13. }
  14. #content_area{
  15. width:1100px;
  16. }
  17. .extra-wide{
  18. width:95%;
  19. }
  20. .field{
  21. width:100%;
  22. }
  23. .ui-widget-header {height:12px;}
  24. .quote-column {
  25. float: left;
  26. padding-bottom: 0.5em;
  27. width: 95%;
  28. }
  29. .ui-combobox {
  30. width:14em;
  31. }
  32. .ui-combobox-input{
  33. width:12em;
  34. }
  35. #supplierOp-input{
  36. width:10em;
  37. }
  38. #warehouseOp-input{
  39. width:10em;
  40. }
  41. .calculated {
  42. color: green;
  43. font-size: 90%;
  44. }
  45. .row{
  46. width:95%;
  47. }
  48. .shopifine-ro-label {
  49. float: left;
  50. padding-right: 0.5em;
  51. width: 50%;
  52. word-wrap: break-word;
  53. color:#2E6E9E;
  54. }
  55. .shopifine-output {
  56. float: right;
  57. width: 45%;
  58. word-wrap: break-word;
  59. font-weight:bold;
  60. }
  61. .ui-tabs {
  62. height: 80%;
  63. margin: 0 auto;
  64. width: 70%;
  65. left:0;
  66. }
  67. #notetab {
  68. height:30em;
  69. }
  70. #details {
  71. height:12em;
  72. }
  73. .ui-tabs-nav{
  74. height:22px;
  75. }
  76. .labeldiv {
  77. color: #2E6E9E;
  78. float: left;
  79. font-size: 110%;
  80. font-weight: bold;
  81. margin-right: .5em;
  82. width: 35%;
  83. word-wrap: break-word;
  84. }
  85. .valuediv {
  86. float: left;
  87. font-weight: bold;
  88. width: 45%;
  89. word-wrap: break-word;
  90. }
  91. label.error {
  92. margin-right: .5em;
  93. }
  94. #status-message-li{
  95. color: red;
  96. font-size: 110%;
  97. font-style: italic;
  98. margin: 0 auto;
  99. width: 80%;
  100. }
  101. </style>
  102. <script type="text/javascript">
  103. $(function() {
  104. $.validator.addMethod('lessthanallowed', function (value, element, param) {
  105. var allowed_id = element.id + '_total';
  106. var received = parseInt($("#already_received_rli").text());
  107. var pp_qty = parseInt($("#"+allowed_id).text());
  108. var pp_old = parseInt($("#pp_old_qty").val());
  109. if (parseInt(value-pp_old)>received-pp_qty){
  110. return false;
  111. }
  112. return true;
  113. },"{0} Quantity Can Not Be More Than Total Received For This Receipt Line");
  114. $("#ppItemForm").validate({
  115. rules:{
  116. pp_quantity_received:
  117. {required:true,
  118. digits:true,
  119. lessthanallowed:"Part Payable Received"},
  120. pp_calculated_value:
  121. {
  122. required:true,
  123. number:true,
  124. minStrict:0
  125. }
  126. }
  127. });
  128. // Main Request For Quotation Grid
  129. var myGrid = $("#receiptitems");
  130. var settingObj = {grid_id:'receiptitems',pager:'pager',multiselect:true};
  131. var hiddenObj = {line_reference:true,returned_quantity:true,returned_value:true,receiving_notes:true,returned_notes:true,pp_status:false};
  132. var subgridSettingsObj = {multiselect:true,customButtons:{add:true,edit:true,process:true,approval:true,cancel:true},status:['open','waitingforapproval','processedforpayment','rejected'],filter:true};
  133. var postData={_pp_status:['open','none','waitingforapproval','rejected'],oper:'pp'};
  134. prepareReceiptItemsGrid(settingObj,postData,true,{},hiddenObj,subgridSettingsObj);
  135. myGrid.navGrid('#pager',{edit:false,add:false,view:true,del:false,search:false},{},{},{},{},{});
  136. addCustomButtonsInReceiptItemGrid('receiptitems', 'pager', null, {load_status_all:true,comments:true,load_owner_all:true}, null)
  137. $( "#dialog-form-partpayment" ).dialog({
  138. autoOpen: false,
  139. height: 'auto',
  140. width: '35%',
  141. position:[450,25],
  142. modal: true,
  143. buttons: {
  144. "Done": {
  145. id:"processItems",
  146. text:"Process For PartPayment",
  147. click:function() {
  148. var isvalid = $("#ppItemForm").valid();
  149. var receipt_line_id = $(this).data('grid_data').receipt_line_id;
  150. var receipt_line_grid = $(this).data('grid_data').receipt_line_grid;
  151. if (isvalid){
  152. $.ajax({
  153. url:'index.php/procurement/processPartpayment',
  154. type:"POST",
  155. data:{
  156. order_line_id:$(this).data('grid_data').order_line_id,
  157. receipt_line_id:receipt_line_id,
  158. action:$(this).data('grid_data').action,
  159. product_id:$("#"+receipt_line_grid).getCell(receipt_line_id,'product_id'),
  160. pp_quantity:$("#pp_quantity_received").val(),
  161. pp_value:$("#pp_calculated_value").val(),
  162. pp_notes:$("#pp_notes").val(),
  163. pp_id:$(this).data('grid_data').pp_id,
  164. pp_old_qty:$(this).data('grid_data').old_qty ,
  165. pp_old_val:$(this).data('grid_data').old_val
  166. },
  167. success:function (response){
  168. //console.log("grid " + grid);
  169. //$("#"+grid).trigger("reloadGrid");
  170. }
  171. })
  172. $( this ).dialog( "close" );
  173. }
  174. }},
  175. Cancel: function() {
  176. $( this ).dialog( "close" );
  177. }
  178. },
  179. open: function(event,ui){
  180. var pp_grid = $(this).data('grid_data').pp_grid;
  181. var receipt_line_grid = $(this).data('grid_data').receipt_line_grid;
  182. var receipt_line_id = $(this).data('grid_data').receipt_line_id;
  183. var action = $(this).data('grid_data').action;
  184. var pp_id = $("#"+pp_grid).getGridParam('selrow');
  185. $(this).data('grid_data').pp_id = pp_id;
  186. $("#product_pp").text($("#"+receipt_line_grid).getCell(receipt_line_id,'name'));
  187. $("#sup_rec").text($("#"+receipt_line_grid).getCell(receipt_line_id,'supplier_receipt_number'));
  188. $("#receipt_line_pp").text($("#"+receipt_line_grid).getCell(receipt_line_id,'reference'))
  189. $("#pp_quantity_received_total").text(parseInt($("#"+receipt_line_grid).getCell(receipt_line_id,'pp_quantity')));
  190. $("#already_received_rli").text($("#"+receipt_line_grid).getCell(receipt_line_id,'received_quantity'));
  191. $("#already_pp_value_rli").text(parseInt($("#"+receipt_line_grid).getCell(receipt_line_id,'pp_value')));
  192. $("#already_received_value_rli").text($("#"+receipt_line_grid).getCell(receipt_line_id,'received_value'));
  193. $("#pp_old_qty").val("0");
  194. if (action=='edit'){
  195. var old_qty = $("#"+pp_grid).getCell(pp_id,'pp_quantity');
  196. var old_val = $("#"+pp_grid).getCell(pp_id,'pp_value');
  197. $(this).data('grid_data').old_qty =old_qty;
  198. $(this).data('grid_data').old_val =old_val;
  199. $("#pp_quantity_received").val(old_qty);
  200. $("#pp_calculated_value").val(old_val);
  201. $("#pp_old_qty").val(old_qty);
  202. }
  203. },
  204. close: function(event,ui) {
  205. //$("#ppItemForm").data('validator').resetForm();
  206. var pp_grid = $(this).data('grid_data').pp_grid;
  207. var receipt_line_grid = $(this).data('grid_data').receipt_line_grid;
  208. console.log("receipt_line_grid " + receipt_line_grid + "pp_grid " + pp_grid);
  209. $('#ppItemForm')[0].reset();
  210. $("#pp_calculated_value").text("");
  211. $("#"+pp_grid).trigger("reloadGrid");
  212. $("#"+receipt_line_grid).trigger("reloadGrid");
  213. }
  214. });
  215. $( "#modal-warning" ).dialog({
  216. autoOpen:false,
  217. height: 80,
  218. modal: true
  219. });
  220. $( "#modal-warning-open-status" ).dialog({
  221. autoOpen:false,
  222. height: 80,
  223. modal: true
  224. });
  225. $("#pp_quantity_received").change(function(){
  226. var received_value = parseFloat($("#already_received_value_rli").text());
  227. var received_qty = parseFloat($("#already_received_rli").text());
  228. var unit_price = (received_value/received_qty).toFixed(2);
  229. $("#pp_calculated_value").val(unit_price*$(this).val());
  230. });
  231. });
  232. $(window).load(function(){
  233. var warningDialogs={one:true,none:true,status:true,exactlyone:true,morethanone:true};
  234. initDialogs(warningDialogs);
  235. initPaymentDialog();
  236. initCommentsForQuote();
  237. initAssignmentCommon();
  238. //initErrorDialogs({total:true,advance:true});
  239. //this is from payment dialog.The Select Inout is in dialogs.php
  240. });
  241. </script>
  242. </head>
  243. <body>
  244. <?php $this->load->view("common/menubar"); ?>
  245. <?php $this->load->view("common/dialogs"); ?>
  246. <!-- <div id="modal-warning" title="Warning">
  247. <p>Please Select Row(s)</p>
  248. </div>-->
  249. <!-- <div id="modal-warning-open-status" title="Warning">
  250. <p id="status_warning_text"></p>
  251. </div>-->
  252. <div id ="dialog-form-partpayment">
  253. <div id ="status-message-li-pp" class="ui-corner-all">
  254. </div>
  255. <h1 id="formPPHeaderItem">Request For Part Payment For Supplier Receipt # <div id="sup_rec"></div> </h1>
  256. <form id="ppItemForm">
  257. <fieldset style="border:1px solid #A6C9E2">
  258. <legend style="color: #2E6E9E;font-size: 110%;font-weight: bold;margin-left: 15px;">
  259. Receipt Line Related Info</legend>
  260. <div class="row single-column-row">
  261. <div class="column quote-column single-column">
  262. <div class="field">
  263. <div class="labeldiv">Receipt Line Reference:</div>
  264. <div class="valuediv" name="receipt_line_pp" id="receipt_line_pp" ></div>
  265. <div id ="receipt_line_pp_help_rli" class="ui-corner-all help-message-left">
  266. (This Is Receipt Line Reference And Not <b>Receipt</b> Reference.System Receipt Reference Can Be Found In Title)
  267. </div>
  268. </div>
  269. </div>
  270. </div>
  271. <div class="row single-column-row">
  272. <div class="column quote-column single-column">
  273. <div class="field">
  274. <div class="labeldiv">Products:</div>
  275. <div class="valuediv" id="product_pp" name ="product_pp" ></div>
  276. </div>
  277. </div>
  278. </div>
  279. <div class="row single-column-row">
  280. <div class="column quote-column single-column">
  281. <div class="field">
  282. <div class="labeldiv">Part Paid Quantity:</div>
  283. <div class="valuediv" name="pp_quantity_received_total" id="pp_quantity_received_total" ></div>
  284. <div id ="rli-help" class="ui-corner-all help-message-left">
  285. (Part Paid Quantity This Receipt Line Item )
  286. </div>
  287. </div>
  288. </div>
  289. </div>
  290. <div class="row single-column-row">
  291. <div class="column quote-column single-column">
  292. <div class="field">
  293. <div class="labeldiv">Received Quantity:</div>
  294. <div class="valuediv" name="already_received_rli" id="already_received_rli" ></div>
  295. <div id ="received_help_rli" class="ui-corner-all help-message-left">
  296. (For This Receipt Line Item Till Date)
  297. </div>
  298. </div>
  299. </div>
  300. </div>
  301. <div class="row single-column-row">
  302. <div class="column quote-column single-column">
  303. <div class="field">
  304. <div class="labeldiv">Received Amount Till Date:</div>
  305. <div class="valuediv" id="already_received_value_rli" name="already_received_value_rli" ></div>
  306. <!-- <div id ="recval-help-rli" class="ui-corner-all help-message-left">
  307. (Payment Amount Subject To Appropriate Approval)
  308. </div>-->
  309. </div>
  310. </div>
  311. </div>
  312. <div class="row single-column-row">
  313. <div class="column quote-column single-column">
  314. <div class="field">
  315. <div class="labeldiv">Part Payment Amount :</div>
  316. <div class="valuediv" id="already_pp_value_rli" name="already_pp_value_rli"></div>
  317. <div id ="already_ppval-help-rli" class="ui-corner-all help-message-left">
  318. (Part Paid Amount )
  319. </div>
  320. </div>
  321. </div>
  322. </div>
  323. </fieldset>
  324. <fieldset>
  325. <div id="pp_received_quantity_cntnr" class="row single-column-row">
  326. <div class="column quote-column single-column">
  327. <div class="field">
  328. <label for="pp_quantity_received" class="labeldiv">Part Payment Qty:</label>
  329. <input id="pp_quantity_received" name="pp_quantity_received" class="required"/>
  330. </div>
  331. </div>
  332. </div>
  333. <div id="pp_calculated_value_cntnr" class="row single-column-row">
  334. <div class="column quote-column single-column">
  335. <div class="field">
  336. <label for="pp_calculated_value" class="labeldiv">Payment Value:</label>
  337. <input id="pp_calculated_value" name="pp_calculated_value" readonly="readonly"></input>
  338. <div id ="pp_calculated_value_help_rli" class="ui-corner-all help-message-left">
  339. (Calculated Value. Read-only)
  340. </div>
  341. </div>
  342. </div>
  343. </div>
  344. <div id="pp_notes_cntnr" class="row single-column-row">
  345. <div class="column quote-column single-column">
  346. <div class="field">
  347. <label for="pp_notes" class="labeldiv">Part Payment Notes:</label>
  348. <textarea id="pp_notes" name="pp_notes" row="5" col="50"></textarea>
  349. </div>
  350. </div>
  351. </div>
  352. <input id ="receipt_line_ref_pp" name ="receipt_line_ref_pp" type="hidden" value="">
  353. <input id ="pp_old_qty" name ="receipt_line_ref_pp" type="hidden" value="">
  354. </fieldset>
  355. </form>
  356. </div>
  357. <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">
  358. <?php $this->load->view("common/message"); ?>
  359. <div class="table-grid">
  360. <h1 id="table header">Generate Part Payment</h1>
  361. <table id="receiptitems"><tr><td/></tr></table>
  362. <div id="pager"></div>
  363. </div>
  364. </div>
  365. <?php $this->load->view("partial/footer"); ?>
  366. </body>
  367. </html>