Example #1
0
        exit;
    }
    $_POST['ref'] = $myrow["reference"];
    $_POST['closed'] = $myrow["closed"];
    $_POST['name'] = $myrow["name"];
    $_POST['type_'] = $myrow["type_"];
    $_POST['date_'] = sql2date($myrow["date_"]);
    $_POST['due_date'] = sql2date($myrow["due_date"]);
    $_POST['memo_'] = get_comments_string(systypes::dimension(), $selected_id);
    hidden('ref', $_POST['ref']);
    label_row(tr("Dimension Reference:"), $_POST['ref']);
    hidden('selected_id', $selected_id);
} else {
    ref_row(tr("Dimension Reference:"), 'ref', references::get_next(systypes::dimension()));
}
text_row_ex(tr("Name") . ":", 'name', 50, 75);
$dim = get_company_pref('use_dimension');
number_list_row(tr("Type"), 'type_', null, 1, $dim);
date_row(tr("Start Date") . ":", 'date_');
date_row(tr("Date Required By") . ":", 'due_date', null, sys_prefs::default_dimension_required_by());
textarea_row(tr("Memo:"), 'memo_', null, 40, 5);
end_table(1);
submit_add_or_update_center($selected_id == -1);
if ($selected_id != -1) {
    echo "<br>";
    submit_center_first('close', tr("Close This Dimension"));
    submit_center_last('delete', tr("Delete This Dimension"));
}
end_form();
//--------------------------------------------------------------------------------------------
end_page();
Example #2
0
     $result = db_query($sql, "item code could not be retrieved");
     $row = db_fetch_row($result);
     if (!$row) {
         add_item_code($code, $id, $description, $cat, $qty, $foreign);
     } else {
         update_item_code($row[0], $code, $id, $description, $cat, $qty, $foreign);
     }
     $k++;
 }
 if ($type == 'ITEM') {
     $dim = 0;
     if ($qty != '') {
         $dim = get_dimension_by_name($qty);
         if ($dim == -1) {
             $date = Today();
             $due = add_days($date, sys_prefs::default_dimension_required_by());
             $ref = references::get_next(systypes::dimension());
             $dim = add_dimension($ref, $qty, 1, $date, $due, "Added due to Item Import");
             $dim_n++;
         }
     }
     $sql = "SELECT stock_id FROM " . TB_PREF . "stock_master WHERE stock_id='{$id}'";
     $result = db_query($sql, "item could not be retrieved");
     $row = db_fetch_row($result);
     if (!$row) {
         $sql = "INSERT INTO " . TB_PREF . "stock_master (stock_id, description, long_description, category_id,\n\t\t\t\t\t    tax_type_id, units, mb_flag, sales_account, inventory_account, cogs_account,\n\t\t\t\t\t    adjustment_account, assembly_account, dimension_id, dimension2_id)\n\t\t\t\t\t    VALUES ('{$id}', " . db_escape($description) . ", '',\n\t\t\t\t\t    '{$cat}', {$_POST['tax_type_id']}, '{$units}', '{$mb_flag}',\n\t\t\t\t\t    '{$_POST['sales_account']}', '{$_POST['inventory_account']}', '{$_POST['cogs_account']}',\n\t\t\t\t\t    '{$_POST['adjustment_account']}', '{$_POST['assembly_account']}', {$dim}, 0)";
         db_query($sql, "The item could not be added");
         if ($mb_flag == "M" || $mb_flag == "B") {
             $sql = "INSERT INTO " . TB_PREF . "loc_stock (loc_code, stock_id) VALUES ('{$_POST['location']}', '{$id}')";
             db_query($sql, "The item locstock could not be added");
         }