Example #1
0
function on_submit($selected_parent, $selected_id = -1)
{
    if (!check_num('quantity', 0)) {
        display_error(_("The quantity entered must be numeric and greater than zero."));
        set_focus('quantity');
        return;
    }
    if ($selected_id != -1) {
        update_bom($selected_parent, $selected_id, $_POST['workcentre_added'], $_POST['loc_code'], input_num('quantity'));
        display_notification(_('Selected component has been updated'));
        $Mode = 'RESET';
    } else {
        /*Selected component is null cos no item selected on first time round
        		so must be adding a record must be Submitting new entries in the new
        		component form */
        //need to check not recursive bom component of itself!
        if (!check_for_recursive_bom($selected_parent, $_POST['component'])) {
            /*Now check to see that the component is not already on the bom */
            if (!is_component_already_on_bom($_POST['component'], $_POST['workcentre_added'], $_POST['loc_code'], $selected_parent)) {
                add_bom($selected_parent, $_POST['component'], $_POST['workcentre_added'], $_POST['loc_code'], input_num('quantity'));
                display_notification(_("A new component part has been added to the bill of material for this item."));
                $Mode = 'RESET';
            } else {
                /*The component must already be on the bom */
                display_error(_("The selected component is already on this bom. You can modify it's quantity but it cannot appear more than once on the same bom."));
            }
        } else {
            display_error(_("The selected component is a parent of the current item. Recursive BOMs are not allowed."));
        }
    }
}
Example #2
0
function handle_submit(&$selected_id)
{
    global $path_to_root, $Ajax, $auto_create_branch;
    if (!can_process()) {
        return;
    }
    if ($selected_id) {
        update_customer($_POST['customer_id'], $_POST['CustName'], $_POST['cust_ref'], $_POST['address'], $_POST['tax_id'], $_POST['curr_code'], $_POST['dimension_id'], $_POST['dimension2_id'], $_POST['credit_status'], $_POST['payment_terms'], input_num('discount') / 100, input_num('pymt_discount') / 100, input_num('credit_limit'), $_POST['sales_type'], $_POST['notes']);
        update_record_status($_POST['customer_id'], $_POST['inactive'], 'debtors_master', 'debtor_no');
        $Ajax->activate('customer_id');
        // in case of status change
        display_notification(_("Customer has been updated."));
    } else {
        //it is a new customer
        begin_transaction();
        add_customer($_POST['CustName'], $_POST['cust_ref'], $_POST['address'], $_POST['tax_id'], $_POST['curr_code'], $_POST['dimension_id'], $_POST['dimension2_id'], $_POST['credit_status'], $_POST['payment_terms'], input_num('discount') / 100, input_num('pymt_discount') / 100, input_num('credit_limit'), $_POST['sales_type'], $_POST['notes']);
        $selected_id = $_POST['customer_id'] = db_insert_id();
        if (isset($auto_create_branch) && $auto_create_branch == 1) {
            add_branch($selected_id, $_POST['CustName'], $_POST['cust_ref'], $_POST['address'], $_POST['salesman'], $_POST['area'], $_POST['tax_group_id'], get_company_pref('default_sales_act'), get_company_pref('default_sales_discount_act'), get_company_pref('debtors_act'), get_company_pref('default_prompt_payment_act'), $_POST['location'], $_POST['address'], 0, 0, $_POST['ship_via'], $_POST['notes']);
            $selected_branch = db_insert_id();
            add_crm_person($_POST['CustName'], $_POST['cust_ref'], '', $_POST['address'], $_POST['phone'], $_POST['phone2'], $_POST['fax'], $_POST['email'], '', '');
            $pers_id = db_insert_id();
            add_crm_contact('cust_branch', 'general', $selected_branch, $pers_id);
            add_crm_contact('customer', 'general', $selected_id, $pers_id);
        }
        commit_transaction();
        display_notification(_("A new customer has been added."));
        if (isset($auto_create_branch) && $auto_create_branch == 1) {
            display_notification(_("A default Branch has been automatically created, please check default Branch values by using link below."));
        }
        $Ajax->activate('_page_body');
    }
}
Example #3
0
function generate_backup($conn, $ext = 'no', $comm = '')
{
    $filename = db_backup($conn, $ext, $comm);
    if ($filename) {
        display_notification(_("Backup successfully generated.") . ' ' . _("Filename") . ": " . $filename);
    } else {
        display_error(_("Database backup failed."));
    }
    return $filename;
}
Example #4
0
function handle_delete()
{
    global $selected_id, $Mode;
    if (check_can_delete($selected_id)) {
        //only delete if used in neither customer or supplier, comp prefs, bank trans accounts
        delete_currency($selected_id);
        display_notification(_('Selected currency has been deleted'));
    }
    $Mode = 'RESET';
}
Example #5
0
function get_add_workcenter($name)
{
    $name = db_escape($name);
    $sql = "SELECT id FROM " . TB_PREF . "workcentres WHERE UPPER( name ) = UPPER( {$name} )";
    $result = db_query($sql, "Can not search workcentres table");
    $row = db_fetch_row($result);
    if (!$row[0]) {
        $sql = "INSERT INTO " . TB_PREF . "workcentres (name, description) VALUES ( {$name}, {$name})";
        $result = db_query($sql, "Could not add workcenter");
        $id = db_insert_id();
        display_notification("Added {$name} as id {$id}");
    } else {
        $id = $row[0];
    }
    return $id;
}
function handle_report()
{
    global $Ajax;
    if (can_process()) {
        $from = $_POST['TransFromDate'];
        $to = $_POST['TransToDate'];
        $typeId = $_POST['typeId'];
        $accountId = $_POST['accountId'];
        display_notification(_('Report successfully generated.'));
        $arr = array($from, $to, $typeId, $accountId);
        $trans_type = ST_SUBSIDIARY;
        display_note(print_document_link($arr, _("&Print Report"), true, $trans_type));
    } else {
        display_notification(_('Report not generated, please contact the administrator.'));
    }
    $Ajax->activate('_page_body');
    return;
}
Example #7
0
function handle_submit()
{
    global $path_to_root;
    if (!can_process()) {
        return;
    }
    if (!isset($_POST['New'])) {
        $sql = "UPDATE debtors_master SET name=" . db_escape($_POST['CustName']) . ", \n\t\t\taddress=" . db_escape($_POST['address']) . ", \n\t\t\ttax_id=" . db_escape($_POST['tax_id']) . ", \n\t\t\tcurr_code=" . db_escape($_POST['curr_code']) . ", \n\t\t\temail=" . db_escape($_POST['email']) . ", \n\t\t\tdimension_id=" . db_escape($_POST['dimension_id']) . ", \n\t\t\tdimension2_id=" . db_escape($_POST['dimension2_id']) . ", \n            credit_status=" . db_escape($_POST['credit_status']) . ", \n            payment_terms=" . db_escape($_POST['payment_terms']) . ", \n            discount=" . input_num('discount') / 100 . ", \n            pymt_discount=" . input_num('pymt_discount') / 100 . ", \n            credit_limit=" . input_num('credit_limit') . ", \n            sales_type = " . db_escape($_POST['sales_type']) . " \n            WHERE debtor_no = '" . $_POST['customer_id'] . "'";
        db_query($sql, "The customer could not be updated");
        display_notification(tr("Customer has been updated."));
        clear_fields();
    } else {
        //it is a new customer
        begin_transaction();
        $sql = "INSERT INTO debtors_master (name, address, tax_id, email, dimension_id, dimension2_id,  \n\t\t\tcurr_code, credit_status, payment_terms, discount, pymt_discount,credit_limit, \n\t\t\tsales_type) VALUES (" . db_escape($_POST['CustName']) . ", " . db_escape($_POST['address']) . ", " . db_escape($_POST['tax_id']) . "," . db_escape($_POST['email']) . ", " . db_escape($_POST['dimension_id']) . ", " . db_escape($_POST['dimension2_id']) . ", " . db_escape($_POST['curr_code']) . ", \n\t\t\t" . db_escape($_POST['credit_status']) . ", " . db_escape($_POST['payment_terms']) . ", " . input_num('discount') / 100 . ", \n\t\t\t" . input_num('pymt_discount') / 100 . ", " . input_num('credit_limit') . ", " . db_escape($_POST['sales_type']) . ")";
        db_query($sql, "The customer could not be added");
        $new_customer_id = db_insert_id();
        commit_transaction();
        display_notification(tr("A new customer has been added."));
        hyperlink_params($path_to_root . "/sales/manage/customer_branches.php", tr("Add branches for this customer"), "debtor_no={$new_customer_id}");
        clear_fields();
    }
}
Example #8
0
function handle_delete($id)
{
    global $path_to_root;
    $extensions = get_company_extensions();
    $ext = $extensions[$id];
    if ($ext['version'] != '-') {
        if (!uninstall_package($ext['package'])) {
            return false;
        }
    } else {
        @(include_once $path_to_root . '/' . $ext['path'] . '/hooks.php');
        $hooks_class = 'hooks_' . $ext['package'];
        if (class_exists($hooks_class)) {
            $hooks = new $hooks_class();
            $hooks->uninstall_extension(false);
        }
    }
    unset($extensions[$id]);
    if (update_extensions($extensions)) {
        display_notification(_("Selected extension has been successfully deleted"));
    }
    return true;
}
        $to = add_days($to, $myrow['days']);
        if ($myrow['debtor_no'] == 0) {
            $cust = get_cust_branches_from_group($myrow['group_no']);
            while ($row = db_fetch($cust)) {
                $invs[] = create_recurrent_invoices($row['debtor_no'], $row['branch_code'], $myrow['order_no'], $myrow['id'], $date, $from, $to);
            }
        } else {
            $invs[] = create_recurrent_invoices($myrow['debtor_no'], $myrow['group_no'], $myrow['order_no'], $myrow['id'], $date, $from, $to);
        }
        if (count($invs) > 0) {
            $min = min($invs);
            $max = max($invs);
        } else {
            $min = $max = 0;
        }
        display_notification(sprintf(_("%s recurrent invoice(s) created, # %s - # %s."), count($invs), $min, $max));
        if (count($invs) > 0) {
            $ar = array('PARAM_0' => $min . "-" . ST_SALESINVOICE, 'PARAM_1' => $max . "-" . ST_SALESINVOICE, 'PARAM_2' => "", 'PARAM_3' => 0, 'PARAM_4' => 0, 'PARAM_5' => "", 'PARAM_6' => $def_print_orientation);
            display_note(print_link(sprintf(_("&Print Recurrent Invoices # %s - # %s"), $min, $max), 107, $ar), 0, 1);
            $ar['PARAM_3'] = 1;
            // email
            display_note(print_link(sprintf(_("&Email Recurrent Invoices # %s - # %s"), $min, $max), 107, $ar), 0, 1);
        }
    } else {
        display_error(_("The entered date is not in fiscal year."));
    }
}
$result = get_recurrent_invoices();
start_form();
start_table(TABLESTYLE_NOBORDER);
start_row();
{
    $row = get_crm_category($id);
    $sql = "SELECT COUNT(*) FROM " . TB_PREF . "crm_contacts WHERE type='" . $row['type'] . "' AND action='" . $row['action'] . "'";
    $result = db_query($sql, "check relations for crm_contacts failed");
    $contacts = db_fetch($result);
    return $contacts[0];
}
if ($Mode == 'Delete') {
    $cancel_delete = 0;
    if (key_in_crm_contacts($selected_id)) {
        $cancel_delete = 1;
        display_error(_("Cannot delete this category because there are contacts related to it."));
    }
    if ($cancel_delete == 0) {
        delete_crm_category($selected_id);
        display_notification(_('Category has been deleted'));
    }
    $Mode = 'RESET';
}
if ($Mode == 'RESET') {
    $selected_id = -1;
    $sav = get_post('show_inactive');
    unset($_POST);
    $_POST['show_inactive'] = $sav;
}
//-------------------------------------------------------------------------------------------------
$result = get_crm_categories(check_value('show_inactive'));
start_form();
start_table(TABLESTYLE, "width=70%");
$th = array(_("Category Type"), _("Category Subtype"), _("Short Name"), _("Description"), "", " ");
inactive_control_column($th);
    }
    if (key_in_foreign_table($type, 'chart_master', 'account_type')) {
        display_error(_("Cannot delete this account group because GL accounts have been created referring to it."));
        return false;
    }
    if (key_in_foreign_table($type, 'chart_types', 'parent')) {
        display_error(_("Cannot delete this account group because GL account groups have been created referring to it."));
        return false;
    }
    return true;
}
//-----------------------------------------------------------------------------------
if ($Mode == 'Delete') {
    if (can_delete($selected_id)) {
        delete_account_type($selected_id);
        display_notification(_('Selected account group has been deleted'));
    }
    $Mode = 'RESET';
}
if ($Mode == 'RESET') {
    $selected_id = "";
    $_POST['id'] = $_POST['name'] = '';
    unset($_POST['parent']);
    unset($_POST['class_id']);
}
//-----------------------------------------------------------------------------------
$result = get_account_types(check_value('show_inactive'));
start_form();
start_table(TABLESTYLE);
$th = array(_("Group ID"), _("Group Name"), _("Subgroup Of"), _("Class"), "", "");
inactive_control_column($th);
    }
    if ($input_error != 1) {
        if ($selected_id != -1) {
            update_requisition_detail($selected_id, $_POST['item_code'], $_POST['purpose'], $_POST['order_quantity'], input_num('estimate_price'));
            display_notification(_('Selected requisition details has been updated.'));
        } else {
            add_requisition_detail($_POST['requisitionid'], $_POST['item_code'], $_POST['purpose'], $_POST['order_quantity'], input_num('estimate_price'));
            display_notification(_('New requisition details has been added'));
        }
        $Mode = 'RESET';
    }
}
//-----------------------------------------------------------------------------------
if ($Mode == 'Delete') {
    delete_requisition_detail($selected_id);
    display_notification(_('Selected requisition detail has been deleted'));
    $Mode = 'RESET';
}
if ($Mode == 'RESET') {
    $selected_id = -1;
    $sav = get_post('show_inactive');
    $requisitionid = $_POST['requisitionid'];
    unset($_POST);
    $_POST['requisitionid'] = $requisitionid;
}
//-----------------------------------------------------------------------------------
$result = get_one_requisition(get_post('requisitionid'));
start_table(TABLESTYLE, "width=50%");
$th = array(_("Point of use"), _("Narrative"), _("Application Date"), _("Completation"));
inactive_control_column($th);
table_header($th);
    }
    if ($input_error == 0) {
        if ($Mode == 'ADD_ITEM') {
            add_item_purchasing_data($_POST['supplier_id'], $_POST['stock_id'], input_num('price', 0), $_POST['suppliers_uom'], input_num('conversion_factor'), $_POST['supplier_description']);
            display_notification(_("This supplier purchasing data has been added."));
        } else {
            update_item_purchasing_data($selected_id, $_POST['stock_id'], input_num('price', 0), $_POST['suppliers_uom'], input_num('conversion_factor'), $_POST['supplier_description']);
            display_notification(_("Supplier purchasing data has been updated."));
        }
        $Mode = 'RESET';
    }
}
//--------------------------------------------------------------------------------------------------
if ($Mode == 'Delete') {
    delete_item_purchasing_data($selected_id, $_POST['stock_id']);
    display_notification(_("The purchasing data item has been sucessfully deleted."));
    $Mode = 'RESET';
}
if ($Mode == 'RESET') {
    $selected_id = -1;
}
if (isset($_POST['_selected_id_update'])) {
    $selected_id = $_POST['selected_id'];
    $Ajax->activate('_page_body');
}
if (list_updated('stock_id')) {
    $Ajax->activate('price_table');
}
//--------------------------------------------------------------------------------------------------
if (!@$_GET['popup']) {
    start_form();
Example #14
0
        }
        display_notification($note);
        $Mode = 'RESET';
    }
}
if ($Mode == 'Delete') {
    $cancel_delete = 0;
    // PREVENT DELETES IF DEPENDENT RECORDS IN ''
    /*if (key_in_foreign_table($selected_id, 'cust_branch', 'group_no'))
    	{
    		$cancel_delete = 1;
    		display_error(_("Cannot delete this group because customers have been created using this group."));
    	} */
    if ($cancel_delete == 0) {
        delete_item_level($selected_id);
        display_notification(_('Selected book level has been deleted'));
    }
    //end if Delete group
    $Mode = 'RESET';
}
if ($Mode == 'RESET') {
    $selected_id = -1;
    $sav = get_post('show_inactive');
    unset($_POST);
    if ($sav) {
        $_POST['show_inactive'] = 1;
    }
}
$result = get_item_level(check_value('show_inactive'));
start_form();
start_table(TABLESTYLE, "width=30%");
function handle_cancel_order()
{
    global $path_to_root, $Ajax;
    if ($_SESSION['Items']->trans_type == ST_CUSTDELIVERY) {
        display_notification(_("Direct delivery entry has been cancelled as requested."), 1);
        submenu_option(_("Enter a New Sales Delivery"), "/sales/sales_order_entry.php?NewDelivery=1");
    } elseif ($_SESSION['Items']->trans_type == ST_SALESINVOICE) {
        display_notification(_("Direct invoice entry has been cancelled as requested."), 1);
        submenu_option(_("Enter a New Sales Invoice"), "/sales/sales_order_entry.php?NewInvoice=1");
    } elseif ($_SESSION['Items']->trans_type == ST_SALESQUOTE) {
        if ($_SESSION['Items']->trans_no != 0) {
            delete_sales_order(key($_SESSION['Items']->trans_no), $_SESSION['Items']->trans_type);
        }
        display_notification(_("This sales quotation has been cancelled as requested."), 1);
        submenu_option(_("Enter a New Sales Quotation"), "/sales/sales_order_entry.php?NewQuotation=Yes");
    } else {
        // sales order
        if ($_SESSION['Items']->trans_no != 0) {
            $order_no = key($_SESSION['Items']->trans_no);
            if (sales_order_has_deliveries($order_no)) {
                close_sales_order($order_no);
                display_notification(_("Undelivered part of order has been cancelled as requested."), 1);
                submenu_option(_("Select Another Sales Order for Edition"), "/sales/inquiry/sales_orders_view.php?type=" . ST_SALESORDER);
            } else {
                delete_sales_order(key($_SESSION['Items']->trans_no), $_SESSION['Items']->trans_type);
                display_notification(_("This sales order has been cancelled as requested."), 1);
                submenu_option(_("Enter a New Sales Order"), "/sales/sales_order_entry.php?NewOrder=Yes");
            }
        } else {
            processing_end();
            meta_forward($path_to_root . '/index.php', 'application=orders');
        }
    }
    processing_end();
    display_footer_exit();
}
Example #16
0
	<head>
        <?php 
include "includes/assets/head.php";
?>

        <link rel="stylesheet" type="text/css" href="../css/pages/login.min.css"/>
		<title>Mailinglist</title>
	</head>
	<body>

    <?php 
include "includes/views/header.php";
?>
        <main>
            <?php 
display_notification($notification);
?>
            <div class="container-form">
                <form action="includes/assets/inscription.php" method="POST" class="pure-form pure-form-stacked">
                    <div class="wrapper">
                        <h1>Subscribe</h1>
                            <form method="post" action="index.php">
                                <input type="email" name="email" placeholder="Your email"/>
                                <input type="hidden" name="check"/>
                                <input class="pure-button pure-button-primary" type="submit" value="Subscribe"/>
                            </form>
                            <div class="error">
                              <?php 
display_errors($error);
?>
                            </div>
function handle_delete()
{
    global $def_coy, $db_connections, $comp_subdirs, $path_to_root;
    $id = (int) $_GET['id'];
    // First make sure all company directories from the one under removal are writable.
    // Without this after operation we end up with changed per-company owners!
    for ($i = $id; $i < count($db_connections); $i++) {
        $comp_path = company_path($i);
        if (!is_dir($comp_path) || !is_writable($comp_path)) {
            display_error(_('Broken company subdirectories system. You have to remove this company manually.'));
            return;
        }
    }
    // make sure config file is writable
    if (!is_writeable($path_to_root . "/config_db.php")) {
        display_error(_("The configuration file ") . $path_to_root . "/config_db.php" . _(" is not writable. Change its permissions so it is, then re-run the operation."));
        return;
    }
    // rename directory to temporary name to ensure all
    // other subdirectories will have right owners even after
    // unsuccessfull removal.
    $cdir = company_path($id);
    $tmpname = company_path('/old_' . $id);
    if (!@rename($cdir, $tmpname)) {
        display_error(_('Cannot rename subdirectory to temporary name.'));
        return;
    }
    // 'shift' company directories names
    for ($i = $id + 1; $i < count($db_connections); $i++) {
        if (!rename(company_path($i), company_path($i - 1))) {
            display_error(_("Cannot rename company subdirectory"));
            return;
        }
    }
    $err = remove_connection($id);
    if ($err == 0) {
        display_error(_("Error removing Database: ") . $dbase . _(", please remove it manually"));
    }
    if ($def_coy == $id) {
        $def_coy = 0;
    }
    $error = write_config_db();
    if ($error == -1) {
        display_error(_("Cannot open the configuration file - ") . $path_to_root . "/config_db.php");
    } else {
        if ($error == -2) {
            display_error(_("Cannot write to the configuration file - ") . $path_to_root . "/config_db.php");
        } else {
            if ($error == -3) {
                display_error(_("The configuration file ") . $path_to_root . "/config_db.php" . _(" is not writable. Change its permissions so it is, then re-run the operation."));
            }
        }
    }
    if ($error != 0) {
        @rename($tmpname, $cdir);
        return;
    }
    // finally remove renamed company directory
    @flush_dir($tmpname, true);
    if (!@rmdir($tmpname)) {
        display_error(_("Cannot remove temporary renamed company data directory ") . $tmpname);
        return;
    }
    display_notification(_("Selected company has been deleted"));
}
Example #18
0
        display_error("You must select an SQL script for update");
    } else {
        include_once $path_to_root . "/config_db.php";
        if (!isset($_POST['user']) || !isset($_POST['passwd']) || $_POST['user'] == "") {
            display_error("You must select a user name and an optional password");
        } else {
            foreach ($db_connections as $id => $conn) {
                $conn['dbuser'] = $_POST['user'];
                $conn['dbpassword'] = $_POST['passwd'];
                if (!($db = db_open($conn))) {
                    display_error("Wrong user name or password - " . mysql_error());
                } else {
                    if (!db_import($_FILES['uploadfile']['tmp_name'], $conn)) {
                        display_error("Bad SQL file or you have already updated the company: " . $id . " " . $conn['name'] . " - " . mysql_error());
                    } else {
                        display_notification("Database has been updated for company: " . $id . " " . $conn['name']);
                    }
                }
            }
        }
    }
}
if (!isset($_POST['passwd'])) {
    $_POST['passwd'] = "";
}
echo "<form enctype='multipart/form-data' method='post' action='" . $_SERVER['PHP_SELF'] . "'>\n";
echo "<table align='center' width='50%' cellpadding=3 border=1 bordercolor='#cccccc' style='border-collapse: collapse'>\n";
text_row_ex("Database User", "user", 20);
label_row("Password", "<input name='passwd' type='password' value='" . $_POST['passwd'] . "' />");
label_row("Upload Script", "<input name='uploadfile' type='file'>");
submit_row("submit", "Update");
        } else {
            display_warning(" Your Current Account Balance is lower than the payout!.");
        }
        echo '</tr>';
        end_table();
    } else {
        display_warning(" Paid Already!.");
    }
    div_end();
}
end_form();
if (get_post('RefreshInquiry')) {
    $Ajax->activate('gross_salary');
    $Ajax->activate('leave_days');
    $Ajax->activate('monthly_loan');
    $Ajax->activate('totals_tbl');
}
if (get_post('pay_salary')) {
    global $Refs;
    $pay_slip_id = add_payslip($_POST['year'], $_POST['month'], $_POST['empl_id'], $_POST['basic'], $_POST['da'], $_POST['hra'], $_POST['convey_allow'], $_POST['edu_other_allow'], $_POST['pf'], $_POST['lop_amount'], $_POST['tds'], $_POST['total_ded'], $_POST['total_net'], $_POST['date_of_pay']);
    add_gl_trans(99, $pay_slip_id, $_POST['date_of_pay'], 5410, 0, 0, 'employee Salary #' . $_POST['empl_id'], $_POST['total_net']);
    add_gl_trans(99, $pay_slip_id, $_POST['date_of_pay'], 1060, 0, 0, 'employee Salary #' . $_POST['empl_id'], -$_POST['total_net']);
    $trans_no = kv_get_next_trans_no(99) + 1;
    $ref = get_next_reference(99);
    $total_net_pay = -$_POST['total_net'];
    add_bank_trans(99, $trans_no, 1, $ref, $_POST['date_of_pay'], $total_net_pay, 99, $_POST['empl_id']);
    $Refs->save(99, $trans_no, $ref);
    kv_save_next_trans_no($trans_no);
    display_notification(' The Employee Payslip is added #' . $pay_slip_id);
}
end_page();
Example #20
0
            display_notification(_('Selected item category has been updated'));
        } else {
            add_item_category($_POST['description'], $_POST['tax_type_id'], $_POST['sales_account'], $_POST['cogs_account'], $_POST['inventory_account'], $_POST['adjustment_account'], $_POST['assembly_account'], $_POST['units'], $_POST['mb_flag'], $_POST['dim1'], $_POST['dim2'], check_value('no_sale'));
            display_notification(_('New item category has been added'));
        }
        $Mode = 'RESET';
    }
}
//----------------------------------------------------------------------------------
if ($Mode == 'Delete') {
    // PREVENT DELETES IF DEPENDENT RECORDS IN 'stock_master'
    if (key_in_foreign_table($selected_id, 'stock_master', 'category_id')) {
        display_error(_("Cannot delete this item category because items have been created using this item category."));
    } else {
        delete_item_category($selected_id);
        display_notification(_('Selected item category has been deleted'));
    }
    $Mode = 'RESET';
}
if ($Mode == 'RESET') {
    $selected_id = -1;
    $sav = get_post('show_inactive');
    unset($_POST);
    $_POST['show_inactive'] = $sav;
}
if (list_updated('mb_flag')) {
    $Ajax->activate('details');
}
//----------------------------------------------------------------------------------
$result = get_item_categories(check_value('show_inactive'));
start_form();
if ($use_popup_windows) {
    $js .= get_js_open_window(900, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(_($help_context = "Produce or Unassemble Finished Items From Work Order"), false, false, "", $js);
if (isset($_GET['trans_no']) && $_GET['trans_no'] != "") {
    $_POST['selected_id'] = $_GET['trans_no'];
}
//--------------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    include_once $path_to_root . "/reporting/includes/reporting.inc";
    $id = $_GET['AddedID'];
    $stype = ST_WORKORDER;
    display_notification(_("The manufacturing process has been entered."));
    display_note(get_trans_view_str($stype, $id, _("View this Work Order")));
    display_note(get_gl_view_str($stype, $id, _("View the GL Journal Entries for this Work Order")), 1);
    $ar = array('PARAM_0' => $_GET['date'], 'PARAM_1' => $_GET['date'], 'PARAM_2' => $stype);
    display_note(print_link(_("Print the GL Journal Entries for this Work Order"), 702, $ar), 1);
    hyperlink_no_params("search_work_orders.php", _("Select another &Work Order to Process"));
    br();
    end_page();
    exit;
}
//--------------------------------------------------------------------------------------------------
$wo_details = get_work_order($_POST['selected_id']);
if (strlen($wo_details[0]) == 0) {
    display_error(_("The order number sent is not valid."));
    exit;
}
Example #22
0
function handle_cancel_po()
{
    global $path_to_root;
    //need to check that not already dispatched or invoiced by the supplier
    if ($_SESSION['PO']->order_no != 0 && $_SESSION['PO']->any_already_received() == 1) {
        display_error(_("This order cannot be cancelled because some of it has already been received.") . "<br>" . _("The line item quantities may be modified to quantities more than already received. prices cannot be altered for lines that have already been received and quantities cannot be reduced below the quantity already received."));
        return;
    }
    if ($_SESSION['PO']->order_no != 0) {
        delete_po($_SESSION['PO']->order_no);
    } else {
        unset($_SESSION['PO']);
        meta_forward($path_to_root . '/index.php', 'application=AP');
    }
    $_SESSION['PO']->clear_items();
    $_SESSION['PO'] = new purch_order();
    display_notification(_("This purchase order has been cancelled."));
    hyperlink_params($path_to_root . "/purchasing/po_entry_items.php", _("Enter a new purchase order"), "NewOrder=Yes");
    echo "<br>";
    end_page();
    exit;
}
Example #23
0
    if (get_post('grn_clearing_act') != $grn_act && db_num_rows(get_grn_items(0, '', true))) {
        display_error(_("Before GRN Clearing Account can be changed all GRNs have to be invoiced"));
        $_POST['grn_clearing_act'] = $grn_act;
        set_focus('grn_clearing_account');
        return false;
    }
    if (!is_account_balancesheet(get_post('retained_earnings_act')) || is_account_balancesheet(get_post('profit_loss_year_act'))) {
        display_error(_("The Retained Earnings Account should be a Balance Account or the Profit and Loss Year Account should be an Expense Account (preferred the last one in the Expense Class)"));
        return false;
    }
    return true;
}
//-------------------------------------------------------------------------------------------------
if (isset($_POST['submit']) && can_process()) {
    update_company_prefs(get_post(array('retained_earnings_act', 'profit_loss_year_act', 'debtors_act', 'pyt_discount_act', 'creditors_act', 'freight_act', 'exchange_diff_act', 'bank_charge_act', 'default_sales_act', 'default_sales_discount_act', 'default_prompt_payment_act', 'default_inventory_act', 'default_cogs_act', 'default_adj_act', 'default_inv_sales_act', 'default_assembly_act', 'legal_text', 'past_due_days', 'default_workorder_required', 'default_dim_required', 'default_delivery_required', 'grn_clearing_act', 'allow_negative_stock' => 0, 'accumulate_shipping' => 0, 'po_over_receive' => 0.0, 'po_over_charge' => 0.0, 'default_credit_limit' => 0.0)));
    display_notification(_("The general GL setup has been updated."));
}
/* end of if submit */
//-------------------------------------------------------------------------------------------------
start_form();
start_outer_table(TABLESTYLE2);
table_section(1);
if (get_company_pref('grn_clearing_act') === null) {
    // available from 2.3.1, can be not defined on pre-2.4 installations
    set_company_pref('grn_clearing_act', 'glsetup.purchase', 'varchar', 15, 0);
    refresh_sys_prefs();
}
$myrow = get_company_prefs();
$_POST['retained_earnings_act'] = $myrow["retained_earnings_act"];
$_POST['profit_loss_year_act'] = $myrow["profit_loss_year_act"];
$_POST['debtors_act'] = $myrow["debtors_act"];
$th = array(_("Location"), _("Quantity On Hand"), _("Re-Order Level"));
table_header($th);
$j = 1;
$k = 0;
//row colour counter
$result = get_loc_details($_POST['stock_id']);
if (@$_GET['popup']) {
    hidden('_tabs_sel', get_post('_tabs_sel'));
    hidden('popup', @$_GET['popup']);
}
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    if (isset($_POST['UpdateData']) && check_num($myrow["loc_code"])) {
        $myrow["reorder_level"] = input_num($myrow["loc_code"]);
        set_reorder_level($_POST['stock_id'], $myrow["loc_code"], input_num($myrow["loc_code"]));
        display_notification(_("Reorder levels has been updated."));
    }
    $qoh = get_qoh_on_date($_POST['stock_id'], $myrow["loc_code"]);
    label_cell($myrow["location_name"]);
    $_POST[$myrow["loc_code"]] = qty_format($myrow["reorder_level"], $_POST['stock_id'], $dec);
    qty_cell($qoh, false, $dec);
    qty_cells(null, $myrow["loc_code"], null, null, null, $dec);
    end_row();
    $j++;
    if ($j == 12) {
        $j = 1;
        table_header($th);
    }
}
end_table(1);
div_end();
                update_last_sent_recurrent_invoice($selected_id, $_POST['last_sent']);
            }
            $note = _('Selected recurrent invoice has been updated');
        } else {
            add_recurrent_invoice($_POST['description'], $_POST['order_no'], input_num('debtor_no'), input_num('group_no'), input_num('days', 0), input_num('monthly', 0), $_POST['begin'], $_POST['end']);
            $note = _('New recurrent invoice has been added');
        }
        display_notification($note);
        $Mode = 'RESET';
    }
}
if ($Mode == 'Delete') {
    $cancel_delete = 0;
    if ($cancel_delete == 0) {
        delete_recurrent_invoice($selected_id);
        display_notification(_('Selected recurrent invoice has been deleted'));
    }
    //end if Delete area
    $Mode = 'RESET';
}
if ($Mode == 'RESET') {
    $selected_id = -1;
    unset($_POST);
}
//-------------------------------------------------------------------------------------------------
$result = get_recurrent_invoices();
start_form();
start_table(TABLESTYLE, "width=70%");
$th = array(_("Description"), _("Template No"), _("Customer"), _("Branch") . "/" . _("Group"), _("Days"), _("Monthly"), _("Begin"), _("End"), _("Last Created"), "", "");
table_header($th);
$k = 0;
    $Mode = 'RESET';
}
//----------------------------------------------------------------------------------------------
if ($Mode == 'Delete') {
    // PREVENT DELETES IF DEPENDENT RECORDS IN 'sales_orders'
    if (key_in_foreign_table($selected_id, 'sales_orders', 'ship_via')) {
        $cancel_delete = 1;
        display_error(_("Cannot delete this shipping company because sales orders have been created using this shipper."));
    } else {
        // PREVENT DELETES IF DEPENDENT RECORDS IN 'debtor_trans'
        if (key_in_foreign_table($selected_id, 'debtor_trans', 'ship_via')) {
            $cancel_delete = 1;
            display_error(_("Cannot delete this shipping company because invoices have been created using this shipping company."));
        } else {
            delete_shipper($selected_id);
            display_notification(_('Selected shipping company has been deleted'));
        }
    }
    $Mode = 'RESET';
}
if ($Mode == 'RESET') {
    $selected_id = -1;
    $sav = get_post('show_inactive');
    unset($_POST);
    $_POST['show_inactive'] = $sav;
}
//----------------------------------------------------------------------------------------------
$result = get_shippers(check_value('show_inactive'));
start_form();
start_table(TABLESTYLE);
$th = array(_("Name"), _("Contact Person"), _("Phone Number"), _("Secondary Phone"), _("Address"), "", "");
Example #27
0
include_once $path_to_root . "/includes/packages.inc";
if ($use_popup_windows) {
    $js = get_js_open_window(900, 500);
}
page(_($help_context = "Install Charts of Accounts"), false, false, '', $js);
include_once $path_to_root . "/includes/date_functions.inc";
include_once $path_to_root . "/admin/db/company_db.inc";
include_once $path_to_root . "/admin/db/maintenance_db.inc";
include_once $path_to_root . "/includes/ui.inc";
//---------------------------------------------------------------------------------------------
if ($id = find_submit('Delete', false)) {
    $extensions = get_company_extensions();
    if ($extensions[$id]['type'] == 'chart' && uninstall_package($extensions[$id]['package'])) {
        unset($extensions[$id]);
        if (update_extensions($extensions)) {
            display_notification(_("Selected chart has been successfully deleted"));
            meta_forward($_SERVER['PHP_SELF']);
        }
    }
}
if ($id = find_submit('Update', false)) {
    install_extension($id);
}
//---------------------------------------------------------------------------------------------
start_form(true);
div_start('ext_tbl');
start_table(TABLESTYLE);
$th = array(_("Chart"), _("Installed"), _("Available"), _("Encoding"), "", "");
table_header($th);
$k = 0;
$mods = get_charts_list();
Example #28
0
    $Mode = 'RESET';
}
//-----------------------------------------------------------------------------------
function can_delete($selected_id)
{
    if (key_in_foreign_table($selected_id, 'debtors_master', 'credit_status')) {
        display_error(_("Cannot delete this credit status because customer accounts have been created referring to it."));
        return false;
    }
    return true;
}
//-----------------------------------------------------------------------------------
if ($Mode == 'Delete') {
    if (can_delete($selected_id)) {
        delete_credit_status($selected_id);
        display_notification(_('Selected credit status has been deleted'));
    }
    $Mode = 'RESET';
}
if ($Mode == 'RESET') {
    $selected_id = -1;
    $sav = get_post('show_inactive');
    unset($_POST);
    $_POST['show_inactive'] = $sav;
}
//-----------------------------------------------------------------------------------
$result = get_all_credit_status(check_value('show_inactive'));
start_form();
start_table(TABLESTYLE, "width=40%");
$th = array(_("Description"), _("Dissallow Invoices"), '', '');
inactive_control_column($th);
Example #29
0
            $note = _('New sales group has been added');
        }
        display_notification($note);
        $Mode = 'RESET';
    }
}
if ($Mode == 'Delete') {
    $cancel_delete = 0;
    // PREVENT DELETES IF DEPENDENT RECORDS IN 'debtors_master'
    if (key_in_foreign_table($selected_id, 'cust_branch', 'group_no')) {
        $cancel_delete = 1;
        display_error(_("Cannot delete this group because customers have been created using this group."));
    }
    if ($cancel_delete == 0) {
        delete_sales_group($selected_id);
        display_notification(_('Selected sales group has been deleted'));
    }
    //end if Delete group
    $Mode = 'RESET';
}
if ($Mode == 'RESET') {
    $selected_id = -1;
    $sav = get_post('show_inactive');
    unset($_POST);
    if ($sav) {
        $_POST['show_inactive'] = 1;
    }
}
//-------------------------------------------------------------------------------------------------
$result = get_sales_groups(check_value('show_inactive'));
start_form();
Example #30
0
     //			include ('../install.html');
     //			submit_center('continue', _('Continue >>'));
     //			break;
 //			include ('../install.html');
 //			submit_center('continue', _('Continue >>'));
 //			break;
 case '1':
     div_start('welcome');
     subpage_title(_('System Diagnostics'));
     start_table();
     instlang_list_row(_("Select install wizard language:"), 'inst_lang', $_SESSION['inst_set']['inst_lang']);
     end_table(1);
     $_POST['Tests'] = display_system_tests(true);
     br();
     if (@$_POST['Tests']) {
         display_notification(_('All application preliminary requirements seems to be correct. Please press Continue button below.'));
         submit_center('continue', _('Continue >>'));
     } else {
         display_error(_('Application cannot be installed. Please fix problems listed below in red, and press Refresh button.'));
         submit_center('refresh', _('Refresh'));
     }
     div_end();
     break;
 case '2':
     if (!isset($_POST['host'])) {
         foreach ($_SESSION['inst_set'] as $name => $val) {
             $_POST[$name] = $val;
         }
     }
     subpage_title(_('Database Server Settings'));
     start_table(TABLESTYLE);