include_once($path_to_root . "/gl/includes/ui/gl_journal_ui.inc");
include_once($path_to_root . "/gl/includes/gl_db.inc");
include_once($path_to_root . "/gl/includes/gl_ui.inc");
+include_once($path_to_root . "/taxes/db/tax_types_db.inc");
$js = '';
if ($use_popup_windows)
}
}
}
+ //_vd($this->select);
+ //_vd($this->from);
+ //_vd($this->where);
+ //_vd($this->group);
+ //_vd($this->order);
}
//
// Set additional constraint on record set
} else
return false;
return true;
- }
+ }
//
// Calculates page numbers for html controls.
//
}
if ($db_type != null) {
- $sql = "SELECT $db_ref FROM $db_name
+ $sql = "SELECT $db_ref FROM $db_name tbl
LEFT JOIN ".TB_PREF."voided v ON
- $db_name.$db_type=v.type AND $db_name.$db_trans=v.id
- WHERE $db_name.$db_ref=$ref AND ISNULL(v.id)
- AND $db_name.$db_type=$type";
+ tbl.$db_type=v.type AND tbl.$db_trans=v.id
+ WHERE $db_ref=$ref AND ISNULL(v.id)
+ AND tbl.$db_type=$type";
} else {
- $sql = "SELECT $db_ref FROM $db_name
+ $sql = "SELECT $db_ref ref FROM $db_name tbl
LEFT JOIN ".TB_PREF."voided v ON
- v.type=$type AND $db_name.$db_trans=v.id
+ v.type=$type AND tbl.$db_trans=v.id
WHERE $db_ref=$ref AND ISNULL(v.id)";
}
+ if ($trans_no)
+ $sql .= " AND tbl.`$db_trans` != ".db_escape($trans_no);
$result = db_query($sql, "could not test for unique reference");
$taxitem['tax_type_id'], $taxitem['rate'], $supp_trans->tax_included, $taxitem['Value'],
$taxitem['Net'], $ex_rate, $date_, $supp_trans->supp_reference);
- 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->supplier_id,
- "A general ledger transaction for the tax amount could not be added");
+ if (isset($taxitem['purchasing_gl_code']))
+ {
+ 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->supplier_id,
+ "A general ledger transaction for the tax amount could not be added");
+ }
}
}
if ($trans_type == ST_SUPPCREDIT)
$supp_trans->supplier_id,
"The general ledger transaction for the control total could not be added");
+ $to_allocate = ($invoice_items_total + $item_added_tax + $supp_trans->ov_discount);
+
foreach ($supp_trans->gl_codes as $entered_gl_code)
{
/*GL Items are straight forward - just do the debit postings to the GL accounts specified -
$sql = $sql2;
}
elseif (!isset($filter) || $filter == ALL_TEXT || $filter == '6') {
- $sql = "SELECT * FROM (($sql) UNION ($sql2)) as tr";
+ $sql = "SELECT * FROM (($sql) UNION ($sql2)) as tr WHERE 1";
}
if (isset($filter) && $filter != ALL_TEXT)
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
+include_once($path_to_root . "/purchasing/includes/supp_trans_class.inc");
+
include_once($path_to_root . "/includes/banking.inc");
include_once($path_to_root . "/includes/date_functions.inc");
gl_all_accounts_list_row(_("Purchase Discount Account:"), 'payment_discount_account', $_POST['payment_discount_account']);
if (!$supplier_id) {
table_section_title(_("Contact Data"));
+ text_row(_("Contact Person:"), 'contact', null, 42, 40);
text_row(_("Phone Number:"), 'phone', null, 32, 30);
text_row(_("Secondary Phone Number:"), 'phone2', null, 32, 30);
table_section_title(_("Contact Data"));
check_deferred_income_act(_("You have to set Deferred Income Account in GL Setup to entry prepayment invoices."));
if ($ord->count_items() == 0) {
- echo "<br><center><b>" . _("This order has no items. There is nothing to delivery.") .
- "</center></b>";
hyperlink_params($path_to_root . "/sales/inquiry/sales_orders_view.php",
_("Select a different sales order to delivery"), "OutstandingOnly=1");
+ echo "<br><center><b>" . _("This order has no items. There is nothing to delivery.") .
+ "</center></b>";
display_footer_exit();
- } else if (!$ord->prep_amount) {
- echo "<br><center><b>"._("This prepayment order is not yet ready for delivery due to insufficient amount received.")
- ."</center></b>";
+ } else if (!$ord->is_released()) {
hyperlink_params($path_to_root . "/sales/inquiry/sales_orders_view.php",_("Select a different sales order to delivery"),
"OutstandingOnly=1");
+ echo "<br><center><b>"._("This prepayment order is not yet ready for delivery due to insufficient amount received.")
+ ."</center></b>";
display_footer_exit();
}
// Adjust Shipping Charge based upon previous deliveries TAM
ship_via=".db_escape($ship_via).", alloc=$AllocAmt,
dimension_id=".db_escape($dimension_id).", dimension2_id=".db_escape($dimension2_id).",
payment_terms=".db_escape($payment_terms, true).",
- tax_included=".db_escape($tax_included)."
+ tax_included=".db_escape($tax_included).",
prep_amount =".db_escape($prep_amount)."
WHERE trans_no=".db_escape($trans_no)." AND type=".db_escape($trans_type);
}