source: trunk/temp/product.php@ 451

Last change on this file since 451 was 451, checked in by chronos, 12 years ago
  • Upraveno: Korekce tabulek Product a StockItem.
File size: 868 bytes
Line 
1<?php
2include('../Common/Global.php');
3GlobalInit();
4
5/* @var $System System */
6$System->Database->query('TRUNCATE TABLE StockItem');
7$System->Database->query('TRUNCATE TABLE Product');
8
9$DbResult = $System->Database->select('ProductOld', '*');
10while($DbRow = $DbResult->fetch_assoc())
11{
12 echo($DbRow['Name'].', ');
13
14 $System->Database->insert('Product', array('Name' => $DbRow['Name'], 'SellPrice' => $DbRow['Price'],
15 'BuyPrice' => $DbRow['Price'],
16 'Consumption' => $DbRow['Consumption'], 'UnitOfMeasure' => 1, 'VAT' => 20));
17 $ProductId = $System->Database->insert_id;
18 $Database->insert('StockItem', array('Stock' => 1, 'Product' => $ProductId, 'Amount' => $DbRow['Count'],
19 'Segment' => $DbRow['Segment'], 'TimeEnlistment' => $DbRow['Date'], 'SerialNumber' => $DbRow['DeviceId'],
20 'Location' => $DbRow['User'], 'Info' => $DbRow['Info']));
21}
22
23?>
Note: See TracBrowser for help on using the repository browser.