Fixed Assets: Added sum-of-the-year digits method, fixed declining balance method...
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 7 Dec 2015 10:22:01 +0000 (11:22 +0100)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 7 Dec 2015 10:51:24 +0000 (11:51 +0100)
fixed_assets/fixed_asset_classes.php
fixed_assets/includes/depreciation.inc
fixed_assets/includes/fa_classes_db.inc
fixed_assets/includes/fixed_assets_db.inc
fixed_assets/inquiry/stock_inquiry.php
includes/sysnames.inc
inventory/includes/db/items_db.inc
inventory/manage/items.php
sql/alter2.4rc1.sql
sql/en_US-demo.sql
sql/en_US-new.sql

index 87c3218d0c09395644b04409fb8fa8e9e575cda8..291a0779a40fdd104ac6386c9a238c90a111a262 100644 (file)
@@ -36,16 +36,16 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
        if ($selected_id != -1) 
        {
                update_fixed_asset_class($selected_id, $_POST['parent_id'], $_POST['description'], $_POST['long_description'],
-                       $_POST['depreciation_method'], $_POST['depreciation_rate'], $_POST['depreciation_period']);
+                       $_POST['depreciation_rate']);
                          display_notification(_('Selected fixed asset class has been updated'));
        } 
        else 
        {
                add_fixed_asset_class($_POST['fa_class_id'], $_POST['parent_id'], $_POST['description'], $_POST['long_description'],
-                       $_POST['depreciation_method'], $_POST['depreciation_rate'], $_POST['depreciation_period']);
+                       $_POST['depreciation_rate']);
                          display_notification(_('New fixed asset class has been added'));
        }
-               
+
                $Mode = 'RESET';
        }
 } 
@@ -83,7 +83,7 @@ $result = get_fixed_asset_classes();
 
 start_form();
 start_table(TABLESTYLE);
-$th = array(_("Fixed asset class"), _("Description"), _("Depreciation method"), _("Depreciation rate"), _("Depreciation period"), "", "");
+$th = array(_("Fixed asset class"), _("Description"), _("Basic Depreciation Rate"), "", "");
 inactive_control_column($th);
 table_header($th);
 $k = 0; //row colour counter
@@ -93,9 +93,7 @@ while ($myrow = db_fetch($result))
        
        label_cell($myrow["fa_class_id"]);
        label_cell($myrow["description"]);
-       label_cell($depreciation_methods[$myrow["depreciation_method"]]);
        label_cell($myrow["depreciation_rate"].'%');
-       label_cell($myrow["depreciation_period"].' years');
        inactive_control_cell($myrow["fa_class_id"], $myrow["inactive"], 'stock_fa_classes', 'fa_class_id');
        edit_button_cell("Edit".$myrow["fa_class_id"], _("Edit"));
        delete_button_cell("Delete".$myrow["fa_class_id"], _("Delete"));
@@ -107,7 +105,7 @@ end_table(1);
 echo '<br>';
 
 start_form(true);
-
+div_start('par_tbl');
 start_table(TABLESTYLE2);
 
 if ($selected_id != -1) 
@@ -119,9 +117,7 @@ if ($selected_id != -1)
                $_POST['parent_id'] = $myrow["parent_id"];
                $_POST['description']  = $myrow["description"];
                $_POST['long_description']  = $myrow["long_description"];
-               $_POST['depreciation_method'] = $myrow["depreciation_method"];
                $_POST['depreciation_rate'] = $myrow["depreciation_rate"];
-               $_POST['depreciation_period'] = $myrow["depreciation_period"];
        }
        hidden("selected_id", $selected_id);
        hidden("fa_class_id");
@@ -137,14 +133,11 @@ else
 
 text_row(_("Description:"), 'description', null, 42, 200);
 textarea_row(_('Long description:'), 'long_description', null, 42, 3);
-array_selector_row(_("Depreciation Method").":", "depreciation_method", null, $depreciation_methods, array('select_submit'=> true));
-small_amount_row(_("Depreciation Rate").':', 'depreciation_rate', null, null, '%', user_percent_dec());
-text_row_ex(_("Depreciation Period").':', 'depreciation_period', 3, 3, '', null, null, _("years"));
-
+small_amount_row(_("Basic Depreciation Rate").':', 'depreciation_rate', null, null, '%', user_percent_dec());
 //text_row(_("Parent id:"), 'parent_id', null, 3, 3);
 
 end_table(1);
-
+div_end();
 //if ($selected_id != -1) 
 submit_add_or_update_center($selected_id == -1, '', 'both');
 
index dda99f96639fbb8dffd30dac01377647fe309920..ab36edd3332c319c6357d80344999362a4c0abc1 100644 (file)
@@ -62,20 +62,26 @@ function compute_gl_rows_for_depreciation($item, $no_months, $period) {
   $y = date('Y', strtotime($year['end']));
 
   switch ($item['depreciation_method']) {
-    case 'D':
-      $value = $item['material_cost'] * $item['depreciation_rate'] / 100 / 12;
-      break;
-
-    case 'S':
-      // depreciation_rate is the period here.
-      $done_months = months_between_dates($item['depreciation_start'], $item['depreciation_date']);
-      $remaining_months = $item['depreciation_rate'] * 12 - $done_months;
-      $value = $item['material_cost'] / $remaining_months;
-      break;
+       case 'D':
+               $line_value = $item['actual_cost']*$item['depreciation_rate']/100/12;
+               $value = $item['material_cost'] * $item['depreciation_rate'] * $item['depreciation_factor']/100/12;
+               if ($value < $line_value)
+                       $value = $line_value;
+               break;
+
+    case 'S':  // actual_cost stores start cost of item
+               $value = $item['actual_cost']*$item['depreciation_rate']/100/12;
+               break;
+
+       case 'N':
+               $N = $item['depreciation_rate'];
+               $done_years = months_between_dates($item['depreciation_start'], $item['depreciation_date'])/12;
+               $value = $item['material_cost']* ($N-$done_years)/($N*($N+1)/2)/12;
+               break;
 
     case 'O':
-      $value = $item['material_cost'];
-      break;
+               $value = $item['material_cost'];
+               break;
   }
 
   $next = next_depreciation_date($item['depreciation_date']);
index 3c5b68cf4c749718693d881cf100e5da07b02450..6f76c48bf37ee176d0eae4ccab11665806b553fc 100644 (file)
@@ -19,28 +19,25 @@ function get_fixed_asset_classes()
        return $result;
 }
 
-function update_fixed_asset_class($fa_class_id, $parent_id, $description, $long_description, $depreciation_method, $depreciation_rate, $depreciation_period)
+function update_fixed_asset_class($fa_class_id, $parent_id, $description, $long_description, $depreciation_rate)
 {
        $sql = "UPDATE ".TB_PREF."stock_fa_class SET
                parent_id=".db_escape($parent_id).",
                description=".db_escape($description).",
                long_description=".db_escape($long_description).",
-    depreciation_method=".db_escape($depreciation_method).",
-    depreciation_rate=".db_escape($depreciation_rate).",
-    depreciation_period=".db_escape($depreciation_period)."
+    depreciation_rate=".db_escape($depreciation_rate)."
     WHERE fa_class_id=".db_escape($fa_class_id);
 
        db_query($sql, "The fixed asset class could not be updated");
 }
 
-function add_fixed_asset_class($fa_class_id, $parent_id, $description, $long_description, $depreciation_method, $depreciation_rate, $depreciation_period)
+function add_fixed_asset_class($fa_class_id, $parent_id, $description, $long_description, $depreciation_rate)
 {
   $sql = "INSERT INTO ".TB_PREF."stock_fa_class (fa_class_id, parent_id, description, long_description,
-    depreciation_method, depreciation_rate, depreciation_period) VALUES ("
+     depreciation_rate) VALUES ("
     .db_escape($fa_class_id).", ".db_escape($parent_id).", "
-               .db_escape($description).", ".db_escape($long_description).", "
-    .db_escape($depreciation_method).", ".db_escape($depreciation_rate).", "
-    .db_escape($depreciation_period).")";
+       .db_escape($description).", ".db_escape($long_description).", "
+    .db_escape($depreciation_rate).")";
 
        db_query($sql, "The fixed asset class could not be added");
 }
index 8cb9a05db88162d8304221c94fbc8e9fd56c7cea..7f30d8db95004c27fe5b208dd54820f5be1028c8 100644 (file)
@@ -140,7 +140,7 @@ function get_sql_for_fixed_assets($show_inactive = false)
 {
   $sql = "SELECT s.stock_id, c.description, s.units, s.description as name,
     s.depreciation_rate, s.depreciation_method, s.inactive, rcv.tran_date as purchase_date, rcv.trans_no as purchase_no,
-    adj.tran_date as disposal_date, adj.type as disposal_type, adj.trans_no as disposal_no, s.material_cost, s.last_cost
+    adj.tran_date as disposal_date, adj.type as disposal_type, adj.trans_no as disposal_no, s.material_cost, s.last_cost, s.depreciation_factor
     FROM ".TB_PREF."stock_master s"
        ." LEFT JOIN ".TB_PREF."stock_moves rcv ON rcv.stock_id=s.stock_id AND rcv.type=".ST_SUPPRECEIVE
        ." LEFT JOIN ".TB_PREF."stock_moves adj ON adj.stock_id=s.stock_id AND adj.type IN(".ST_INVADJUST.",".ST_CUSTDELIVERY.")"
index e60d448fb36d21330731fd6480df9d48eb3f1219..93c79446b88b972e7ebe4e18918a7339eb900530 100644 (file)
@@ -73,11 +73,14 @@ function depr_method_title($row) {
   return $depreciation_methods[$row['depreciation_method']];
 }
 
-function depr_rate_title($row) {
-  if ($row['depreciation_method'] == 'S')
-    return $row['depreciation_rate'].' years';
-  else
-    return $row['depreciation_rate'].'%';
+function depr_par($row) {
+       if ($row['depreciation_method'] == 'D')
+               return $row['depreciation_rate']*$row['depreciation_factor'].'%';
+       elseif ($row['depreciation_method'] == 'N')
+               return $row['depreciation_rate'].' '._('years'
+               );
+       else
+               return $row['depreciation_rate'].'%';
 }
 
 function status_title($row) {
@@ -139,7 +142,7 @@ $cols = array(
                        _("Class"), 
                        _("UOM") => array('align' => 'center'), 
                        _("Description"),
-                       _("Rate or Lifecycle") => array('fun' => 'depr_rate_title'), 
+                       _("Rate or Lifecycle") => array('fun' => 'depr_par'), 
                        _("Method") => array('fun' => 'depr_method_title'), 
                        _("Status") => array('fun' => 'status_title'), 
                        _("Purchased") => array('fun' => 'purchase_link'),
index 70c78fefc5ce9604c700f20b628232bf234a2ca5..80fab81177502a30fd189f9ebc78c52d7f736ce3 100644 (file)
@@ -161,6 +161,7 @@ $quick_entry_types = array(
 $depreciation_methods = array(
   'D' => _("Declining balance"),
   'S' => _("Straight line"),
+  'N' => _("Sum of the Year Digits"),
   'O' => _("One-time"),
 );
 
index 3806518ee8a767aab350184435e9edccaab7860f..b9b87b13fa21304d0b5eeda7bf17a57fb601d874 100644 (file)
@@ -13,8 +13,8 @@ function update_item($stock_id, $description, $long_description, $category_id,
        $tax_type_id, $units='', $mb_flag='', $sales_account, $inventory_account, 
        $cogs_account,  $adjustment_account, $assembly_account, $dimension_id, 
        $dimension2_id, $no_sale, $editable, $no_purchase,
-       $depreciation_method = 'D', $depreciation_rate=100, $depreciation_start=null,
-       $fa_class_id=null)
+       $depreciation_method = 'D', $depreciation_rate=100, $depreciation_factor=1,
+       $depreciation_start=null, $fa_class_id=null)
 {
        $sql = "UPDATE ".TB_PREF."stock_master SET long_description=".db_escape($long_description).",
                description=".db_escape($description).",
@@ -32,6 +32,7 @@ function update_item($stock_id, $description, $long_description, $category_id,
                editable=".db_escape($editable).",
                depreciation_method=".db_escape($depreciation_method).",
                depreciation_rate=".db_escape($depreciation_rate).",
+               depreciation_factor=".db_escape($depreciation_factor).",
                fa_class_id=".db_escape($fa_class_id);
 
        if ($units != '')
@@ -56,13 +57,13 @@ function add_item($stock_id, $description, $long_description, $category_id,
        $tax_type_id, $units, $mb_flag, $sales_account, $inventory_account, 
        $cogs_account, $adjustment_account,     $assembly_account, $dimension_id, 
        $dimension2_id, $no_sale, $editable, $no_purchase,
-       $depreciation_method='D', $depreciation_rate=100, $depreciation_start=null,
+       $depreciation_method='D', $depreciation_rate=100,  $depreciation_factor=1, $depreciation_start=null,
        $fa_class_id=null)
 {
        $sql = "INSERT INTO ".TB_PREF."stock_master (stock_id, description, long_description, category_id,
                tax_type_id, units, mb_flag, sales_account, inventory_account, cogs_account,
                adjustment_account, assembly_account, dimension_id, dimension2_id, no_sale, no_purchase, editable,
-               depreciation_method, depreciation_rate, depreciation_start, depreciation_date, fa_class_id)
+               depreciation_method, depreciation_rate, depreciation_factor, depreciation_start, depreciation_date, fa_class_id)
                VALUES (".db_escape($stock_id).", ".db_escape($description).", ".db_escape($long_description).",
                ".db_escape($category_id).", ".db_escape($tax_type_id).", "
                .db_escape($units).", ".db_escape($mb_flag).",
@@ -73,7 +74,7 @@ function add_item($stock_id, $description, $long_description, $category_id,
                .db_escape($no_sale).","
                .db_escape($no_purchase).","
                .db_escape($editable).","
-               .db_escape($depreciation_method).",".db_escape($depreciation_rate).",'"
+               .db_escape($depreciation_method).",".db_escape($depreciation_rate).",".db_escape($depreciation_factor).",'"
                .date2sql($depreciation_start)."','".date2sql($depreciation_start)."',"
                .db_escape($fa_class_id).")";
 
index c4ab903ff147164e75e4d27fe4f4ee2b76302bb2..ad65ee0fbadac2981e6c740121b82c05309fd96c 100644 (file)
@@ -155,6 +155,7 @@ function clear_data()
        unset($_POST['no_purchase']);
        unset($_POST['depreciation_method']);
        unset($_POST['depreciation_rate']);
+       unset($_POST['depreciation_factor']);
        unset($_POST['depreciation_start']);
 }
 
@@ -226,7 +227,7 @@ if (isset($_POST['addupdate']))
                                $_POST['adjustment_account'], $_POST['assembly_account'], 
                                $_POST['dimension_id'], $_POST['dimension2_id'],
                                check_value('no_sale'), check_value('editable'), check_value('no_purchase'),
-                               get_post('depreciation_method'), get_post('depreciation_rate'), get_post('depreciation_start'),
+                               get_post('depreciation_method'), input_num('depreciation_rate'), input_num('depreciation_factor'), get_post('depreciation_start'),
                                get_post('fa_class_id'));
 
                        update_record_status($_POST['NewStockID'], $_POST['inactive'],
@@ -247,7 +248,7 @@ if (isset($_POST['addupdate']))
                                $_POST['adjustment_account'], $_POST['assembly_account'], 
                                $_POST['dimension_id'], $_POST['dimension2_id'],
                                check_value('no_sale'), check_value('editable'), check_value('no_purchase'),
-                               get_post('depreciation_method'), get_post('depreciation_rate'), get_post('depreciation_start'),
+                               get_post('depreciation_method'), input_num('depreciation_rate'), input_num('depreciation_factor'), get_post('depreciation_start'),
                                get_post('fa_class_id'));
 
                        display_notification(_("A new item has been added."));
@@ -335,7 +336,8 @@ function item_settings(&$stock_id, $new_item)
                        $_POST['mb_flag']  = $myrow["mb_flag"];
 
                        $_POST['depreciation_method'] = $myrow['depreciation_method'];
-                       $_POST['depreciation_rate'] = $myrow['depreciation_rate'];
+                       $_POST['depreciation_rate'] = number_format2($myrow['depreciation_rate'], 1);
+                       $_POST['depreciation_factor'] = number_format2($myrow['depreciation_factor'], 1);
                        $_POST['depreciation_start'] = sql2date($myrow['depreciation_start']);
                        $_POST['depreciation_date'] = sql2date($myrow['depreciation_date']);
                        $_POST['fa_class_id'] = $myrow['fa_class_id'];
@@ -415,24 +417,22 @@ function item_settings(&$stock_id, $new_item)
                if (!isset($_POST['depreciation_rate']) || (list_updated('fa_class_id') || list_updated('depreciation_method'))) {
                        $class_row = get_fixed_asset_class($_POST['fa_class_id']);
 
-                       if ($_POST['depreciation_method'] == 'S')
-                               $_POST['depreciation_rate'] = $class_row['depreciation_period'];
-                       else
-                               $_POST['depreciation_rate'] = $class_row['depreciation_rate'];
+                       if ($_POST['depreciation_method'] == 'O')
+                       {
+                               hidden('depreciation_rate', 100);
+                               label_row(_("Depreciation Rate").':', "100 %");
                        }
-
-                       switch ($_POST['depreciation_method']) {
-                               case 'D':
-                                       small_amount_row(_("Depreciation Rate").':', 'depreciation_rate', null, null, '%', user_percent_dec());
-                                       break;
-                               case 'S':
-                                       text_row_ex(_("Depreciation Period").':', 'depreciation_rate', 3, 3, '', null, null, _("years"));
-                                       break;
-                               case 'O':
-                                       hidden('depreciation_rate', 100);
-                                       label_row(_("Depreciation Rate").':', "100 %");
-                                       break;
+                       elseif ($_POST['depreciation_method'] == 'N')
+                       {
+                               small_amount_row(_("Depreciation Years").':', 'depreciation_rate', null, null, _('years'), 0);
                        }
+                       elseif ($_POST['depreciation_method'] == 'D')
+                               small_amount_row(_("Base Rate").':', 'depreciation_rate', null, null, '%', user_percent_dec());
+                       else
+                               small_amount_row(_("Depreciation Rate").':', 'depreciation_rate', null, null, '%', user_percent_dec());
+
+                       if ($_POST['depreciation_method'] == 'D')
+                               small_amount_row(_("Rate multiplier").':', 'depreciation_factor', null, null, '', 2);
 
                        // do not allow to change the depreciation start after this item has been depreciated
                        if ($new_item || $_POST['depreciation_start'] == $_POST['depreciation_date'])
@@ -443,7 +443,7 @@ function item_settings(&$stock_id, $new_item)
                                label_row(_("Last Depreciation").':', $_POST['depreciation_date']);
                        }
                        hidden('depreciation_date');
-
+               }
        }
        table_section(2);
 
index df967f433563bc1378623bf5b07cc9015371dbf4..735c9e3b9c0118411f26f898b463abd4a6886641 100644 (file)
@@ -6,16 +6,15 @@ CREATE TABLE `0_stock_fa_class` (
   `parent_id` varchar(20) NOT NULL DEFAULT '',
   `description` varchar(200) NOT NULL DEFAULT '',
   `long_description` tinytext NOT NULL,
-  `depreciation_method` char(1) NOT NULL DEFAULT 'D',
   `depreciation_rate` double NOT NULL DEFAULT '0',
-  `depreciation_period` tinyint(1) NOT NULL DEFAULT '0',
   `inactive` tinyint(1) NOT NULL DEFAULT '0',
   PRIMARY KEY (`fa_class_id`)
 ) ENGINE=InnoDB;
 
 ALTER TABLE `0_stock_master` ADD COLUMN `depreciation_method` char(1) NOT NULL DEFAULT 'D' AFTER `editable`;
 ALTER TABLE `0_stock_master` ADD COLUMN `depreciation_rate` double NOT NULL DEFAULT '0' AFTER `depreciation_method`;
-ALTER TABLE `0_stock_master` ADD COLUMN `depreciation_start` date NOT NULL DEFAULT '0000-00-00' AFTER `depreciation_rate`;
+ALTER TABLE `0_stock_master` ADD COLUMN `depreciation_factor` double NOT NULL DEFAULT '0' AFTER `depreciation_par`;
+ALTER TABLE `0_stock_master` ADD COLUMN `depreciation_start` date NOT NULL DEFAULT '0000-00-00' AFTER `depreciation_factor`;
 ALTER TABLE `0_stock_master` ADD COLUMN `depreciation_date` date NOT NULL DEFAULT '0000-00-00' AFTER `depreciation_start`;
 ALTER TABLE `0_stock_master` ADD COLUMN `fa_class_id` varchar(20) NOT NULL DEFAULT '' AFTER `depreciation_date`;
 
index 21dbbbcc354ba4e23f8be3b4fe0085864bae4fb7..309a9c4698066f80755ed04808661b8bb79104bd 100644 (file)
@@ -1850,7 +1850,6 @@ CREATE TABLE `0_stock_fa_class` (
   `long_description` tinytext NOT NULL,
   `depreciation_method` char(1) NOT NULL DEFAULT 'D',
   `depreciation_rate` double NOT NULL DEFAULT '0',
-  `depreciation_period` tinyint(1) NOT NULL DEFAULT '0',
   `inactive` tinyint(1) NOT NULL DEFAULT '0',
   PRIMARY KEY (`fa_class_id`)
 ) ENGINE=InnoDB;
@@ -1886,8 +1885,9 @@ CREATE TABLE IF NOT EXISTS `0_stock_master` (
   `no_sale` tinyint(1) NOT NULL DEFAULT '0',
   `no_purchase` tinyint(1) NOT NULL DEFAULT '0',
   `editable` tinyint(1) NOT NULL DEFAULT '0',
-  `depreciation_method` char(1) NOT NULL DEFAULT 'D',
+  `depreciation_method` char(1) NOT NULL DEFAULT 'S',
   `depreciation_rate` double NOT NULL DEFAULT '0',
+  `depreciation_factor` double NOT NULL DEFAULT '1',
   `depreciation_start` date NOT NULL DEFAULT '0000-00-00',
   `depreciation_date` date NOT NULL DEFAULT '0000-00-00',
   `fa_class_id` varchar(20) NOT NULL DEFAULT '',
@@ -1899,12 +1899,12 @@ CREATE TABLE IF NOT EXISTS `0_stock_master` (
 --
 
 INSERT INTO `0_stock_master` VALUES
-('101', '1', '1', 'iPad Air 2 16GB', '', 'each', 'B', '4010', '5010', '1510', '5040', '1530', '0', '0', '0', '0', '200', '0', '0', '0', '0', '0', '0', 'D', '0', '0000-00-00', '0000-00-00', ''),
-('102', '1', '1', 'iPhone 6 64GB', '', 'each', 'B', '4010', '5010', '1510', '5040', '1530', '0', '0', '0', '0', '150', '0', '0', '0', '0', '0', '0', 'D', '0', '0000-00-00', '0000-00-00', ''),
-('103', '1', '1', 'iPhone Cover Case', '', 'each', 'B', '4010', '5010', '1510', '5040', '1530', '0', '0', '0', '0', '10', '0', '0', '0', '0', '0', '0', 'D', '0', '0000-00-00', '0000-00-00', ''),
-('201', '3', '1', 'AP Surf Set', '', 'each', 'M', '4010', '5010', '1510', '5040', '1530', '0', '0', '0', '0', '360', '0', '0', '0', '0', '0', '0', 'D', '0', '0000-00-00', '0000-00-00', ''),
-('202', '4', '1', 'Maintenance', '', 'hr', 'D', '4010', '5010', '1510', '5040', '1530', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', 'D', '0', '0000-00-00', '0000-00-00', ''),
-('301', '4', '1', 'Support', '', 'hr', 'D', '4010', '5010', '1510', '5040', '1530', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'D', '0', '0000-00-00', '0000-00-00', '');
+('101', '1', '1', 'iPad Air 2 16GB', '', 'each', 'B', '4010', '5010', '1510', '5040', '1530', '0', '0', '0', '0', '200', '0', '0', '0', '0', '0', '0', 'S', '0', '1', '0000-00-00', '0000-00-00', ''),
+('102', '1', '1', 'iPhone 6 64GB', '', 'each', 'B', '4010', '5010', '1510', '5040', '1530', '0', '0', '0', '0', '150', '0', '0', '0', '0', '0', '0', 'S', '0', '1', '0000-00-00', '0000-00-00', ''),
+('103', '1', '1', 'iPhone Cover Case', '', 'each', 'B', '4010', '5010', '1510', '5040', '1530', '0', '0', '0', '0', '10', '0', '0', '0', '0', '0', '0', 'S', '0', '1', '0000-00-00', '0000-00-00', ''),
+('201', '3', '1', 'AP Surf Set', '', 'each', 'M', '4010', '5010', '1510', '5040', '1530', '0', '0', '0', '0', '360', '0', '0', '0', '0', '0', '0', 'S', '0', '1', '0000-00-00', '0000-00-00', ''),
+('202', '4', '1', 'Maintenance', '', 'hr', 'D', '4010', '5010', '1510', '5040', '1530', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', 'S', '0', '1', '0000-00-00', '0000-00-00', ''),
+('301', '4', '1', 'Support', '', 'hr', 'D', '4010', '5010', '1510', '5040', '1530', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'S', '0', '1', '0000-00-00', '0000-00-00', '');
 
 -- --------------------------------------------------------
 
index 7356ecd0bf3f94c085ce9488a5e84eb5f439ea93..3794400b6e4711125a8e851485d50c0b709a9fcf 100644 (file)
@@ -1608,7 +1608,6 @@ CREATE TABLE `0_stock_fa_class` (
   `long_description` tinytext NOT NULL,
   `depreciation_method` char(1) NOT NULL DEFAULT 'D',
   `depreciation_rate` double NOT NULL DEFAULT '0',
-  `depreciation_period` tinyint(1) NOT NULL DEFAULT '0',
   `inactive` tinyint(1) NOT NULL DEFAULT '0',
   PRIMARY KEY (`fa_class_id`)
 ) ENGINE=InnoDB;
@@ -1644,8 +1643,9 @@ CREATE TABLE IF NOT EXISTS `0_stock_master` (
   `no_sale` tinyint(1) NOT NULL default '0',
   `no_purchase` tinyint(1) NOT NULL default '0',
   `editable` tinyint(1) NOT NULL default '0',
-  `depreciation_method` char(1) NOT NULL DEFAULT 'D',
+  `depreciation_method` char(1) NOT NULL DEFAULT 'S',
   `depreciation_rate` double NOT NULL DEFAULT '0',
+  `depreciation_factor` double NOT NULL DEFAULT '1',
   `depreciation_start` date NOT NULL DEFAULT '0000-00-00',
   `depreciation_date` date NOT NULL DEFAULT '0000-00-00',
   `fa_class_id` varchar(20) NOT NULL DEFAULT '',