X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=purchasing%2Fincludes%2Fui%2Fpo_ui.inc;h=555737055066fcaa2dc2cda0388ba9031571d05a;hb=9a98bb3bc7a94f1a8e47f8dab45a87c8b4212080;hp=5f713a481791f8d3e7eb0b8612489eb3e6639861;hpb=46c5f7a65a7659a44ae8254c63152074363d3987;p=fa-stable.git diff --git a/purchasing/includes/ui/po_ui.inc b/purchasing/includes/ui/po_ui.inc index 5f713a48..55573705 100644 --- a/purchasing/includes/ui/po_ui.inc +++ b/purchasing/includes/ui/po_ui.inc @@ -19,13 +19,14 @@ function copy_from_cart() $_POST['supplier_id'] = $cart->supplier_id; $_POST['OrderDate'] = $cart->orig_order_date; - if ($cart->trans_type==ST_SUPPINVOICE) + if ($cart->trans_type == ST_SUPPINVOICE) $_POST['due_date'] = $cart->due_date; $_POST['supp_ref'] = $cart->supp_ref; $_POST['ref'] = $cart->reference; $_POST['Comments'] = $cart->Comments; $_POST['StkLocation'] = $cart->Location; $_POST['delivery_address'] = $cart->delivery_address; + $_POST['tax_algorithm'] = $cart->tax_algorithm; } function copy_to_cart() @@ -34,19 +35,21 @@ function copy_to_cart() $cart->supplier_id = $_POST['supplier_id']; $cart->orig_order_date = $_POST['OrderDate']; - if ($cart->trans_type==ST_SUPPINVOICE) + if ($cart->trans_type == ST_SUPPINVOICE) $cart->due_date = $_POST['due_date']; $cart->reference = $_POST['ref']; $cart->supp_ref = $_POST['supp_ref']; $cart->Comments = $_POST['Comments']; $cart->Location = $_POST['StkLocation']; $cart->delivery_address = $_POST['delivery_address']; + if (isset($_POST['tax_algorithm'])) + $cart->tax_algorithm = $_POST['tax_algorithm']; } // ------------------------------------------------------------------------------ function get_supplier_details_to_order(&$order, $supplier_id) { - $sql = "SELECT curr_code, supp_name, tax_group_id, supp.tax_included, + $sql = "SELECT curr_code, supp_name, tax_group_id, supp.tax_included, supp.tax_algorithm, supp.credit_limit - Sum(IFNULL(IF(trans.type=".ST_SUPPCREDIT.", -1, 1) * (ov_amount + ov_gst + ov_discount),0)) as cur_credit, terms.terms, terms.days_before_due, terms.day_in_following_month @@ -71,7 +74,7 @@ function get_supplier_details_to_order(&$order, $supplier_id) $_POST['curr_code'] = $myrow["curr_code"]; $order->set_supplier($supplier_id, $myrow["supp_name"], $myrow["curr_code"], - $myrow["tax_group_id"], $myrow["tax_included"]); + $myrow["tax_group_id"], $myrow["tax_included"], $myrow["tax_algorithm"]); } //--------------------------------------------------------------------------------------------------- @@ -130,6 +133,7 @@ function display_po_header(&$order) get_supplier_details_to_order($order, $_POST['supplier_id']); get_duedate_from_terms($order); $_POST['due_date'] = $order->due_date; + $_POST['tax_algorithm'] = $order->tax_algorithm; // supplier default price update foreach ($order->line_items as $line_no=>$item) { @@ -141,6 +145,7 @@ function display_po_header(&$order) } $Ajax->activate('items_table'); $Ajax->activate('due_date'); + $Ajax->activate('tax_algorithm'); } set_global_supplier($_POST['supplier_id']); @@ -201,7 +206,7 @@ function display_po_header(&$order) /*If this is the first time the form loaded set up defaults */ //$_POST['StkLocation'] = $_SESSION['UserStockLocation']; - $sql = "SELECT delivery_address, phone FROM ".TB_PREF."locations WHERE loc_code='" . db_escape($_POST['StkLocation']) . "'"; + $sql = "SELECT delivery_address, phone FROM ".TB_PREF."locations WHERE loc_code=".db_escape($_POST['StkLocation']); $result = db_query($sql,"could not get location info"); if (db_num_rows($result) == 1) @@ -358,7 +363,7 @@ function display_po_summary(&$po, $is_self=false, $editable=false) function po_item_controls(&$order, &$rowcounter, $line_no=-1) { - global $Ajax; + global $Ajax, $SysPrefs; alt_table_row_color($rowcounter); @@ -397,7 +402,9 @@ function po_item_controls(&$order, &$rowcounter, $line_no=-1) { // hidden('line_no', ($_SESSION['PO']->lines_on_order + 1)); - stock_purchasable_items_list_cells(null, 'stock_id', null, false, true, true); + //Chaitanya : Manufcatured item can be purchased + stock_items_list_cells(null, 'stock_id', null, false, true, true); + //stock_purchasable_items_list_cells(null, 'stock_id', null, false, true, true); if (list_updated('stock_id')) { $Ajax->activate('price'); $Ajax->activate('units'); @@ -413,7 +420,7 @@ function po_item_controls(&$order, &$rowcounter, $line_no=-1) //$_POST['price'] = price_format(get_purchase_price ($order->supplier_id, $_POST['stock_id'])); $_POST['price'] = price_decimal_format(get_purchase_price ($order->supplier_id, $_POST['stock_id']), $dec2); if ($order->trans_type == ST_PURCHORDER) - $_POST['req_del_date'] = add_days(Today(), 10); + $_POST['req_del_date'] = add_days(Today(), $SysPrefs->default_receival_required_by()); $qty_rcvd = ''; } @@ -423,7 +430,13 @@ function po_item_controls(&$order, &$rowcounter, $line_no=-1) label_cell($_POST['units'], '', 'units'); if ($order->trans_type == ST_PURCHORDER) date_cells(null, 'req_del_date', '', null, 0, 0, 0); - amount_cells(null, 'price', null, null, null, $dec2); + if ($qty_rcvd > 0) + { + amount_decimal_cell($_POST['price']); + hidden('price', $_POST['price']); + } + else + amount_cells(null, 'price', null, null, null, $dec2); //$line_total = $_POST['qty'] * $_POST['price'] * (1 - $_POST['Disc'] / 100); $line_total = round(input_num('qty') * input_num('price'), user_price_dec());