commonorder.class.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <?php
  2. /* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \file htdocs/core/class/commonorder.class.php
  19. * \ingroup core
  20. * \brief File of the superclass of orders classes (customer and supplier)
  21. */
  22. require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
  23. require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
  24. require_once DOL_DOCUMENT_ROOT.'/core/class/commonincoterm.class.php';
  25. /**
  26. * Superclass for orders classes
  27. */
  28. abstract class CommonOrder extends CommonObject
  29. {
  30. use CommonIncoterm;
  31. /**
  32. * Return clicable link of object (with eventually picto)
  33. *
  34. * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
  35. * @return string HTML Code for Kanban thumb.
  36. */
  37. public function getKanbanView($option = '')
  38. {
  39. global $langs, $conf;
  40. $return = '<div class="box-flex-item box-flex-grow-zero">';
  41. $return .= '<div class="info-box info-box-sm">';
  42. $return .= '<div class="info-box-icon bg-infobox-action">';
  43. $return .= img_picto('', 'order');
  44. $return .= '</div>';
  45. $return .= '<div class="info-box-content">';
  46. $return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
  47. if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) {
  48. $return .= '<br><div class="info-box-ref opacitymedium tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
  49. }
  50. if (property_exists($this, 'total_ht')) {
  51. $return .= '<div class="info-box-ref amount">'.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency).' '.$langs->trans('HT').'</div>';
  52. }
  53. if (method_exists($this, 'getLibStatut')) {
  54. $return .= '<div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
  55. }
  56. $return .= '</div>';
  57. $return .= '</div>';
  58. $return .= '</div>';
  59. return $return;
  60. }
  61. /**
  62. * @var string code
  63. */
  64. public $code = "";
  65. }
  66. /**
  67. * Superclass for orders classes
  68. */
  69. abstract class CommonOrderLine extends CommonObjectLine
  70. {
  71. /**
  72. * Custom label of line. Not used by default.
  73. * @deprecated
  74. */
  75. public $label;
  76. /**
  77. * Product ref
  78. * @var string
  79. * @deprecated Use product_ref
  80. * @see $product_ref
  81. */
  82. public $ref;
  83. /**
  84. * Product label
  85. * @var string
  86. * @deprecated Use product_label
  87. * @see $product_label
  88. */
  89. public $libelle;
  90. /**
  91. * Product ref
  92. * @var string
  93. */
  94. public $product_ref;
  95. /**
  96. * Product label
  97. * @var string
  98. */
  99. public $product_label;
  100. /**
  101. * Boolean that indicates whether the product is available for sale '1' or not '0'
  102. * @var int
  103. */
  104. public $product_tosell=0;
  105. /**
  106. * Boolean that indicates whether the product is available for purchase '1' or not '0'
  107. * @var int
  108. */
  109. public $product_tobuy=0;
  110. /**
  111. * Product description
  112. * @var string
  113. */
  114. public $product_desc;
  115. /**
  116. * Product use lot
  117. * @var string
  118. */
  119. public $product_tobatch;
  120. /**
  121. * Product barcode
  122. * @var string
  123. */
  124. public $product_barcode;
  125. /**
  126. * Quantity
  127. * @var float
  128. */
  129. public $qty;
  130. /**
  131. * Unit price
  132. * @deprecated
  133. * @see $subprice
  134. */
  135. public $price;
  136. /**
  137. * Unit price before taxes
  138. * @var float
  139. */
  140. public $subprice;
  141. /**
  142. * Type of the product. 0 for product 1 for service
  143. * @var int
  144. */
  145. public $product_type = 0;
  146. /**
  147. * Description of the line
  148. * @var string
  149. */
  150. public $desc;
  151. /**
  152. * Id of corresponding product
  153. * @var int
  154. */
  155. public $fk_product;
  156. /**
  157. * Percent line discount
  158. * @var float
  159. */
  160. public $remise_percent;
  161. /**
  162. * VAT code
  163. * @var string
  164. */
  165. public $vat_src_code;
  166. /**
  167. * VAT %
  168. * @var float
  169. */
  170. public $tva_tx;
  171. /**
  172. * Local tax 1 %
  173. * @var float
  174. */
  175. public $localtax1_tx;
  176. /**
  177. * Local tax 2 %
  178. * @var float
  179. */
  180. public $localtax2_tx;
  181. public $localtax1_type;
  182. public $localtax2_type;
  183. /**
  184. * Liste d'options cumulables:
  185. * Bit 0: 0 si TVA normal - 1 si TVA NPR
  186. * Bit 1: 0 si ligne normal - 1 si bit discount (link to line into llx_remise_except)
  187. * @var int
  188. */
  189. public $info_bits = 0;
  190. public $special_code = 0;
  191. public $fk_multicurrency;
  192. public $multicurrency_code;
  193. public $multicurrency_subprice;
  194. public $multicurrency_total_ht;
  195. public $multicurrency_total_tva;
  196. public $multicurrency_total_ttc;
  197. }