Ah, thank you, that was helpful.
Now how would I tell FA that I want another cell in the second row or how would I change the coding that affects the content of each cell in the item row?
It's much more fun, when you can discuss your problems with others...
You are not logged in. Please login or register.
FrontAccounting forum → Posts by reservhotel
Pages 1
Ah, thank you, that was helpful.
Now how would I tell FA that I want another cell in the second row or how would I change the coding that affects the content of each cell in the item row?
Okay, here is an annotated screenshot. Thank you for your help!
http://tinypic.com/r/34e8a3c/6
Okay, here is an annotated screenshot. Hope this helps!
[img]http://i49.tinypic.com/34e8a3c.jpg[/img]
As I've been looking over the coding for FA, I frequently find myself wondering where the variables are coming from. For example:
$_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);
In this snippet, where is the 'qty' or 'price' or 'Disc' coming from? Is that a reference to another array or to the database?
If it is a reference to an array, where are the items of that array defined (as in what file)? I am trying to change the line items and it's hard to know what each line item relies on in order to exist.
Thanks in advance for your help!
check apache error logs for issues and hints to where typos may exist.
I already fixed the blank screen issue. I'm still trying to change the invoice table though. Any thoughts on what I'd need to change in order to fix that?
Update: fixed blank page, realized I added a ")" where it shouldn't be.
Onward to try and fix the invoice table...
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.
With regards to creating a separate plugin, can you go into detail about how I would do that or point me to some other threads on the forum that might help me out?
Thanks for your reply!
Update: I have found potential in view_invoice.php...
start_table(TABLESTYLE, "width=95%");
if (db_num_rows($result) > 0)
{
$th = array(_("Confirmation"), _("Source"), _("Avg Rate"), _("Stay"),
_("Gross"), _("Our Charge"), _("GDS"), _("Total"));
table_header($th);
$k = 0; //row colour counter
$sub_total = 0;
while ($myrow2 = db_fetch($result))
{
if($myrow2["quantity"]==0) continue;
alt_table_row_color($k);
$value = round2(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
user_price_dec());
$sub_total += $value;
if ($myrow2["discount_percent"] == 0)
{
$display_discount = "";
}
else
{
$display_discount = percent_format($myrow2["discount_percent"]*100) . "%";
}
label_cell($myrow2["stock_id"]);
label_cell($myrow2["StockDescription"]);
qty_cell($myrow2["quantity"], false, get_qty_dec($myrow2["stock_id"]));
label_cell($myrow2["units"], "align=right");
amount_cell($myrow2["unit_price"]);
label_cell($display_discount, "nowrap align=right");
amount_cell($value);
end_row();
I will try to see if I can make the changes I need here.
Could you explain this a bit more please?
I have spent several hours trying to look through all the files for this program to find the way the program decides how many cells to put in each row in the invoice form and I have been unable to do so.
So far, I've figured out that the sales_order_entry.php has some link to the form design but there is no place in that file which talks about form fields. I want to add two new columns. I was able to edit sales_order_ui.inc and have all the headers I want displayed. So now the Direct Sales Invoice form has Confirmation, Source, Avg Rate, Stay, Gross, Our Price, GDS, Discount %, and Total across the top.
Now I want to align the rows below to match those headings. I looked in the database and found `0_sales_order_details` where I added the columns to that table. The first two are just fine (Confirmation and Source) because the display is the same as what I need it to display. It's after that that the whole thing gets jumbled. Where do I edit the design? The .css file had nothing except for font color and spacing, and all the .php files just have the website's logic. But none of the logic denotes the form! I'm sure I'm missing a very small detail but I don't think that what I'm trying to do should be that difficult. If anyone has some suggestions, please give me some direction with this issue.
Thank you,
all the best.
Ah, ok. Thanks for your clarification!
By "functional email provider in your environment" do you mean the server (such as apache), or do you mean in the actual FA program? I don't think there are any email provider configuration pages as far as I know...
pongraczi, could you elaborate on this please?
Bump, I'd also like to know how to do this...
This is a bit late, but could someone explain to me where one sets up the email module of FA? I have an email server that's configured to send emails and such but I don't see any options in FA to send emails to anyone.....
Any help or hints are greatly appreciated!
I think this is similar to what I'm asking here:
https://frontaccounting.com/punbb/viewtopic.php?id=3637
Hello everyone!
I just recently installed FrontAccounting and love this open source program. Great work, developers.
I am working to find ways to implement this software as a replacement for the current accounting software that is being used by my company.
Here is the situation:
I need to find a way for invoices of different customers to display several transactions and each of those transactions have different percentages or fees which are our commission. Does anyone know of an easy way to set this up?
Clarification/Visual of what I need:
ReservHotel (My company) --> Hotel --> Several transactions with different fees and commission percentages.
Let me know if anyone has ideas for this, thanks in advance!
Pages 1
FrontAccounting forum → Posts by reservhotel
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 4 official extensions. Copyright © 2003–2009 PunBB.