ref_cells(_("to #:"), 'ToTransNo');
- submit_cells('ProcessSearch', _("Search"));
+ submit_cells('ProcessSearch', _("Search"), '', '', true);
end_row();
end_table(1);
else
$th = array(_("#"), _("View"), _("GL"));
}
+ div_start('transactions');
start_table($table_style);
table_header($th);
$k = 0;
}
end_table();
+ div_end();
}
}
{
if (!check_valid_entries())
unset($_POST['ProcessSearch']);
+ $Ajax->activate('transactions');
}
//----------------------------------------------------------------------------------------
end_table(1);
if (!isset($_POST['ProcessVoiding']))
- submit_center('ProcessVoiding', _("Void Transaction"));
+ submit_center('ProcessVoiding', _("Void Transaction"), true, '', true);
else
{
display_note(_("Are you sure you want to void this transaction ? This action cannot be undone."), 0, 1);
- submit_center_first('ConfirmVoiding', _("Proceed"));
- submit_center_last('CancelVoiding', _("Cancel"));
+ submit_center_first('ConfirmVoiding', _("Proceed"), '', true);
+ submit_center_last('CancelVoiding', _("Cancel"), '', true);
}
end_form();
{
if (!check_valid_entries())
unset($_POST['ProcessVoiding']);
+ $Ajax->activate('_page_body');
}
if (isset($_POST['ConfirmVoiding']))
{
handle_void_transaction();
+ $Ajax->activate('_page_body');
+}
+
+if (isset($_POST['CancelVoiding']))
+{
+ $Ajax->activate('_page_body');
}
//----------------------------------------------------------------------------------------
end_table(1);
-submit_add_or_update_center($selected_id == -1, '', true);
-
if ($selected_id != -1)
{
echo "<br>";
-
- submit_center_first('close', _("Close This Dimension"), _('Mark this dimension as closed'), true);
+ submit_center_first('UPDATE_ITEM', _("Update"), _('Save changes to dimension'), true);
+ submit('close', _("Close This Dimension"), true, _('Mark this dimension as closed'), true);
submit_center_last('delete', _("Delete This Dimension"), _('Delete unused dimension'), true);
}
-
+else
+{
+ submit_center('ADD_ITEM', _("Add"), true, '', true);
+}
end_form();
//--------------------------------------------------------------------------------------------
check_db_has_workcentres(_("There are no work centres defined in the system. BOMs require at least one work centre be defined."));
+simple_page_mode(true);
+$selected_component = $selected_id;
//--------------------------------------------------------------------------------------------------
-if (isset($_GET["NewItem"]))
-{
- $_POST['stock_id'] = $_GET["NewItem"];
-}
-if (isset($_GET['stock_id']))
-{
- $_POST['stock_id'] = $_GET['stock_id'];
- $selected_parent = $_GET['stock_id'];
-}
+//if (isset($_GET["NewItem"]))
+//{
+// $_POST['stock_id'] = $_GET["NewItem"];
+//}
+//if (isset($_GET['stock_id']))
+//{
+// $_POST['stock_id'] = $_GET['stock_id'];
+// $selected_parent = $_GET['stock_id'];
+//}
/* selected_parent could come from a post or a get */
-if (isset($_GET["selected_parent"]))
+/*if (isset($_GET["selected_parent"]))
{
$selected_parent = $_GET["selected_parent"];
}
{
$selected_parent = $_POST["selected_parent"];
}
+*/
/* selected_component could also come from a post or a get */
-if (isset($_GET["selected_component"]))
+/*if (isset($_GET["selected_component"]))
{
$selected_component = $_GET["selected_component"];
}
-elseif (isset($_POST["selected_component"]))
+else
{
- $selected_component = $_POST["selected_component"];
+ $selected_component = get_post("selected_component", -1);
}
-
+*/
//--------------------------------------------------------------------------------------------------
label_cell($myrow["WorkCentreDescription"]);
qty_cell($myrow["quantity"], false, get_qty_dec($myrow["component"]));
label_cell($myrow["units"]);
- edit_link_cell(SID . "NewItem=$selected_parent&selected_component=" . $myrow["id"]);
- delete_link_cell(SID . "delete=" . $myrow["id"]. "&stock_id=" . $_POST['stock_id']);
+ edit_button_cell("Edit".$myrow['id'], _("Edit"));
+ edit_button_cell("Delete".$myrow['id'], _("Delete"));
end_row();
} //END WHILE LIST LOOP
//--------------------------------------------------------------------------------------------------
-function on_submit($selected_parent, $selected_component=null)
+function on_submit($selected_parent, $selected_component=-1)
{
if (!check_num('quantity', 0))
{
return;
}
- if (isset($selected_parent) && isset($selected_component))
+ if ($selected_component != -1)
{
$sql = "UPDATE ".TB_PREF."bom SET workcentre_added='" . $_POST['workcentre_added'] . "',
check_db_error("Could not update this bom component", $sql);
db_query($sql,"could not update bom");
-
+ display_notification(_('Selected component has been updated'));
+ $Mode = 'RESET';
}
- elseif (!isset($selected_component) && isset($selected_parent))
+ else
{
/*Selected component is null cos no item selected on first time round
component form */
//need to check not recursive bom component of itself!
- If (!check_for_recursive_bom($selected_parent, $_POST['component']))
+ if (!check_for_recursive_bom($selected_parent, $_POST['component']))
{
/*Now check to see that the component is not already on the bom */
. input_num('quantity') . ")";
db_query($sql,"check failed");
-
- //$msg = _("A new component part has been added to the bill of material for this item.");
-
+ display_notification(_("A new component part has been added to the bill of material for this item."));
+ $Mode = 'RESET';
}
else
{
//--------------------------------------------------------------------------------------------------
-if (isset($_GET['delete']))
+if ($Mode == 'Delete')
{
-
- $sql = "DELETE FROM ".TB_PREF."bom WHERE id='" . $_GET['delete']. "'";
+ $sql = "DELETE FROM ".TB_PREF."bom WHERE id='" . $selected_component. "'";
db_query($sql,"Could not delete this bom components");
- display_note(_("The component item has been deleted from this bom."));
+ display_notification(_("The component item has been deleted from this bom"));
+ $Mode = 'RESET';
+}
+if ($Mode == 'RESET')
+{
+ $selected_component = -1;
+ unset($_POST['quantity']);
}
//--------------------------------------------------------------------------------------------------
start_form(false, true);
-//echo $msg;
echo "<center>" . _("Select a manufacturable item:") . " ";
-stock_bom_items_list('stock_id', null, false, true);
-echo "</center>";
+stock_bom_items_list('selected_parent', null, false, true);
+echo "</center><br>";
end_form();
-
-if (isset($_POST['_stock_id_update']))
- $Ajax->activate('bom');
+if (isset($_POST['_selected_parent_update']))
+ $Ajax->activate('_page_body');
//--------------------------------------------------------------------------------------------------
-if (isset($_POST['stock_id']))
+if (get_post('selected_parent') != '')
{ //Parent Item selected so display bom or edit component
- $selected_parent = $_POST['stock_id'];
- if (isset($selected_parent) && isset($_POST['Submit'])) {
- if(isset($selected_component))
+ $selected_parent = $_POST['selected_parent'];
+ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
on_submit($selected_parent, $selected_component);
- else
- on_submit($selected_parent);
- }
//--------------------------------------------------------------------------------------
+start_form();
display_bom_items($selected_parent);
-
- if (isset($selected_parent) && isset($selected_component))
- {
- hyperlink_params($_SERVER['PHP_SELF'], _("Add a new Component"), "NewItem=$selected_parent");
- }
-
+//end_form();
//--------------------------------------------------------------------------------------
-
- start_form(false, true, $_SERVER['PHP_SELF'] . "?" . SID . "NewItem=" . $selected_parent);
+ echo '<br>';
+// start_form(false, true);
start_table($table_style2);
- if (isset($selected_component))
+ if ($selected_component != -1)
{
- //editing a selected component from the link to the line item
- $sql = "SELECT ".TB_PREF."bom.*,".TB_PREF."stock_master.description FROM ".TB_PREF."bom,".TB_PREF."stock_master
- WHERE id='$selected_component'
- AND ".TB_PREF."stock_master.stock_id=".TB_PREF."bom.component";
-
- $result = db_query($sql, "could not get bom");
- $myrow = db_fetch($result);
-
- $_POST['loc_code'] = $myrow["loc_code"];
- $_POST['workcentre_added'] = $myrow["workcentre_added"];
- $_POST['quantity'] = number_format2($myrow["quantity"], get_qty_dec($myrow["component"]));
-
- hidden('selected_parent', $selected_parent);
- hidden('selected_component', $selected_component);
+ if ($Mode == 'Edit') {
+ //editing a selected component from the link to the line item
+ $sql = "SELECT ".TB_PREF."bom.*,".TB_PREF."stock_master.description FROM ".TB_PREF."bom,".TB_PREF."stock_master
+ WHERE id='$selected_component'
+ AND ".TB_PREF."stock_master.stock_id=".TB_PREF."bom.component";
+
+ $result = db_query($sql, "could not get bom");
+ $myrow = db_fetch($result);
+
+ $_POST['loc_code'] = $myrow["loc_code"];
+ $_POST['workcentre_added'] = $myrow["workcentre_added"];
+ $_POST['quantity'] = number_format2($myrow["quantity"], get_qty_dec($myrow["component"]));
+ }
+ hidden('component', $selected_component);
label_row(_("Component:"), $myrow["component"] . " - " . $myrow["description"]);
-
}
else
- { //end of if $selected_component
-
- hidden('selected_parent', $selected_parent);
-
+ {
start_row();
label_cell(_("Component:"));
echo "<td>";
stock_component_items_list('component', $selected_parent, null, false, true);
+ if (get_post('_component_update'))
+ {
+ $Ajax->activate('quantity');
+ }
echo "</td>";
end_row();
}
+ hidden('selected_parent', $selected_parent);
locations_list_row(_("Location to Draw From:"), 'loc_code', null);
workcenter_list_row(_("Work Centre Added:"), 'workcentre_added', null);
- $dec = get_qty_dec($_POST['component']);
- if (!isset($_POST['quantity']))
- {
- $_POST['quantity'] = number_format2(1, $dec);
- }
- qty_row(_("Quantity:"), 'quantity', $_POST['quantity'], null, null, $dec);
+ $dec = get_qty_dec(get_post('component'));
+ $_POST['quantity'] = number_format2(input_num('quantity',1), $dec);
+ qty_row(_("Quantity:"), 'quantity', null, null, null, $dec);
end_table(1);
- submit_center('Submit', _("Add/Update"));
-
+ submit_add_or_update_center($selected_component == -1, '', true);
end_form();
}
-
// ----------------------------------------------------------------------------------
end_page();
end_table(1);
-submit_add_or_update_center(!isset($selected_id), '', true);
-
if (isset($selected_id))
{
- echo "<br><br><table align=center><tr>";
+ echo "<table align=center><tr>";
+ submit_cells('UPDATE_ITEM', _("Update"), '', _('Save changes to work order'), true);
if (isset($_POST['released']))
{
submit_cells('close', _("Close This Work Order"),'','',true);
echo "</tr></table>";
}
+else
+{
+ submit_center('ADD_ITEM', _("Add Workorder"), true, '', true);
+}
end_form();
end_page();
check_db_has_tax_groups(_("There are no tax groups defined in the system. At least one tax group is required before proceeding."));
+simple_page_mode(true);
//-----------------------------------------------------------------------------------------------
if (isset($_GET['debtor_no']))
{
$_POST['customer_id'] = strtoupper($_GET['debtor_no']);
- $_POST['New'] = "1";
}
+$_POST['branch_code'] = $selected_id;
if (isset($_GET['SelectedBranch']))
{
$_POST['branch_code'] = strtoupper($_GET['SelectedBranch']);
- unset($_POST['New']);
-}
-
-if (!isset($_GET['SelectedBranch']) && !isset($_POST['AddUpdate']))
-{
- $_POST['New'] = "1";
+ $selected_id = $_GET['SelectedBranch'];
}
//-----------------------------------------------------------------------------------------------
-if (isset($_POST['ADD_ITEM']) || isset($_POST['UPDATE_ITEM']))
+if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
{
//initialise no input errors assumed initially before we test
if ($input_error != 1)
{
- //if (!isset($_POST['New']))
- if (isset($_POST['UPDATE_ITEM']))
+ if ($selected_id != -1)
{
/*SelectedBranch could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/
WHERE branch_code =".db_escape($_POST['branch_code']) . "
AND debtor_no=".db_escape($_POST['customer_id']);
+ $note =_('Selected customer branch has been updated');
}
else
{
.db_escape($_POST['br_post_address']) . ","
.db_escape($_POST['disable_trans']) . ", "
.db_escape($_POST['default_ship_via']) . ")";
+
+ $note = _('New customer branch has been added');
}
//run the sql from either of the above possibilites
db_query($sql,"The branch record could not be inserted or updated");
-
- meta_forward($_SERVER['PHP_SELF'], "debtor_no=" . $_POST['customer_id']);
+ display_notification($note);
+ $Mode = 'RESET';
}
}
-elseif (isset($_GET['delete']))
+elseif ($Mode == 'Delete')
{
//the link to delete a selected record was clicked instead of the submit button
{
$sql="DELETE FROM ".TB_PREF."cust_branch WHERE branch_code='" . $_POST['branch_code']. "' AND debtor_no='" . $_POST['customer_id']. "'";
db_query($sql,"could not delete branch");
- meta_forward($_SERVER['PHP_SELF'], "debtor_no=" . $_POST['customer_id']);
+ display_notification(_('Selected customer branch has been deleted'));
+ $Mode = 'RESET';
}
} //end ifs to test if the branch can be deleted
}
+if ($Mode == 'RESET' || get_post('_customer_id_update'))
+{
+ $selected_id = -1;
+ $cust_id = $_POST['customer_id'];
+ unset($_POST);
+ $_POST['customer_id'] = $cust_id;
+ $Ajax->activate('_page_body');
+}
start_form();
echo "<center>" . _("Select a customer: ") . " ";
echo "</center><br><br>";
$num_branches = db_customer_has_branches($_POST['customer_id']);
+
if ($num_branches)
{
$sql = "SELECT ".TB_PREF."debtors_master.name, ".TB_PREF."cust_branch.*, ".TB_PREF."salesman.salesman_name,
label_cell($myrow["fax"]);
label_cell("<a href=mailto:" . $myrow["email"]. ">" . $myrow["email"]. "</a>");
label_cell($myrow["tax_group_name"]);
- edit_link_cell("debtor_no=" . $_POST['customer_id']. "&SelectedBranch=" . $myrow["branch_code"]);
- delete_link_cell("debtor_no=" . $_POST['customer_id']. "&SelectedBranch=" . $myrow["branch_code"]. "&delete=yes");
+ edit_button_cell("Edit".$myrow["branch_code"], _("Edit"));
+ edit_button_cell("Delete".$myrow["branch_code"], _("Delete"));
end_row();
}
end_table();
}
else
display_note(_("The selected customer does not have any branches. Please create at least one branch."));
-//else
-//{
-//}
-
-if (!isset($_POST['New']))
-{
- hyperlink_params($_SERVER['PHP_SELF'], _("New Customer Branch"), "debtor_no=" . $_POST['customer_id']);
-}
echo "<br>";
start_table("$table_style2 width=60%", 5);
echo "<tr valign=top><td>"; // outer table
echo "<table>";
-if (!isset($_POST['New']) && $num_branches)
+if ($selected_id != -1)
{
-
- //editing an existing branch
- $sql = "SELECT * FROM ".TB_PREF."cust_branch
- WHERE branch_code='" . $_POST['branch_code'] . "'
- AND debtor_no='" . $_POST['customer_id'] . "'";
-
- $result = db_query($sql,"check failed");
- $myrow = db_fetch($result);
-
- $_POST['branch_code'] = $myrow["branch_code"];
- $_POST['br_name'] = $myrow["br_name"];
- $_POST['br_address'] = $myrow["br_address"];
- $_POST['br_post_address'] = $myrow["br_post_address"];
- $_POST['contact_name'] = $myrow["contact_name"];
- $_POST['salesman'] =$myrow["salesman"];
- $_POST['area'] =$myrow["area"];
- $_POST['phone'] =$myrow["phone"];
- $_POST['fax'] =$myrow["fax"];
- $_POST['email'] =$myrow["email"];
- $_POST['tax_group_id'] = $myrow["tax_group_id"];
- $_POST['disable_trans'] = $myrow['disable_trans'];
- $_POST['default_location'] = $myrow["default_location"];
- $_POST['default_ship_via'] = $myrow['default_ship_via'];
- $_POST['sales_account'] = $myrow["sales_account"];
- $_POST['sales_discount_account'] = $myrow['sales_discount_account'];
- $_POST['receivables_account'] = $myrow['receivables_account'];
- $_POST['payment_discount_account'] = $myrow['payment_discount_account'];
-
+ if ($Mode == 'Edit') {
+
+ //editing an existing branch
+ $sql = "SELECT * FROM ".TB_PREF."cust_branch
+ WHERE branch_code='" . $_POST['branch_code'] . "'
+ AND debtor_no='" . $_POST['customer_id'] . "'";
+ $result = db_query($sql,"check failed");
+ $myrow = db_fetch($result);
+ set_focus('br_name');
+ $_POST['branch_code'] = $myrow["branch_code"];
+ $_POST['br_name'] = $myrow["br_name"];
+ $_POST['br_address'] = $myrow["br_address"];
+ $_POST['br_post_address'] = $myrow["br_post_address"];
+ $_POST['contact_name'] = $myrow["contact_name"];
+ $_POST['salesman'] =$myrow["salesman"];
+ $_POST['area'] =$myrow["area"];
+ $_POST['phone'] =$myrow["phone"];
+ $_POST['fax'] =$myrow["fax"];
+ $_POST['email'] =$myrow["email"];
+ $_POST['tax_group_id'] = $myrow["tax_group_id"];
+ $_POST['disable_trans'] = $myrow['disable_trans'];
+ $_POST['default_location'] = $myrow["default_location"];
+ $_POST['default_ship_via'] = $myrow['default_ship_via'];
+ $_POST['sales_account'] = $myrow["sales_account"];
+ $_POST['sales_discount_account'] = $myrow['sales_discount_account'];
+ $_POST['receivables_account'] = $myrow['receivables_account'];
+ $_POST['payment_discount_account'] = $myrow['payment_discount_account'];
+ }
}
-else
+elseif ($Mode != 'ADD_ITEM')
{ //end of if $SelectedBranch only do the else when a new record is being entered
-
- $sql = "SELECT name, address, email
- FROM ".TB_PREF."debtors_master WHERE debtor_no = '" . $_POST['customer_id']. "'";
- $result = db_query($sql,"check failed");
- $myrow = db_fetch($result);
- $_POST['br_name'] = $myrow["name"];
- $_POST['contact_name'] = _("Main Branch");
- $_POST['br_address'] = $_POST['br_post_address'] = $myrow["address"];
+ if(!$num_branches) {
+ $sql = "SELECT name, address, email
+ FROM ".TB_PREF."debtors_master WHERE debtor_no = '" . $_POST['customer_id']. "'";
+ $result = db_query($sql,"check failed");
+ $myrow = db_fetch($result);
+ $_POST['br_name'] = $myrow["name"];
+ $_POST['contact_name'] = _('Main Branch');
+ $_POST['br_address'] = $_POST['br_post_address'] = $myrow["address"];
+ $_POST['email'] = $myrow['email'];
+ }
$_POST['branch_code'] = "";
- $_POST['email'] = $myrow['email'];
if (!isset($_POST['sales_account']) || !isset($_POST['sales_discount_account']))
{
$company_record = get_company_prefs();
}
- hidden('New', 'Yes');
}
-hidden('branch_code', $_POST['branch_code']);
+hidden('selected_id', $selected_id);
+hidden('branch_code');
table_section_title(_("Name and Contact"));
-text_row(_("Branch Name:"), 'br_name', $_POST['br_name'], 35, 40);
-text_row(_("Contact Person:"), 'contact_name', $_POST['contact_name'], 35, 40);
+text_row(_("Branch Name:"), 'br_name', null, 35, 40);
+text_row(_("Contact Person:"), 'contact_name', null, 35, 40);
text_row(_("Phone Number:"), 'phone', null, 20, 20);
text_row(_("Fax Number:"), 'fax', null, 20, 20);
-text_row("<a href='Mailto:'>" . _("E-mail:") . "</a>", 'email', $_POST['email'], 35, 55);
+text_row("<a href='Mailto:'>" . _("E-mail:") . "</a>", 'email', null, 35, 55);
table_section_title(_("Sales"));
table_section_title(_("GL Accounts"));
// 2006-06-14. Changed gl_al_accounts_list to have an optional all_option 'Use Item Sales Accounts'
-gl_all_accounts_list_row(_("Sales Account:"), 'sales_account', $_POST['sales_account'], false,
- false, false, true);
+gl_all_accounts_list_row(_("Sales Account:"), 'sales_account', null, false, false, false, true);
-gl_all_accounts_list_row(_("Sales Discount Account:"), 'sales_discount_account', $_POST['sales_discount_account']);
+gl_all_accounts_list_row(_("Sales Discount Account:"), 'sales_discount_account');
-gl_all_accounts_list_row(_("Accounts Receivable Account:"), 'receivables_account', $_POST['receivables_account']);
+gl_all_accounts_list_row(_("Accounts Receivable Account:"), 'receivables_account');
-gl_all_accounts_list_row(_("Prompt Payment Discount Account:"), 'payment_discount_account', $_POST['payment_discount_account']);
+gl_all_accounts_list_row(_("Prompt Payment Discount Account:"), 'payment_discount_account');
table_section_title(_("Addresses"));
-textarea_row(_("Mailing Address:"), 'br_post_address',$_POST['br_post_address'], 35, 5);
+textarea_row(_("Mailing Address:"), 'br_post_address', null, 35, 5);
-textarea_row(_("Billing Address:"), 'br_address', $_POST['br_address'], 35, 5);
+textarea_row(_("Billing Address:"), 'br_address', null, 35, 5);
end_table();
end_table(1); // outer table
-submit_add_or_update_center(isset($_POST['New']));
+submit_add_or_update_center($selected_id == -1, '', true);
end_form();