src/Entity/Idempiere/SmSalestemplateline.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Idempiere;
  3. use App\Entity\Order\SmLocalSalestemplateline;
  4. use App\Repository\Idempiere\SmSalestemplatelineRepository;
  5. use DateTime;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=SmSalestemplatelineRepository::class)
  9. * @ORM\Table(name="SM_SalesTemplateLine")
  10. */
  11. class SmSalestemplateline
  12. {
  13. /**
  14. * @ORM\Id
  15. * @ORM\Column(type="integer")
  16. */
  17. private $sm_salestemplateline_id;
  18. /**
  19. * @ORM\Column(type="integer")
  20. */
  21. private $ad_client_id;
  22. /**
  23. * @ORM\Column(type="integer")
  24. */
  25. private $ad_org_id;
  26. /**
  27. * @ORM\Column(type="string", length=1)
  28. */
  29. private $isactive;
  30. /**
  31. * @ORM\Column(type="datetime")
  32. */
  33. private $created;
  34. /**
  35. * @ORM\Column(type="integer")
  36. */
  37. private $createdby;
  38. /**
  39. * @ORM\Column(type="datetime")
  40. */
  41. private $updated;
  42. /**
  43. * @ORM\Column(type="integer")
  44. */
  45. private $updatedby;
  46. /**
  47. * @ORM\Column(type="integer")
  48. */
  49. private $line;
  50. /**
  51. * @ORM\Column(type="integer")
  52. */
  53. private $sm_salestemplate_id;
  54. /**
  55. * @ORM\ManyToOne(targetEntity=SmSalestemplate::class, inversedBy="salestemplatelines")
  56. * @ORM\JoinColumn(name="sm_salestemplate_id", referencedColumnName="sm_salestemplate_id", nullable=false)
  57. */
  58. private $salestemplate;
  59. /**
  60. * @ORM\Column(type="float")
  61. */
  62. private $qty;
  63. /**
  64. * @ORM\ManyToOne(targetEntity=MProduct::class, cascade={"persist"})
  65. * @ORM\JoinColumn(referencedColumnName="m_product_id", nullable=false)
  66. */
  67. private $m_product;
  68. /**
  69. * @ORM\Column(type="integer")
  70. */
  71. private $m_product_id;
  72. /**
  73. * @ORM\Column(type="float")
  74. */
  75. private $priceactual;
  76. /**
  77. * @ORM\Column(type="float")
  78. */
  79. private $linenetamt;
  80. /**
  81. * @ORM\Column(type="string", length=36)
  82. */
  83. private $sm_salestemplateline_uu;
  84. /**
  85. * @ORM\Column(type="float")
  86. */
  87. private $discount;
  88. /**
  89. * @ORM\Column(type="float")
  90. */
  91. private $totalpriceprom;
  92. /**
  93. * @ORM\Column(type="float")
  94. */
  95. private $desiredprice;
  96. /**
  97. * @ORM\Column(type="float")
  98. */
  99. private $totalpricebreak;
  100. /**
  101. * @ORM\Column(type="float")
  102. */
  103. private $totalprombreak;
  104. /**
  105. * @ORM\Column(type="float")
  106. */
  107. private $porcentprombreak;
  108. /**
  109. * @ORM\Column(type="float")
  110. */
  111. private $qtyplan;
  112. /**
  113. * @ORM\Column(type="float")
  114. */
  115. private $qtyplan2;
  116. /**
  117. * @ORM\Column(type="float")
  118. */
  119. private $priceoverride;
  120. /**
  121. * @ORM\Column(type="float")
  122. */
  123. private $priceoverride2;
  124. /**
  125. * @ORM\Column(type="string", length=600, nullable=true)
  126. */
  127. private $information;
  128. /**
  129. * @ORM\Column(type="string", length=600, nullable=true)
  130. */
  131. private $information2;
  132. /**
  133. * @ORM\Column(type="float")
  134. */
  135. private $pricestdamt;
  136. /**
  137. * @ORM\Column(type="float")
  138. */
  139. private $pricelist;
  140. /**
  141. * @ORM\Column(type="integer")
  142. */
  143. private $c_uom_id;
  144. /**
  145. * @ORM\Column(type="integer")
  146. */
  147. private $c_bpartner_id;
  148. /**
  149. * @ORM\Column(type="integer")
  150. */
  151. private $sm_marca_id;
  152. /**
  153. * @ORM\Column(type="integer")
  154. */
  155. private $sm_precio_estimadoline_id;
  156. /**
  157. * @ORM\Column(type="integer")
  158. */
  159. private $c_tax_id;
  160. /**
  161. * @ORM\Column(type="datetime")
  162. */
  163. private $datedoc;
  164. /**
  165. * @ORM\Column(type="integer", nullable=true)
  166. */
  167. private $sm_m_promotion_id;
  168. /**
  169. * Copiar datos de una linea de plantilla temporal
  170. *
  171. * @param SmLocalSalestemplateline $smLocalSalestemplateline Linea de Plantilla de Ventas Temporal
  172. *
  173. * @return SmSalestemplateline Linea de Plantilla de Ventas
  174. */
  175. public function copyFromLocal(SmLocalSalestemplateline $smLocalSalestemplateline): self
  176. {
  177. $date = new DateTime("now");
  178. $lineAmt = $smLocalSalestemplateline->getQty() * $smLocalSalestemplateline->getDesiredPrice();
  179. $this
  180. ->setAdClientId( $smLocalSalestemplateline->getAdClientId() )
  181. ->setAdOrgId( $smLocalSalestemplateline->getAdOrgId() )
  182. ->setCBpartnerId( $smLocalSalestemplateline->getCBpartnerId() )
  183. ->setCreated( $date )
  184. ->setCreatedby( $smLocalSalestemplateline->getCreatedby() )
  185. ->setCUomId( $smLocalSalestemplateline->getCUomId() ?? 100 )
  186. ->setIsactive( "Y")
  187. ->setLinenetamt( $lineAmt )
  188. ->setPrice( $smLocalSalestemplateline->getPricelist() )
  189. ->setPriceactual( $smLocalSalestemplateline->getPriceactual() ?? $smLocalSalestemplateline->getPricelist())
  190. ->setQtys( $smLocalSalestemplateline->getQty() )
  191. ->setUpdated( $date )
  192. ->setUpdatedby( $smLocalSalestemplateline->getCreatedby() );
  193. return $this;
  194. }
  195. public function getId(): ?int
  196. {
  197. return $this->getSmSalestemplatelineId();
  198. }
  199. public function getSmSalestemplatelineId(): ?int
  200. {
  201. return $this->sm_salestemplateline_id;
  202. }
  203. public function setSmSalestemplatelineId(int $sm_salestemplateline_id): self
  204. {
  205. $this->sm_salestemplateline_id = $sm_salestemplateline_id;
  206. return $this;
  207. }
  208. public function getAdClientId(): ?int
  209. {
  210. return $this->ad_client_id;
  211. }
  212. public function setAdClientId(int $ad_client_id): self
  213. {
  214. $this->ad_client_id = $ad_client_id;
  215. return $this;
  216. }
  217. public function getAdOrgId(): ?int
  218. {
  219. return $this->ad_org_id;
  220. }
  221. public function setAdOrgId(int $ad_org_id): self
  222. {
  223. $this->ad_org_id = $ad_org_id;
  224. return $this;
  225. }
  226. public function getIsactive(): string
  227. {
  228. return $this->isactive;
  229. }
  230. public function setIsactive(string $isactive): self
  231. {
  232. $this->isactive = $isactive;
  233. return $this;
  234. }
  235. public function getCreated(): ?\DateTimeInterface
  236. {
  237. return $this->created;
  238. }
  239. public function setCreated(\DateTimeInterface $created): self
  240. {
  241. $this->created = $created;
  242. return $this;
  243. }
  244. public function getCreatedby(): ?int
  245. {
  246. return $this->createdby;
  247. }
  248. public function setCreatedby(int $createdby): self
  249. {
  250. $this->createdby = $createdby;
  251. return $this;
  252. }
  253. public function getUpdated(): ?\DateTimeInterface
  254. {
  255. return $this->updated;
  256. }
  257. public function setUpdated(\DateTimeInterface $updated): self
  258. {
  259. $this->updated = $updated;
  260. return $this;
  261. }
  262. public function getUpdatedby(): ?int
  263. {
  264. return $this->updatedby;
  265. }
  266. public function setUpdatedby(int $updatedby): self
  267. {
  268. $this->updatedby = $updatedby;
  269. return $this;
  270. }
  271. public function getLine(): ?int
  272. {
  273. return $this->line;
  274. }
  275. public function setLine(int $line): self
  276. {
  277. $this->line = $line;
  278. return $this;
  279. }
  280. public function getSmSalestemplateId(): ?int
  281. {
  282. return $this->sm_salestemplate_id;
  283. }
  284. public function setSmSalestemplateId(int $sm_salestemplate_id): self
  285. {
  286. $this->sm_salestemplate_id = $sm_salestemplate_id;
  287. return $this;
  288. }
  289. public function getSmSalestemplate(): ?SmSalestemplate
  290. {
  291. return $this->salestemplate;
  292. }
  293. public function setSmSalestemplate(?SmSalestemplate $salestemplate): self
  294. {
  295. $this->salestemplate = $salestemplate;
  296. $this->setSmSalestemplateId( $salestemplate->getId() );
  297. return $this;
  298. }
  299. public function setParent(?SmSalestemplate $salestemplate): self
  300. {
  301. $this
  302. ->setAdClientId( $salestemplate->getAdClientId() )
  303. ->setAdOrgId( $salestemplate->getAdOrgId() )
  304. ->setCBpartnerId( $salestemplate->getCBpartnerId() )
  305. ->setIsactive('Y')
  306. ->setSmSalestemplate($salestemplate);
  307. return $this;
  308. }
  309. public function getParent(): ?SmSalestemplate
  310. {
  311. return $this->getSmSalestemplate();
  312. }
  313. public function getQty(): ?float
  314. {
  315. return $this->qty;
  316. }
  317. public function setQty(float $qty): self
  318. {
  319. $this->qty = $qty;
  320. return $this;
  321. }
  322. public function getMProduct(): ?MProduct
  323. {
  324. return $this->m_product;
  325. }
  326. public function setMProduct(?MProduct $m_product): self
  327. {
  328. $this->m_product = $m_product;
  329. return $this;
  330. }
  331. public function getMProductId(): ?int
  332. {
  333. return $this->m_product_id;
  334. }
  335. public function setSmMarcaId(int $sm_marca_id): self
  336. {
  337. $this->sm_marca_id = $sm_marca_id;
  338. return $this;
  339. }
  340. public function setTaxId(int $c_tax_id): self
  341. {
  342. $this->c_tax_id = $c_tax_id;
  343. return $this;
  344. }
  345. public function setDateDoc(?\DateTimeInterface $date = null): self
  346. {
  347. $this->datedoc = $date ?? new DateTime("now");
  348. return $this;
  349. }
  350. public function setPrecioEstimadoLineId(int $sm_precio_estimadoline_id): self
  351. {
  352. $this->sm_precio_estimadoline_id = $sm_precio_estimadoline_id;
  353. return $this;
  354. }
  355. public function getPrecioEstimadoLineId(): int
  356. {
  357. return $this->sm_precio_estimadoline_id;
  358. }
  359. public function getSmMarcaId(): int
  360. {
  361. return $this->sm_marca_id;
  362. }
  363. public function setMProductId(?int $m_product_id): self
  364. {
  365. $this->m_product_id = $m_product_id;
  366. return $this;
  367. }
  368. public function getPriceactual(): ?float
  369. {
  370. return $this->priceactual;
  371. }
  372. public function setPriceactual(float $priceactual): self
  373. {
  374. $this->priceactual = $priceactual;
  375. return $this;
  376. }
  377. public function getLinenetamt(): float
  378. {
  379. return $this->linenetamt;
  380. }
  381. public function setLinenetamt(float $linenetamt): self
  382. {
  383. if ($linenetamt < 0) {
  384. $linenetamt = 0;
  385. }
  386. $this->linenetamt = $linenetamt;
  387. return $this;
  388. }
  389. public function getSmSalestemplatelineUu(): ?string
  390. {
  391. return $this->sm_salestemplateline_uu;
  392. }
  393. public function setSmSalestemplatelineUu(string $sm_salestemplateline_uu): self
  394. {
  395. $this->sm_salestemplateline_uu = $sm_salestemplateline_uu;
  396. return $this;
  397. }
  398. public function getDiscount(): ?float
  399. {
  400. return $this->discount;
  401. }
  402. public function setDiscount(float $discount): self
  403. {
  404. $this->discount = $discount;
  405. return $this;
  406. }
  407. public function getTotalpriceprom(): ?float
  408. {
  409. return $this->totalpriceprom;
  410. }
  411. public function setTotalpriceprom(float $totalpriceprom): self
  412. {
  413. $this->totalpriceprom = $totalpriceprom;
  414. return $this;
  415. }
  416. public function getDesiredprice(): ?float
  417. {
  418. return $this->desiredprice;
  419. }
  420. public function setDesiredprice(float $desiredprice): self
  421. {
  422. $this->desiredprice = $desiredprice;
  423. return $this;
  424. }
  425. public function getTotalpricebreak(): ?float
  426. {
  427. return $this->totalpricebreak;
  428. }
  429. public function setTotalpricebreak(?float $totalpricebreak): self
  430. {
  431. $this->totalpricebreak = $totalpricebreak;
  432. return $this;
  433. }
  434. public function getTotalprombreak(): ?float
  435. {
  436. return $this->totalprombreak;
  437. }
  438. public function setTotalprombreak(?float $totalprombreak): self
  439. {
  440. $this->totalprombreak = $totalprombreak;
  441. return $this;
  442. }
  443. public function getPorcentprombreak(): ?float
  444. {
  445. return $this->porcentprombreak;
  446. }
  447. public function setPorcentprombreak(?float $porcentprombreak): self
  448. {
  449. $this->porcentprombreak = $porcentprombreak;
  450. return $this;
  451. }
  452. public function getQtyplan(): ?float
  453. {
  454. return $this->qtyplan;
  455. }
  456. public function setQtyplan(?float $qtyplan): self
  457. {
  458. $this->qtyplan = $qtyplan;
  459. return $this;
  460. }
  461. public function getQtyplan2(): ?float
  462. {
  463. return $this->qtyplan2;
  464. }
  465. public function setQtyplan2(?float $qtyplan2): self
  466. {
  467. $this->qtyplan2 = $qtyplan2;
  468. return $this;
  469. }
  470. /**
  471. * Set Qty in all necessary fields
  472. *
  473. * @param float $qty Product Qty
  474. *
  475. * @return self
  476. */
  477. public function setQtys(?float $qty): self
  478. {
  479. $this
  480. ->setQty( $qty )
  481. ->setQtyplan( $qty )
  482. ->setQtyplan2( $qty );
  483. return $this;
  484. }
  485. public function getPriceoverride(): ?float
  486. {
  487. return $this->priceoverride;
  488. }
  489. public function setPriceoverride(float $priceoverride): self
  490. {
  491. $this->priceoverride = $priceoverride;
  492. return $this;
  493. }
  494. public function getPriceoverride2(): ?float
  495. {
  496. return $this->priceoverride2;
  497. }
  498. public function setPriceoverride2(?float $priceoverride2): self
  499. {
  500. $this->priceoverride2 = $priceoverride2;
  501. return $this;
  502. }
  503. public function getInformation(): ?string
  504. {
  505. return $this->information;
  506. }
  507. public function setInformation(?string $information): self
  508. {
  509. $this->information = $information;
  510. return $this;
  511. }
  512. public function getInformation2(): ?string
  513. {
  514. return $this->information2;
  515. }
  516. public function setInformation2(?string $information2): self
  517. {
  518. $this->information2 = $information2;
  519. return $this;
  520. }
  521. public function getPricestdamt(): ?float
  522. {
  523. return $this->pricestdamt;
  524. }
  525. public function setPricestdamt(?float $pricestdamt): self
  526. {
  527. $this->pricestdamt = $pricestdamt;
  528. return $this;
  529. }
  530. public function getPricelist(): ?string
  531. {
  532. return $this->pricelist;
  533. }
  534. public function setPricelist(?string $pricelist): self
  535. {
  536. $this->pricelist = $pricelist;
  537. return $this;
  538. }
  539. /**
  540. * Set price in all necessary field
  541. *
  542. * @param float $price Product Price
  543. *
  544. * @return self
  545. */
  546. public function setPrice(?float $price): self
  547. {
  548. $this
  549. ->setDesiredprice( $price )
  550. ->setPricestdamt( $price )
  551. ->setPricelist( $price );
  552. return $this;
  553. }
  554. public function getCUomId(): ?int
  555. {
  556. return $this->c_uom_id;
  557. }
  558. public function setCUomId(int $c_uom_id): self
  559. {
  560. $this->c_uom_id = $c_uom_id;
  561. return $this;
  562. }
  563. public function getCBpartnerId(): ?int
  564. {
  565. return $this->c_bpartner_id;
  566. }
  567. public function setCBpartnerId(int $c_bpartner_id): self
  568. {
  569. $this->c_bpartner_id = $c_bpartner_id;
  570. return $this;
  571. }
  572. public function setSmPromotionId(?int $sm_m_promotion_id) : void {
  573. $this->sm_m_promotion_id = $sm_m_promotion_id > 0 ? $sm_m_promotion_id : null;
  574. }
  575. public function getSmPromotionId() : ?int {
  576. return $this->sm_m_promotion_id;
  577. }
  578. }