function load_demo() { global $db; $error = false; // Data for table inventory $db->Execute("TRUNCATE TABLE " . TABLE_INVENTORY); $db->Execute("INSERT INTO " . TABLE_INVENTORY . " (sku, inactive, inventory_type, description_short, description_sales, image_with_path, account_sales_income, account_inventory_wage, account_cost_of_sales, item_taxable, cost_method, full_price, full_price_with_tax, item_weight, quantity_on_hand, minimum_stock_level, reorder_quantity, lead_time, creation_date ) VALUES\n('AMD-3600-CPU',\t\t'0', 'si', 'AMD 3600+ Athlon CPU', \t\t\t'AMD 3600+ Athlon CPU',\t\t\t'demo/athlon.jpg', \t\t'4000', '1200', '5000', '1', 'f', 150,\t150, \t\t1.5, \t1, 0, 0, 3, now()),\n('ASSY-BB', \t\t'0', 'lb', 'Labor - BB Computer Assy', \t\t'Labor - BB Computer Assy',\t\t'', \t\t\t\t\t'4000', '6000', '5000', '1', 'f', 0, \t0, \t\t0, 0, 0, 0, 0, now()),\n('BOX-TW-322', \t\t'0', 'ns', 'TW-322 Shipping Box', \t\t\t'TW-322 Shipping Box', \t\t\t'', \t\t\t\t\t'4000', '6800', '5000', '1', 'f', 0, \t0, \t\t0, 0, 15, 25, 0, now()),\n('BOX-TW-553', \t\t'0', 'ns', 'TW-533 Shipping Box', \t\t\t'TW-533 Shipping Box', \t\t\t'', \t\t\t\t\t'4000', '6800', '5000', '1', 'f', 0, \t0, \t\t0, 0, 0, 0, 0, now()),\n('CASE-ALIEN', \t\t'0', 'si', 'Alien Case - Red', \t\t\t'Alien Case - Red', \t\t\t'demo/red_alien.jpg', \t\t'4000', '1200', '5000', '1', 'f', 98.26,\t98.26, \t1.5, 11, 2, 1, 13, now()),\n('DESC-WARR', \t\t'0', 'ds', 'Warranty Template', \t\t\t'Warranty Template', \t\t\t'', \t\t\t\t\t'1000', '1000', '1000', '1', 'f', 0, \t0, \t\t0, \t0, 0, 0, 0, now()),\n('DVD-RW', \t\t\t'0', 'si', 'DVD RW with Lightscribe', \t\t'DVD RW with Lightscribe', \t\t'demo/lightscribe.jpg',\t\t'4000', '1200', '5000', '1', 'f', 45, \t45, \t\t1.5, \t2, 3, 1, 15, now()),\n('HD-150GB', \t\t'0', 'si', '150GB SATA Hard Drive', \t\t'150GB SATA Hard Drive', \t\t'demo/150gb_sata.jpg', \t\t'4000', '1200', '5000', '1', 'f', \t56, \t56, \t\t1.5, \t2, 10, 15, 15, now()),\n('KB-128-ERGO', \t\t'0', 'si', 'KeysRus ergonomic keyboard', \t\t'KeysRus ergonomic keyboard', \t'demo/ergo_key.jpg', \t\t'4000', '1200', '5000', '0', 'f', 56.88, \t56.88, \t1.5, \t0, 5, 10, 11, now()),\n('LCD-21-WS', \t\t'0', 'si', 'LCDisplays 21\" LCD Monitor',\t \t'LCDisplays 21\" LCD Monitor',\t'demo/monitor.jpg', \t\t'4000', '1200', '5000', '1', 'f', 189.99, 189.99, \t1.5, \t0, 2, 1, 5, now()),\n('MB-ATI-K8', \t\t'0', 'si', 'ATI K8 Motherboard', \t\t\t'ATI K8 Motherboard', \t\t\t'demo/mobo.jpg', \t\t\t'4000', '1200', '5000', '1', 'f', 155.25, 155.25, \t1.5, \t1, 5, 10, 3, now()),\n('MB-ATI-K8N', \t\t'0', 'si', 'ATI K8 Motherboard w/network', \t'ATI K8 Motherboard w/network', \t'demo/mobo.jpg', \t\t\t'4000', '1200', '5000', '1', 'f', 176.94, 176.94,\t1.5, 1.2, 3, 10, 3, now()),\n('Mouse-S', \t\t'0', 'si', 'Serial Mouse - 300 DPI', \t\t'Serial Mouse - 300 DPI', \t\t'demo/serial_mouse.jpg',\t'4000', '1200', '5000', '1', 'f', 13.99, \t13.99, \t1.5, 0.6, 15, 25, 11, now()),\n('PC-2GB-120GB-21', \t'0', 'ma', 'Computer 2GB-120GB-21', \t\t'Computer 2GB-120GB-21', \t\t'demo/complete_computer.jpg', '4000', '1200', '5000', '1', 'f', 750, \t750, \t\t1.5, 21.3, 0, 0, 0, now()),\n('PS-450W', \t\t'0', 'si', '450 Watt Silent Power Supply', \t'450 Watt Silent Power Supply', \t'demo/power_supply.jpg', \t'4000', '1200', '5000', '1', 'f', 124.5, \t124.5, \t1.5, 4.7, 10, 6, 14, now()),\n('RAM-2GB-0.2', \t\t'0', 'si', '2GB SDRAM', \t\t\t\t'2GB SDRAM', \t\t\t\t'demo/2gbram.jpg', \t\t'4000', '1200', '5000', '1', 'f', 89.65, \t89.65, \t1.5, \t0, 8, 10, 3, now()),\n('VID-NV-512MB', \t\t'0', 'si', 'nVidia 512 MB Video Card', \t\t'nVidia 512 MB Video Card', \t\t'demo/nvidia_512.jpg', \t\t'4000', '1200', '5000', '1', 'f', 300, \t300, \t\t1.5, 0.7, 4, 5, 1, now()),\n('PC-BB-512', \t\t'0', 'ma', 'Bare Bones Computer 2600+/2GB', \t'Bare Bones Computer 2600+/2GB', \t'demo/barebones.jpg', \t\t'4000', '1200', '5000', '1', 'f', 750, \t750, \t\t1.5, 21.3, 0, 0, 0, now());"); // Data for table inventory_assy_list $db->Execute("TRUNCATE TABLE " . TABLE_INVENTORY_ASSY_LIST); $db->Execute("INSERT INTO " . TABLE_INVENTORY_ASSY_LIST . " (ref_id, sku, description, qty) VALUES\n(14, 'LCD-21-WS', 'LCDisplays 21', 1),\n(14, 'HD-150GB', '150GB SATA Hard Drive', 1),\n(14, 'DVD-RW', 'DVD RW with Lightscribe', 1),\n(14, 'VID-NV-512MB', 'nVidea 512 MB Video Card', 1),\n(14, 'RAM-2GB-0.2', '2GB SDRAM', 2),\n(14, 'AMD-3600-CPU', 'AMD 3600+ Athlon CPU', 1),\n(14, 'MB-ATI-K8N', 'ATI K8 Motherboard w/network', 1),\n(14, 'CASE-ALIEN', 'Alien Case - Red', 1),\n(14, 'Mouse-S', 'Serial Mouse - 300 DPI', 1),\n(14, 'KB-128-ERGO', 'KeysRus ergonomic keyboard', 1),\n(18, 'RAM-2GB-0.2', '2GB SDRAM', 2),\n(18, 'AMD-3600-CPU', 'AMD 3600+ Athlon CPU', 1),\n(18, 'MB-ATI-K8N', 'ATI K8 Motherboard w/network', 1),\n(18, 'CASE-ALIEN', 'Alien Case - Red', 1),\n(18, 'VID-NV-512MB', 'nVidea 512 MB Video Card', 1);"); // data for table inventory_purchase_details $db->Execute("TRUNCATE TABLE " . TABLE_INVENTORY_PURCHASE); $db->Execute("INSERT INTO " . TABLE_INVENTORY_PURCHASE . " (sku, vendor_id, description_purchase, purch_taxable, item_cost) VALUES\n('AMD-3600-CPU', 3, 'AMD 3600+ Athlon CPU', 0, 100),\n('ASSY-BB', 0, 'Labor Cost - Assemble Bare Bones Computer', 0, 25),\n('BOX-TW-322', 0, 'TW-322 Shipping Box - 12 x 12 x 12', 0, 1.35),\n('BOX-TW-553', 0, 'TW-533 Shipping Box - 24 x 12 x 12', 0, 1.75),\n('CASE-ALIEN', 13, 'Closed Cases - Red Full Tower ATX case w/o power supply', 0, 47),\n('DESC-WARR', 0, 'Warranty Template', 0, 0),\n('DVD-RW', 15, 'DVD RW with Lightscribe - 8x', 0, 23.6),\n('HD-150GB', 15, '150GB SATA Hard Drive - 7200 RPM', 0, 27),\n('KB-128-ERGO', 11, 'KeysRus ergonomic keyboard - Lighted for Gaming', 1, 23.51),\n('LCD-21-WS', 5, 'LCDisplays 21\" LCD Monitor - wide screen w/anti-glare finish, Black', 0, 145.01),\n('MB-ATI-K8', 3, 'ATI-K8-TW AMD socket 939 Motherboard for Athlon Processors', 0, 125),\n('MB-ATI-K8N', 3, 'ATI-K8-TW AMD socket 939 Motherboard for Athlon Processors with network ports', 0, 135),\n('Mouse-S', 11, 'Serial Mouse - 300 DPI', 0, 4.85),\n('PC-2GB-120GB-21', 0, 'Fully assembled computer AMD/ATI 2048GB Ram/1282 GB HD/Red Case/ Monitor/ Keyboard/ Mouse', 0, 0),\n('PS-450W', 14, '850 Watt Silent Power Supply - for use with Intel or AMD processors', 0, 86.26),\n('RAM-2GB-0.2', 3, '2 GB PC3200 Memory Modules - for Athlon processors', 0, 56.25),\n('VID-NV-512MB', 1, 'nVidea 512 MB Video Card - with SLI support', 0, 0),\n('PC-BB-512', 0, 'Fully assembled bare bones computer AMD/ATI 512MB/2GB/Red Case', 0, 0);\n\t"); // copy the demo images require DIR_FS_MODULES . 'phreedom/classes/backup.php'; $backups = new backup(); if (!is_dir(DIR_FS_MY_FILES . $_SESSION['company'] . '/inventory/images/demo')) { if (!@mkdir(DIR_FS_MY_FILES . $_SESSION['company'] . '/inventory/images/demo')) { $error = true; } } $dir_source = DIR_FS_MODULES . 'inventory/images/demo/'; $dir_dest = DIR_FS_MY_FILES . $_SESSION['company'] . '/inventory/images/demo/'; $backups->copy_dir($dir_source, $dir_dest); return $error; }
break; default: case 'data': $table_list = array(); if (is_array($install_mod->tables)) { foreach ($install_mod->tables as $table => $create_sql) { $table_list[] = $table; } $backup->copy_db_table($db_orig, $table_list, $type = 'both', $params = ''); } if (is_array($install_mod->dirlist)) { foreach ($install_mod->dirlist as $source_dir) { $dir_source = DIR_FS_MY_FILES . $_SESSION['company'] . '/' . $source_dir . '/'; $dir_dest = DIR_FS_MY_FILES . $db_name . '/' . $source_dir . '/'; @mkdir(DIR_FS_MY_FILES . $db_name . '/' . $source_dir); $backup->copy_dir($dir_source, $dir_dest); } } break; default: // skip, should not happen } } // install reports now that categories are set up if ($_POST['phreeform_action'] != 'data') { // if=data reports have been copied, else load basic reports foreach ($copy_modules as $entry) { admin_add_reports($entry, DIR_FS_MY_FILES . $db_name . '/phreeform/'); } } }