objectline_title.tpl.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <?php
  2. /* Copyright (C) 2010-2013 Regis Houssin <regis.houssin@inodbox.com>
  3. * Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
  5. * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
  6. * Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
  7. * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
  8. * Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
  9. * Copyright (C) 2022 OpenDSI <support@open-dsi.fr>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 3 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  23. *
  24. * Need to have following variables defined:
  25. * $object (invoice, order, ...)
  26. * $conf
  27. * $langs
  28. * $element (used to test $user->rights->$element->creer)
  29. * $permtoedit (used to replace test $user->rights->$element->creer)
  30. * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
  31. * $outputalsopricetotalwithtax
  32. * $usemargins (0 to disable all margins columns, 1 to show according to margin setup)
  33. *
  34. * $type, $text, $description, $line
  35. */
  36. // Protection to avoid direct call of template
  37. if (empty($object) || !is_object($object)) {
  38. print "Error, template page can't be called as URL";
  39. exit;
  40. }
  41. print "<!-- BEGIN PHP TEMPLATE objectline_title.tpl.php -->\n";
  42. // Title line
  43. print "<thead>\n";
  44. print '<tr class="liste_titre nodrag nodrop">';
  45. // Adds a line numbering column
  46. if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
  47. print '<th class="linecolnum center">&nbsp;</th>';
  48. }
  49. // Description
  50. print '<th class="linecoldescription">'.$langs->trans('Description').'</th>';
  51. // Supplier ref
  52. if ($this->element == 'supplier_proposal' || $this->element == 'order_supplier' || $this->element == 'invoice_supplier' || $this->element == 'invoice_supplier_rec') {
  53. print '<th class="linerefsupplier maxwidth125"><span id="title_fourn_ref">'.$langs->trans("SupplierRef").'</span></th>';
  54. }
  55. // VAT
  56. print '<th class="linecolvat right nowraponall">';
  57. if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || !empty($conf->global->FACTURE_LOCAL_TAX2_OPTION)) {
  58. print $langs->trans('Taxes');
  59. } else {
  60. print $langs->trans('VAT');
  61. }
  62. if (in_array($object->element, array('propal', 'commande', 'facture', 'supplier_proposal', 'order_supplier', 'invoice_supplier')) && $object->status == $object::STATUS_DRAFT) {
  63. global $mysoc;
  64. if (empty($disableedit) && GETPOST('mode', 'aZ09') != 'vatforalllines') {
  65. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?mode=vatforalllines&id='.$object->id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').'</a>';
  66. }
  67. //print '<script>$(document).ready(function() { $(".clickvatforalllines").click(function() { jQuery(".classvatforalllines").toggle(); }); });</script>';
  68. if (GETPOST('mode', 'aZ09') == 'vatforalllines') {
  69. print '<div class="classvatforalllines inline-block nowraponall">';
  70. print $form->load_tva('vatforalllines', '', $mysoc, $object->thirdparty, 0, 0, '', false, 1);
  71. print '<input class="inline-block button smallpaddingimp" type="submit" name="submitforalllines" value="'.$langs->trans("Update").'">';
  72. print '</div>';
  73. }
  74. }
  75. print '</th>';
  76. // Price HT
  77. print '<th class="linecoluht right nowraponall">'.$langs->trans('PriceUHT').'</th>';
  78. // Multicurrency
  79. if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) {
  80. print '<th class="linecoluht_currency right" style="width: 80px">'.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).'</th>';
  81. }
  82. if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) {
  83. print '<th class="right nowraponall">'.$langs->trans('PriceUTTC').'</th>';
  84. }
  85. // Qty
  86. print '<th class="linecolqty right">'.$langs->trans('Qty').'</th>';
  87. // Unit
  88. if (!empty($conf->global->PRODUCT_USE_UNITS)) {
  89. print '<th class="linecoluseunit left">'.$langs->trans('Unit').'</th>';
  90. }
  91. // Reduction short
  92. print '<th class="linecoldiscount right nowraponall">';
  93. print $langs->trans('ReductionShort');
  94. if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) {
  95. global $mysoc;
  96. if (empty($disableedit) && GETPOST('mode', 'aZ09') != 'remiseforalllines') {
  97. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?mode=remiseforalllines&id='.$object->id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').'</a>';
  98. }
  99. //print '<script>$(document).ready(function() { $(".clickremiseforalllines").click(function() { jQuery(".classremiseforalllines").toggle(); }); });</script>';
  100. if (GETPOST('mode', 'aZ09') == 'remiseforalllines') {
  101. print '<div class="remiseforalllines inline-block nowraponall">';
  102. print '<input class="inline-block smallpaddingimp width50 right" name="remiseforalllines" value="" placeholder="%">';
  103. print '<input class="inline-block button smallpaddingimp" type="submit" name="submitforalllines" value="'.$langs->trans("Update").'">';
  104. print '</div>';
  105. }
  106. }
  107. print '</th>';
  108. // Fields for situation invoice
  109. if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
  110. print '<th class="linecolcycleref right">'.$langs->trans('Progress').'</th>';
  111. print '<th class="linecolcycleref2 right">'.$form->textwithpicto($langs->trans('TotalHT100Short'), $langs->trans('UnitPriceXQtyLessDiscount')).'</th>';
  112. }
  113. // Purchase price
  114. if ($usemargins && isModEnabled('margin') && empty($user->socid)) {
  115. if (!empty($user->rights->margins->creer)) {
  116. if ($conf->global->MARGIN_TYPE == "1") {
  117. print '<th class="linecolmargin1 margininfos right" style="width: 80px">'.$langs->trans('BuyingPrice').'</th>';
  118. } else {
  119. print '<th class="linecolmargin1 margininfos right" style="width: 80px">'.$langs->trans('CostPrice').'</th>';
  120. }
  121. }
  122. if (!empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) {
  123. print '<th class="linecolmargin2 margininfos right" style="width: 50px">'.$langs->trans('MarginRate').'</th>';
  124. }
  125. if (!empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {
  126. print '<th class="linecolmargin2 margininfos right" style="width: 50px">'.$langs->trans('MarkRate').'</th>';
  127. }
  128. }
  129. // Total HT
  130. print '<th class="linecolht right">'.$langs->trans('TotalHTShort').'</th>';
  131. // Multicurrency
  132. if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) {
  133. print '<th class="linecoltotalht_currency right">'.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).'</th>';
  134. }
  135. if ($outputalsopricetotalwithtax) {
  136. print '<th class="right" style="width: 80px">'.$langs->trans('TotalTTCShort').'</th>';
  137. }
  138. if (isModEnabled('asset') && $object->element == 'invoice_supplier') {
  139. print '<th class="linecolasset"></th>';
  140. }
  141. print '<th class="linecoledit"></th>'; // No width to allow autodim
  142. print '<th class="linecoldelete" style="width: 10px"></th>';
  143. print '<th class="linecolmove" style="width: 10px"></th>';
  144. if ($action == 'selectlines') {
  145. print '<th class="linecolcheckall center">';
  146. print '<input type="checkbox" class="linecheckboxtoggle" />';
  147. print '<script>$(document).ready(function() {$(".linecheckboxtoggle").click(function() {var checkBoxes = $(".linecheckbox");checkBoxes.prop("checked", this.checked);})});</script>';
  148. print '</th>';
  149. }
  150. print "</tr>\n";
  151. print "</thead>\n";
  152. print "<!-- END PHP TEMPLATE objectline_title.tpl.php -->\n";