$tax_total = 0;
$taxes = $supp_trans->get_taxes($supp_trans->tax_group_id);
+
foreach ($taxes as $taxitem)
{
$tax_total += $taxitem['Value'];
}
$line_taxfree = $entered_grn->taxfree_charge_price($supp_trans->tax_group_id);
- $line_tax = $entered_grn->full_charge_price() - $line_taxfree;
+ $line_tax = $entered_grn->full_charge_price($supp_trans->tax_group_id) - $line_taxfree;
update_supp_received_items_for_invoice($entered_grn->id, $entered_grn->po_detail_item,
$entered_grn->this_quantity_inv, $entered_grn->chg_price);
if (!$supp_trans->is_invoice)
$taxitem['Value'] = -$taxitem['Value'];
-
+ // here we suppose that tax is never included in price (we are company customer).
add_supp_invoice_tax_item($trans_type, $invoice_id, $taxitem['tax_type_id'],
- $taxitem['rate'], $taxitem['included_in_price'], $taxitem['Value']);
+ $taxitem['rate'], 0, $taxitem['Value']);
add_gl_trans_supplier($trans_type, $invoice_id, $date_,
$taxitem['purchasing_gl_code'], 0, 0, $taxitem['Value'],
function get_supp_invoice_items($supp_trans_type, $supp_trans_no)
{
- $sql = "SELECT *,unit_price+unit_tax AS FullUnitPrice FROM ".TB_PREF."supp_invoice_items
+ $sql = "SELECT *, unit_price AS FullUnitPrice FROM ".TB_PREF."supp_invoice_items
WHERE supp_trans_type = $supp_trans_type
AND supp_trans_no = $supp_trans_no ORDER BY id";
return db_query($sql, "Cannot retreive supplier transaction detail records");
$this->gl_code = $gl_code;
}
- function full_charge_price()
+ function full_charge_price($tax_group_id, $tax_group=null)
{
- return $this->chg_price;
+ return get_full_price_for_item($this->item_code,
+ $this->chg_price, $tax_group_id, 0, $tax_group);
}
function taxfree_charge_price($tax_group_id, $tax_group=null)
{
- if ($tax_group_id==null)
- return $this->chg_price;
- return get_tax_free_price_for_item($this->item_code, $this->chg_price, $tax_group_id, $tax_group);
+// if ($tax_group_id==null)
+// return $this->chg_price;
+ return get_tax_free_price_for_item($this->item_code, $this->chg_price,
+ $tax_group_id, 0, $tax_group);
}
}
$_POST['supp_reference'] = $supp_trans->supp_reference;
$_POST['reference'] = $supp_trans->reference;
$_POST['supplier_id'] = $supp_trans->supplier_id;
- $_POST['tax_group_id'] = $supp_trans->tax_group_id;
}
//--------------------------------------------------------------------------------------------------
$supp_trans->due_date = $_POST['due_date'];
$supp_trans->supp_reference = $_POST['supp_reference'];
$supp_trans->reference = $_POST['reference'];
- $supp_trans->tax_group_id = $_POST['tax_group_id'];
-
$supp_trans->ov_amount = 0; /* for starters */
if (count($supp_trans->grn_items) > 0)
exchange_rate_display($supplier_currency, $company_currency, $_POST['tran_date']);
}
-
- if (!isset($_POST['tax_group_id']))
- $_POST['tax_group_id'] = $supp_trans->tax_group_id;
- tax_groups_list_row(_("Tax Group:"), 'tax_group_id', $_POST['tax_group_id'], true);
-
+ label_row(_("Tax Group:"), $supp_trans->tax_description);
echo "</table>";
echo "</td>";
start_table("$table_style width=95%");
label_row(_("Sub-total:"), price_format( $supp_trans->ov_amount), "align=right", "align=right");
- $taxes = $supp_trans->get_taxes($_POST['tax_group_id']);
+ $taxes = $supp_trans->get_taxes($supp_trans->tax_group_id);
$tax_total = display_edit_tax_items($taxes, 1, 0); // tax_included==0 (we are the company)
$display_total = price_format($supp_trans->ov_amount + $tax_total);
$rep->TextCol(0, 1, $myrow['stk_code']);
$rep->TextCol(1, 2, $myrow['description']);
$rep->TextCol(2, 3, number_format2($myrow['quantity'], $dec));
- $rep->TextCol(3, 4, number_format2($myrow['qty_invoiced'], $dec));
+ $rep->TextCol(3, 4, number_format2($myrow['qty_sent'], $dec));
$rep->TextCol(4, 5, number_format2($myrow['quantity'] - $myrow['qty_sent'], $dec));
if ($myrow['quantity'] - $myrow['qty_sent'] > 0)
{