source: trunk/temp/product.php@ 548

Last change on this file since 548 was 548, checked in by chronos, 12 years ago
  • Odstraněno: Ukončovací PHP značka.
File size: 1.6 KB
Line 
1<?php
2die();
3
4include('../Common/Global.php');
5GlobalInit();
6
7/* @var $System System */
8$System->Database->query('DELETE FROM StockItem');
9$System->Database->query('DELETE FROM Product');
10
11$DbResult = $System->Database->select('ProductOld', '*');
12while($DbRow = $DbResult->fetch_assoc())
13{
14 echo($DbRow['Name'].', ');
15
16 $System->Database->insert('Product', array('Name' => $DbRow['Name'],
17 'SellPrice' => $DbRow['Price'], 'BuyPrice' => $DbRow['Price'],
18 'Consumption' => $DbRow['Consumption'], 'UnitOfMeasure' => 1, 'VAT' => 20));
19 $ProductId = $System->Database->insert_id;
20 //print_r($DbRow);
21 switch($DbRow['Used'])
22 {
23 case 0: $Elimination = '0000-00-00'; break;
24 case 1: $Elimination = NULL; break;
25 case 2: $Elimination = NULL; break;
26 }
27
28 // else $Elimination = $DbRow['TimeElimination'];
29 if($DbRow['Used'] == 2) $DbRow['User'] = NULL;
30 echo($DbRow['Used'].'"'.$Elimination.'"<br/>');
31// print_r(array('Stock' => 1, 'Product' => $ProductId, 'Amount' => $DbRow['Count'],
32// 'Segment' => $DbRow['Segment'], 'TimeEnlistment' => $DbRow['Date'], 'TimeElimination' => $Elimination,
33// 'SerialNumber' => $DbRow['DeviceId'], 'BuyPrice' => $DbRow['Price'], 'SellPrice' => $DbRow['Price'],
34// 'Location' => $DbRow['User'], 'Info' => $DbRow['Info']));
35 $Database->insert('StockItem', array('Stock' => 1, 'Product' => $ProductId, 'Amount' => $DbRow['Count'],
36 'Segment' => $DbRow['Segment'], 'TimeEnlistment' => $DbRow['Date'], 'TimeElimination' => $Elimination,
37 'SerialNumber' => $DbRow['DeviceId'], 'BuyPrice' => $DbRow['Price'], 'SellPrice' => $DbRow['Price'],
38 'Location' => $DbRow['User'], 'Info' => $DbRow['Info']));
39}
Note: See TracBrowser for help on using the repository browser.