var $tax_group_array = null; // saves db queries
var $price_factor; // ditto for price calculations
- var $pos; // user assigned POS (contains cash accont number/name)
+ var $pos; // user assigned POS
+ var $cash_account;
+ var $account_name;
var $cash_discount; // not used as of FA 2.1
var $dimension_id;
var $dimension2_id;
//-------------------------------------------------------------------------
//
// $trans_no==0 => open new/direct document
- // $trans_no!=0 && $prep_child==false => update with parent constarints for reedition
- // $trans_no!=0 && $prep_child==true => prepare for child doc entry
+ // $trans_no!=0 && $no_edit==false => update with parent constarints for reedition
+ // $trans_no!=0 && $no_edit==true => read only: for view, or later child doc entry
//
function Cart($type, $trans_no=0, $prep_child=false) {
/*Constructor function initialises a new shopping cart */
$line->quantity += $srcline['quantity'] -
($src_type==ST_SALESORDER ? $srcline['qty_sent'] : $srcline['qty_done']); // add free qty on src doc
$line_no++;
- break;
}
}
// Writing new/modified sales document to database.
// Makes parent documents for direct delivery/invoice by recurent call.
// $policy - 0 or 1: writeoff/return for IV, back order/cancel for DN
- function write($policy=0) {
+ function write($policy=0) {
begin_transaction(); // prevents partial database changes in case of direct delivery/invoice
if (count($this->src_docs) == 0 && ($this->trans_type == ST_SALESINVOICE || $this->trans_type == ST_CUSTDELIVERY)) {
// this is direct document - first add parent
$ref = $this->reference;
$date = $this->document_date;
+ $due_date = $this->due_date;
$this->trans_type = get_parent_type($this->trans_type);
$this->reference = 'auto';
$this->read($this->trans_type, $trans_no, true);
$this->document_date = $date;
$this->reference = $ref;
+ $this->due_date = $due_date;
}
$this->reference = @html_entity_decode($this->reference, ENT_QUOTES);
$this->Comments = @html_entity_decode($this->Comments, ENT_QUOTES);
function get_shipping_tax()
{
- $tax_items = get_shipping_tax_as_array();
+ $tax_items = get_shipping_tax_as_array($this->tax_group_id);
$tax_rate = 0;
if ($tax_items != null) {
foreach ($tax_items as $item_tax) {
$index = $item_tax['tax_type_id'];
- if (isset($this->tax_group_array[$index])) {
+ if (isset($this->tax_group_array[$index]['rate'])) {
$tax_rate += $item_tax['rate'];
}
}