|
dolibarr
x.y.z
|
Class to manage absolute discounts. More...
Public Member Functions | |
| __construct ($db) | |
| Constructor. More... | |
| fetch ($rowid, $fk_facture_source=0, $fk_invoice_supplier_source=0) | |
| Load object from database into memory. More... | |
| create ($user) | |
| Create a discount into database. More... | |
| delete ($user) | |
| Delete object in database. More... | |
| link_to_invoice ($rowidline, $rowidinvoice) | |
| Link the discount to a particular invoice line or a particular invoice. More... | |
| unlink_invoice () | |
| Link the discount to a particular invoice line or a particular invoice. More... | |
| 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. More... | |
| getSumDepositsUsed ($invoice, $multicurrency=0) | |
| Return amount (with tax) of all deposits invoices used by invoice as a payment. More... | |
| getSumCreditNotesUsed ($invoice, $multicurrency=0) | |
| Return amount (with tax) of all credit notes invoices + excess received used by invoice as a payment. More... | |
| getSumFromThisCreditNotesNotUsed ($invoice, $multicurrency=0) | |
| getNomUrl ($withpicto, $option='invoice') | |
| Return clickable ref of object (with picto or not) More... | |
| initAsSpecimen () | |
| Initialise an instance with random values. More... | |
Class to manage absolute discounts.
Definition at line 29 of file discount.class.php.
| DiscountAbsolute::__construct | ( | $db | ) |
| DiscountAbsolute::create | ( | $user | ) |
Create a discount into database.
Definition at line 227 of file discount.class.php.
| 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.
| 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.
| 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 514 of file discount.class.php.
| 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 688 of file discount.class.php.
| 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 609 of file discount.class.php.
| 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 568 of file discount.class.php.
| 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 649 of file discount.class.php.
| 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 735 of file discount.class.php.
| 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 425 of file discount.class.php.
| 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 481 of file discount.class.php.