|
dolibarr 18.0.8
|
Class to manage absolute discounts. More...
Public Member Functions | |
| __construct ($db) | |
| Constructor. | |
| fetch ($rowid, $fk_facture_source=0, $fk_invoice_supplier_source=0) | |
| Load object from database into memory. | |
| create ($user) | |
| Create a discount into database. | |
| delete ($user) | |
| Delete object in database. | |
| link_to_invoice ($rowidline, $rowidinvoice) | |
| Link the discount to a particular invoice line or a particular invoice. | |
| unlink_invoice () | |
| Link the discount to a particular invoice line or a particular invoice. | |
| getAvailableDiscounts ($company='', $user='', $filter='', $maxvalue=0, $discount_type=0, $multicurrency=0) | |
| Return amount (with tax) of discounts currently available for a company, user or other criteria. | |
| getSumDepositsUsed ($invoice, $multicurrency=0) | |
| Return amount (with tax) of all deposits invoices used by invoice as a payment. | |
| getSumCreditNotesUsed ($invoice, $multicurrency=0) | |
| Return amount (with tax) of all credit notes invoices + excess received used by invoice as a payment. | |
| getSumFromThisCreditNotesNotUsed ($invoice, $multicurrency=0) | |
| getNomUrl ($withpicto, $option='invoice') | |
| Return clickable ref of object (with picto or not) | |
| initAsSpecimen () | |
| Initialise an instance with random values. | |
Class to manage absolute discounts.
Definition at line 29 of file discount.class.php.
| DiscountAbsolute::__construct | ( | $db | ) |
Constructor.
Definition at line 119 of file discount.class.php.
| DiscountAbsolute::create | ( | $user | ) |
Create a discount into database.
Definition at line 227 of file discount.class.php.
References description, dol_now(), dol_syslog(), and price2num().
| DiscountAbsolute::delete | ( | $user | ) |
Delete object in database.
If fk_facture_source is defined, we delete all familiy with same fk_facture_source. If not, only with id is removed
| User | $user | Object of user asking to delete |
Definition at line 302 of file discount.class.php.
References dol_print_error(), dol_syslog(), CommonInvoice\TYPE_CREDIT_NOTE, and CommonInvoice\TYPE_DEPOSIT.
| DiscountAbsolute::fetch | ( | $rowid, | |
| $fk_facture_source = 0, | |||
| $fk_invoice_supplier_source = 0 ) |
Load object from database into memory.
| int | $rowid | id discount to load |
| int | $fk_facture_source | fk_facture_source |
| int | $fk_invoice_supplier_source | fk_invoice_supplier_source |
Definition at line 133 of file discount.class.php.
References description, and dol_syslog().
| DiscountAbsolute::getAvailableDiscounts | ( | $company = '', | |
| $user = '', | |||
| $filter = '', | |||
| $maxvalue = 0, | |||
| $discount_type = 0, | |||
| $multicurrency = 0 ) |
Return amount (with tax) of discounts currently available for a company, user or other criteria.
| Societe | $company | Object third party for filter |
| User | $user | Filtre sur un user auteur des remises |
| string | $filter | Filter other. Warning: Do not use a user input value here. |
| int | $maxvalue | Filter on max value for discount |
| int | $discount_type | 0 => customer discount, 1 => supplier discount |
| int | $multicurrency | Return multicurrency_amount instead of amount |
Definition at line 515 of file discount.class.php.
References dol_syslog(), and price2num().
| DiscountAbsolute::getNomUrl | ( | $withpicto, | |
| $option = 'invoice' ) |
Return clickable ref of object (with picto or not)
| int | $withpicto | 0=No picto, 1=Include picto into link, 2=Picto only |
| string | $option | Where to link to ('invoice' or 'discount') |
Definition at line 689 of file discount.class.php.
References dol_escape_htmltag().
| DiscountAbsolute::getSumCreditNotesUsed | ( | $invoice, | |
| $multicurrency = 0 ) |
Return amount (with tax) of all credit notes invoices + excess received used by invoice as a payment.
| CommonInvoice | $invoice | Object invoice |
| int | $multicurrency | 1=Return multicurrency_amount instead of amount. TODO Add a mode multicurrency = -1 to return array with amount + multicurrency amount |
Definition at line 610 of file discount.class.php.
References dol_print_error(), and dol_syslog().
| DiscountAbsolute::getSumDepositsUsed | ( | $invoice, | |
| $multicurrency = 0 ) |
Return amount (with tax) of all deposits invoices used by invoice as a payment.
Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS or FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended).
| CommonInvoice | $invoice | Object invoice (customer of supplier) |
| int | $multicurrency | 1=Return multicurrency_amount instead of amount. TODO Add a mode multicurrency = -1 to return array with amount + multicurrency amount |
Definition at line 569 of file discount.class.php.
References dol_print_error(), and dol_syslog().
| DiscountAbsolute::getSumFromThisCreditNotesNotUsed | ( | $invoice, | |
| $multicurrency = 0 ) |
Return amount (with tax) of all converted amount for this credit note
| CommonInvoice | $invoice | Object invoice |
| int | $multicurrency | Return multicurrency_amount instead of amount. TODO Add a mode multicurrency = -1 to return array with amount + multicurrency amount |
Definition at line 650 of file discount.class.php.
References dol_print_error(), and dol_syslog().
| DiscountAbsolute::initAsSpecimen | ( | ) |
Initialise an instance with random values.
Used to build previews or test instances. id must be 0 if object instance is a specimen.
Definition at line 736 of file discount.class.php.
References description.
| DiscountAbsolute::link_to_invoice | ( | $rowidline, | |
| $rowidinvoice ) |
Link the discount to a particular invoice line or a particular invoice.
When discount is a global discount used as an invoice line, we link using rowidline. When discount is from a credit note used to reduce payment of an invoice, we link using rowidinvoice
| int | $rowidline | Invoice line id (To use discount into invoice lines) |
| int | $rowidinvoice | Invoice id (To use discount as a credit note to reduce payment of invoice) |
Definition at line 426 of file discount.class.php.
References dol_syslog().
| DiscountAbsolute::unlink_invoice | ( | ) |
Link the discount to a particular invoice line or a particular invoice.
Do not call this if discount is linked to a reconcialiated invoice
Definition at line 482 of file discount.class.php.
References dol_syslog().