PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/htdocs/core/tpl/predefinedproductline_create.tpl.php

https://bitbucket.org/speedealing/speedealing
PHP | 175 lines | 139 code | 10 blank | 26 comment | 21 complexity | df832efe796f0c7d4429b8274fbd03d3 MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1, GPL-3.0, MIT
  1. <?php
  2. /* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
  3. * Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. *
  20. * Need to have following variables defined:
  21. * $conf
  22. * $langs
  23. * $dateSelector
  24. * $this (invoice, order, ...)
  25. * $line defined
  26. */
  27. ?>
  28. <!-- BEGIN PHP TEMPLATE predefinedproductline_create.tpl.php -->
  29. <tr class="liste_titre nodrag nodrop">
  30. <td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>>
  31. <?php
  32. echo $langs->trans("AddNewLine").' - ';
  33. if (! empty($conf->service->enabled))
  34. echo $langs->trans('RecordedProductsAndServices');
  35. else
  36. echo $langs->trans('RecordedProducts');
  37. ?>
  38. </td>
  39. <td align="right"><?php echo $langs->trans('Qty'); ?></td>
  40. <td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
  41. <?php
  42. $colspan = 4;
  43. if (! empty($conf->margin->enabled)) {
  44. ?>
  45. <td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td>
  46. <?php
  47. if (! empty($conf->global->DISPLAY_MARGIN_RATES))
  48. $colspan++;
  49. if (! empty($conf->global->DISPLAY_MARK_RATES))
  50. $colspan++;
  51. }
  52. ?>
  53. <td colspan="<?php echo $colspan; ?>">&nbsp;</td>
  54. </tr>
  55. <form name="addpredefinedproduct" id="addpredefinedproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST">
  56. <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
  57. <input type="hidden" name="action" value="addline" />
  58. <input type="hidden" name="id" value="<?php echo $this->id; ?>" />
  59. <script type="text/javascript">
  60. jQuery(document).ready(function() {
  61. jQuery('#idprod').change(function() {
  62. jQuery('#np_desc').focus();
  63. });
  64. });
  65. </script>
  66. <tr <?php echo $bcnd[$var]; ?>>
  67. <td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>>
  68. <?php
  69. $form->select_produits('','idprod','',$conf->product->limit_size,$buyer->price_level);
  70. print '<br>';
  71. if (is_object($hookmanager))
  72. {
  73. $parameters=array('fk_parent_line'=>$_POST["fk_parent_line"]);
  74. $reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
  75. }
  76. // Editor wysiwyg
  77. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  78. $nbrows=ROWS_2;
  79. if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
  80. $doleditor=new DolEditor('np_desc',$_POST["np_desc"],'',100,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70);
  81. $doleditor->Create();
  82. ?>
  83. </td>
  84. <td align="right"><input type="text" size="2" name="qty" value="1"></td>
  85. <td align="right" nowrap><input type="text" size="1" name="remise_percent" value="<?php echo $buyer->remise_client; ?>">%</td>
  86. <?php
  87. $colspan = 4;
  88. if (! empty($conf->margin->enabled)) {
  89. ?>
  90. <td align="right">
  91. <select id="fournprice" name="fournprice" style="display: none;"></select>
  92. <input type="text" size="5" id="buying_price" name="buying_price" value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
  93. </td>
  94. <?php
  95. if (! empty($conf->global->DISPLAY_MARGIN_RATES))
  96. $colspan++;
  97. if (! empty($conf->global->DISPLAY_MARK_RATES))
  98. $colspan++;
  99. }
  100. ?>
  101. <td align="center" valign="middle" colspan="<?php echo $colspan; ?>"><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>" name="addline"></td>
  102. </tr>
  103. <?php if (! empty($conf->service->enabled) && $dateSelector) {
  104. if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
  105. $colspan = 10;
  106. else
  107. $colspan = 9;
  108. if (! empty($conf->margin->enabled)) {
  109. $colspan++; // For the buying price
  110. if (! empty($conf->global->DISPLAY_MARGIN_RATES))
  111. $colspan++;
  112. if (! empty($conf->global->DISPLAY_MARK_RATES))
  113. $colspan++;
  114. }
  115. ?>
  116. <tr <?php echo $bcnd[$var]; ?>>
  117. <td colspan="<?php echo $colspan; ?>">
  118. <?php
  119. echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
  120. echo $form->select_date('','date_start_predef',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addpredefinedproduct");
  121. echo ' '.$langs->trans('to').' ';
  122. echo $form->select_date('','date_end_predef',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addpredefinedproduct");
  123. ?>
  124. </td>
  125. </tr>
  126. <?php } ?>
  127. </form>
  128. <?php
  129. if (! empty($conf->margin->enabled)) {
  130. ?>
  131. <script type="text/javascript">
  132. $("#idprod").change(function() {
  133. $("#fournprice options").remove();
  134. $("#fournprice").hide();
  135. $("#buying_price").val("").show();
  136. $.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': $(this).val()}, function(data) {
  137. if (data && data.length > 0) {
  138. var options = '';
  139. var i = 0;
  140. $(data).each(function() {
  141. i++;
  142. options += '<option value="'+this.id+'" price="'+this.price+'"';
  143. if (i == 1) {
  144. options += ' selected';
  145. $("#buying_price").val(this.price);
  146. }
  147. options += '>'+this.label+'</option>';
  148. });
  149. options += '<option value=null><?php echo $langs->trans("InputPrice"); ?></option>';
  150. $("#buying_price").hide();
  151. $("#fournprice").html(options).show();
  152. $("#fournprice").change(function() {
  153. var selval = $(this).find('option:selected').attr("price");
  154. if (selval)
  155. $("#buying_price").val(selval).hide();
  156. else
  157. $('#buying_price').show();
  158. });
  159. }
  160. },
  161. 'json');
  162. });
  163. </script>
  164. <?php } ?>
  165. <!-- END PHP TEMPLATE predefinedproductline_create.tpl.php -->