Line | |
---|
1 | <?php
|
---|
2 | include('../Common/Global.php');
|
---|
3 | GlobalInit();
|
---|
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', '*');
|
---|
10 | while($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.