$invoice_items_total = $supp_trans->get_total_charged($supp_trans->tax_group_id);
- if ($supp_trans->is_invoice)
- $trans_type = ST_SUPPINVOICE;
- else
+ $trans_type = $supp_trans->trans_type;
+
+ if ($trans_type == ST_SUPPCREDIT)
{
- $trans_type = ST_SUPPCREDIT;
// let's negate everything because it's a credit note
$invoice_items_total = -$invoice_items_total;
$tax_total = -$tax_total;
/*GL Items are straight forward - just do the debit postings to the GL accounts specified -
the credit is to creditors control act done later for the total invoice value + tax*/
- if (!$supp_trans->is_invoice)
+ if ($trans_type == ST_SUPPCREDIT)
$entered_gl_code->amount = -$entered_gl_code->amount;
$memo_ = $entered_gl_code->memo_;
$entered_gl_code->amount, $memo_);
// store tax details if the gl account is a tax account
- if (!$supp_trans->is_invoice)
+ if ($trans_type == ST_SUPPCREDIT)
$entered_gl_code->amount = -$entered_gl_code->amount;
add_gl_tax_details($entered_gl_code->gl_code,
$trans_type, $invoice_id, $entered_gl_code->amount,
foreach ($supp_trans->grn_items as $entered_grn)
{
- if (!$supp_trans->is_invoice)
+ if ($trans_type == ST_SUPPCREDIT)
{
$entered_grn->this_quantity_inv = -$entered_grn->this_quantity_inv;
set_grn_item_credited($entered_grn, $supp_trans->supplier_id, $invoice_id, $date_);
$stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'],
$entered_grn->this_quantity_inv * $line_taxfree, $supp_trans->supplier_id);
// -------------- if price changed since po received. 16 Aug 2008 Joe Hunt
- if($supp_trans->is_invoice)
+ if ($trans_type == ST_SUPPINVOICE)
{
$old = update_supp_received_items_for_invoice($entered_grn->id, $entered_grn->po_detail_item,
$entered_grn->this_quantity_inv, $entered_grn->chg_price);
if ($taxitem['Net'] != 0)
{
- if (!$supp_trans->is_invoice)
+ if ($trans_type == ST_SUPPCREDIT)
{
$taxitem['Net'] = -$taxitem['Net'];
$taxitem['Value'] = -$taxitem['Value'];
$taxitem['tax_type_id'], $taxitem['rate'], 0, $taxitem['Value'],
$taxitem['Net'], $ex_rate, $date_, $supp_trans->supp_reference);
- if (!$supp_trans->is_invoice)
+ if ($trans_type == ST_SUPPCREDIT)
$taxitem['Value'] = -$taxitem['Value'];
$total += add_gl_trans_supplier($trans_type, $invoice_id, $date_,
$taxitem['purchasing_gl_code'], 0, 0, $taxitem['Value'],
{
$supp_trans->add_grn_to_trans($details_row["grn_item_id"], $details_row["po_detail_item_id"], $details_row["stock_id"],
$details_row["description"], 0, 0, $details_row["quantity"], 0, $details_row["FullUnitPrice"],
- false, 0, 0);
+ 0, 0);
}
else
{