function __construct($tablename = 'pi_header') { // Register non-persistent attributes // Contruct the object parent::__construct($tablename); // Set specific characteristics $this->idField = 'id'; $this->identifierField = 'invoice_number'; // Set ordering attributes $this->orderby = array('invoice_date', 'invoice_number'); $this->orderdir = array('DESC', 'DESC'); $this->validateUniquenessOf('invoice_number'); // Define relationships $this->belongsTo('PLSupplier', 'plmaster_id', 'supplier'); $this->belongsTo('User', 'auth_by', 'auth'); $this->belongsTo('Currency', 'currency_id', 'currency'); $this->belongsTo('Currency', 'twin_currency_id', 'twin'); $this->belongsTo('PaymentTerm', 'payment_term_id', 'payment'); $this->belongsTo('TaxStatus', 'tax_status_id', 'tax_status'); $this->belongsTo('Project', 'project_id', 'project'); $this->belongsTo('Task', 'task_id', 'task'); $this->hasMany('PInvoiceLine', 'lines', 'invoice_id'); $this->hasMany('POReceivedLine', 'grn_lines', 'invoice_id'); $this->hasOne('PaymentTerm', 'payment_term_id', 'payment_term'); // Define field formats $params = DataObjectFactory::Factory('GLParams'); $base_currency = $params->base_currency(); $this->getField('base_net_value')->setFormatter(new CurrencyFormatter($base_currency)); $this->getField('base_tax_value')->setFormatter(new CurrencyFormatter($base_currency)); $this->getField('base_gross_value')->setFormatter(new CurrencyFormatter($base_currency)); $this->getField('transaction_type')->setDefault('I'); // Define enumerated types $this->setEnum('transaction_type', array('I' => 'Invoice', 'C' => 'Credit Note', 'T' => 'Template')); $this->setEnum('status', array('N' => 'New', 'O' => 'Open', 'Q' => 'Query', 'P' => 'Paid')); }
/** * Create a new Invoice instance * * @param Guid $message_id Unique message id (should be different every time) * @param string $invoice_number Number of the invoice (sequence number of the invoice) * @param float $invoice_amount Value of the invoice (with VAT and discounts) * @param float $payment_amount Value for payment * @param int $tax_number Tax number of the person liable * @param string $set_number Number of the invoice set (original invoice + its two copies) * from the pre-numbered invoice book * @param string $serial_number Serial number of the pre-numbered invoice book * @param int $issue_date Date and time of issuing the invoice (unix timestamp) * @param string $business_premise_id Mark of business premises */ public function __construct($message_id, $invoice_number, $invoice_amount, $payment_amount, $tax_number, $set_number, $serial_number, $issue_date, $business_premise_id) { parent::__construct($message_id, $invoice_number, $invoice_amount, $payment_amount, $tax_number); $this->set_number = $set_number; $this->serial_number = $serial_number; $this->issue_date = $issue_date; $this->business_premise_id = $business_premise_id; }
/** * Create a new Invoice instance * * @param Guid $message_id Unique message id (should be different every time) * @param string $invoice_number Number of the invoice (sequence number of the invoice) * @param float $invoice_amount Value of the invoice (with VAT and discounts) * @param float $payment_amount Value for payment * @param int $tax_number Tax number of the person liable * @param int $business_premise_id Mark of business premises * @param int $electronic_device_id Mark of the electronic device * @param int $issue_date_time Date and time of issuing the invoice (unix timestamp) * @param int $operator_tax_number Tax number of the person (operator) at the electronic device * @param string $protected_id Protective mark of the invoice issuer * @param string $numbering_structure Method for assigning the invoice * Can be either C or B: * C (centrally at the level of business premises) * B (per individual electronic device (cash register)) */ public function __construct($message_id, $invoice_number, $invoice_amount, $payment_amount, $tax_number, $business_premise_id, $electronic_device_id, $issue_date_time, $operator_tax_number, $protected_id, $numbering_structure) { parent::__construct($message_id, $invoice_number, $invoice_amount, $payment_amount, $tax_number); $this->business_premise_id = $business_premise_id; $this->electronic_device_id = $electronic_device_id; $this->issue_date_time = $issue_date_time; $this->operator_tax_number = $operator_tax_number; $this->protected_id = $protected_id; $this->numbering_structure = $numbering_structure; }
function __construct($tablename = 'si_header') { // Register non-persistent attributes // Construct the object parent::__construct($tablename); // Set specific characteristics $this->idField = 'id'; $this->identifierField = 'invoice_number'; $this->view = ''; // Set ordering attributes $this->orderby = array('invoice_date', 'invoice_number'); $this->orderdir = array('DESC', 'DESC'); $this->validateUniquenessOf('invoice_number'); // Define relationships $this->hasOne('SLCustomer', 'slmaster_id', 'customerdetail'); $this->hasOne('Address', 'del_address_id', 'del_address'); $this->hasOne('Address', 'inv_address_id', 'inv_address'); $this->hasOne('Person', 'person_id', 'persondetail'); $this->hasOne('SOrder', 'sales_order_id', 'order'); $this->hasOne('SystemCompany', 'usercompanyid', 'system_company'); $this->hasOne('PaymentTerm', 'payment_term_id', 'payment_term'); $this->belongsTo('SLCustomer', 'slmaster_id', 'customer'); $this->belongsTo('SOrder', 'sales_order_id', 'sales_order_number'); $this->belongsTo('Currency', 'currency_id', 'currency'); $this->belongsTo('Currency', 'twin_currency_id', 'twin'); $this->belongsTo('PaymentTerm', 'payment_term_id', 'payment'); $this->belongsTo('TaxStatus', 'tax_status_id', 'tax_status'); $this->belongsTo('Person', 'person_id', 'person', null, "surname || ', ' || firstname"); $this->belongsTo('Project', 'project_id', 'project'); $this->belongsTo('Task', 'task_id', 'task'); $this->setComposite('Address', 'inv_address_id', 'invoice_address', array('street1', 'street2', 'street3', 'town', 'county', 'postcode', 'countrycode')); $this->hasMany('SInvoiceLine', 'lines', 'invoice_id'); $this->hasMany('STTransaction', 'transactions', 'process_id'); // Define enumerated types $this->setEnum('transaction_type', array('I' => 'Invoice', 'C' => 'Credit Note', 'T' => 'Template')); $this->setEnum('status', array('N' => 'New', 'O' => 'Open', 'Q' => 'Query', 'P' => 'Paid')); // Define field formats $params = DataObjectFactory::Factory('GLParams'); $base_currency = $params->base_currency(); $this->getField('base_net_value')->setFormatter(new CurrencyFormatter($base_currency)); $this->getField('base_tax_value')->setFormatter(new CurrencyFormatter($base_currency)); $this->getField('base_gross_value')->setFormatter(new CurrencyFormatter($base_currency)); // Define system defaults $this->getField('transaction_type')->setDefault('I'); // Do not allow links to the following $this->linkRules = array('lines' => array('actions' => array(), 'rules' => array()), 'transactions' => array('newtab' => array('new' => true), 'actions' => array('link'), 'rules' => array())); }
/** * Create a new Document object using the specified parameters * * @param array $parameters An array of parameters to set on the new object */ public function __construct($parameters = array()) { parent::__construct($parameters); $this->setType('creditNote'); }
function __construct($conx = NULL, $table_name = "") { parent::__construct($conx, $table_name); }