Update:
Ok so I went ahead and started making some edits to the files you mentioned apmuthu. However, now the site is coming up as a blank page, so I think I may have broken something in the code of one of the *_db files. Here is a rundown of all the edits I've made.
sales_order_db.inc
Changed lines 82-90 to include gross and gds
$sql = "INSERT INTO ".TB_PREF."sales_order_details (order_no, trans_type, stk_code, description, unit_price, quantity, gross, discount_percent, gds) VALUES (";
$sql .= $order_no . ",".$order->trans_type .
",".db_escape($line->stock_id).", "
.db_escape($line->item_description).", $line->price,
$line->quantity,
$line->gross,
$line->discount_percent,
$line->gds");
db_query($sql, "order Details Cannot be Added");
Changed lines 234-247 to include gross and gds
$sql = "INSERT INTO ".TB_PREF."sales_order_details
(id, order_no, trans_type, stk_code, description, unit_price, quantity, gross,
discount_percent, gds, qty_sent)
VALUES (";
$sql .= db_escape($line->id ? $line->id : 0) . ","
.$order_no . ",".$order->trans_type.","
.db_escape($line->stock_id) . ","
.db_escape($line->item_description) . ", "
.db_escape($line->price) . ", "
.db_escape($line->quantity) . ", "
.db_escape($line->gross) . ", "
.db_escape($line->discount_percent) . ", "
.db_escape($line->gds) . ", "
.db_escape($line->qty_done) ." )";
db_query($sql, "Old order Cannot be Inserted");
} /* inserted line items into sales order details */
Changed lines 327-343 to include gross and gds
function get_sales_order_details($order_no, $trans_type) {
$sql = "SELECT id, stk_code, unit_price, "
.TB_PREF."sales_order_details.description,"
.TB_PREF."sales_order_details.quantity, gross,
discount_percent, gds,
qty_sent as qty_done, "
.TB_PREF."stock_master.units,"
.TB_PREF."stock_master.mb_flag,"
.TB_PREF."stock_master.material_cost + "
.TB_PREF."stock_master.labour_cost + "
.TB_PREF."stock_master.overhead_cost AS standard_cost
FROM ".TB_PREF."sales_order_details, ".TB_PREF."stock_master
WHERE ".TB_PREF."sales_order_details.stk_code = ".TB_PREF."stock_master.stock_id
AND order_no =" . db_escape($order_no)
." AND trans_type = " . db_escape($trans_type) . " ORDER BY id";
return db_query($sql, "Retreive order Line Items");
}
Changed lines 383-390 to include gross and gds
$result = get_sales_order_details($order_no, $order->trans_type);
if (db_num_rows($result) > 0)
{
$line_no=0;
while ($myrow = db_fetch($result))
{
$order->add_to_cart($line_no,$myrow["stk_code"],$myrow["quantity"],
$myrow["unit_price"], $myrow["discount_percent"], $myrow["gds"], $myrow["gross"],
$myrow["qty_done"], $myrow["standard_cost"], $myrow["description"], $myrow["id"] );
$line_no++;
}
}
return true;
}
sales/view/view_invoice.php
Changed lines 107-145
-Edited $th array to show Confirmation, Source, Avg Rate, Stay, Gross, Our Charge, GDS, and Total for the table headings.
-Added lines 141 to reflect math for Gross cell.
amount_cell($myrow2["unit_price"] * $myrow2["quantity"]);
-Added line 143 for GDS.
amount_cell($myrow2["gds"]);
sales/includes/ui/sales_order_ui.inc
Edited lines 144-145
$th = array(_("Confirmation"), _("Source"), _("Avg Rate"), _("Stay"), _("Gross"), $order->tax_included ? _("Our Charge") : _("Price before Tax"), _("GDS"), _("Total"),);
Changed lines 163-218. Not sure if my additions are valid or not though.
$line_total = round($stock_item->qty_dispatched * $stock_item->price * (1 - $stock_item->discount_percent),
user_price_dec());
$qoh_msg = '';
if (!$editable_items || $id != $line_no)
{
if (!$SysPrefs->allow_negative_stock() && is_inventory_item($stock_item->stock_id) &&
$order->trans_type != ST_SALESORDER && $order->trans_type!=ST_SALESQUOTE) {
$qoh = get_qoh_on_date($stock_item->stock_id,
$_POST['Location'], $_POST['delivery_date']);
if (($stock_item->qty_dispatched -$stock_item->qty_done) > $qoh)
{
// oops, we don't have enough of one of the component items
start_row("class='stockmankobg'");
$qoh_msg .= $stock_item->stock_id . " - " . $stock_item->item_description . ": " .
_("Quantity On Hand") . " = "
. number_format2($qoh, get_qty_dec($stock_item->stock_id)) . '<br>';
$has_marked = true;
} else
alt_table_row_color($k);
} else {
alt_table_row_color($k);
}
view_stock_status_cell($stock_item->stock_id);
//label_cell($stock_item->item_description, "nowrap" );
label_cell($stock_item->item_description );
amount_cell($stock_item->price);
$dec = get_qty_dec($stock_item->stock_id);
qty_cell($stock_item->qty_dispatched, false, $dec);
if ($order->trans_no!=0)
qty_cell($stock_item->qty_done, false, $dec);
//label_cell($stock_item->units);
amount_cell($stock_item->price * $stock_item->qty_dispatched);
percent_cell($stock_item->discount_percent * 100);
amount_cell($stock_item->gds);
amount_cell($line_total);
if ($editable_items)
{
edit_button_cell("Edit$line_no", _("Edit"),
_('Edit document line'));
delete_button_cell("Delete$line_no", _("Delete"),
_('Remove line from document'));
}
end_row();
}
else
{
sales_order_item_controls($order, $k, $line_no);
}
$total += $line_total;
}
I know I need to edit/change lines 489-572 but I don't know what or how to do so (unsure of syntax, looking for any help!)
function sales_order_item_controls(&$order, &$rowcounter, $line_no=-1)
{
global $Ajax;
alt_table_row_color($rowcounter);
$id = find_submit('Edit');
if ($line_no!=-1 && $line_no == $id) // edit old line
{
$_POST['stock_id'] = $order->line_items[$id]->stock_id;
$dec = get_qty_dec($_POST['stock_id']);
$_POST['qty'] = number_format2($order->line_items[$id]->qty_dispatched, $dec);
$_POST['price'] = price_format($order->line_items[$id]->price);
$_POST['Disc'] = percent_format($order->line_items[$id]->discount_percent*100);
$units = $order->line_items[$id]->units;
$_POST['item_description'] = $order->line_items[$id]->item_description;
hidden('stock_id', $_POST['stock_id']);
label_cell($_POST['stock_id']);
if ($order->line_items[$id]->descr_editable)
text_cells(null,'item_description', null, 45, 150);
else {
hidden('item_description', $_POST['item_description']);
label_cell($_POST['item_description']);
}
// } else {
// sales_items_list_cells(null,'item_description', null, false, true);
// }
//label_cell($order->line_items[$line_no]->item_description, "nowrap");
$Ajax->activate('items_table');
}
else // prepare new line
{
sales_items_list_cells(null,'stock_id', null, false, true);
if (list_updated('stock_id')) {
$Ajax->activate('price');
$Ajax->activate('units');
$Ajax->activate('qty');
$Ajax->activate('line_total');
}
$item_info = get_item_edit_info($_POST['stock_id']);
$units = $item_info["units"];
$dec = $item_info['decimals'];
$_POST['qty'] = number_format2(1, $dec);
$price = get_kit_price($_POST['stock_id'],
$order->customer_currency, $order->sales_type,
$order->price_factor, get_post('OrderDate'));
$_POST['price'] = price_format($price);
// default to the customer's discount %
$_POST['Disc'] = percent_format($order->default_discount * 100);
}
qty_cells(null, 'qty', $_POST['qty'], null, null, $dec);
if ($order->trans_no!=0) {
qty_cell($line_no==-1 ? 0 :$order->line_items[$line_no]->qty_done, false, $dec);
}
label_cell($units, '', 'units');
amount_cells(null, 'price');
small_amount_cells(null, 'Disc', percent_format($_POST['Disc']), null, null, user_percent_dec());
$line_total = input_num('qty') * input_num('price') * (1 - input_num('Disc') / 100);
amount_cell($line_total, false, '','line_total');
if ($id!=-1)
{
button_cell('UpdateItem', _("Update"),
_('Confirm changes'), ICON_UPDATE);
button_cell('CancelItemChanges', _("Cancel"),
_('Cancel changes'), ICON_CANCEL);
hidden('LineNo', $line_no);
set_focus('qty');
}
else
{
submit_cells('AddItem', _("Add Item"), "colspan=2 align='center'",
_('Add new item to document'), true);
}
end_row();
}
I have looked at sales/includes/db/sales_invoice_db.inc but I don't really know what or how to change the values there to include the two new values I want. Any thoughts, advice, tips, etc are greatly appreciated.
As I said before, right now I'm getting a blank page whenever I try to access any pages on the site, I can't even log in. I think it's related to the sales_order_db.inc file that I edited, but I'm not sure. If it is, does anyone have any ideas why this might be? Thanks for all your help!
I wish you all a great holiday.