- Timestamp:
- Oct 24, 2012, 10:42:58 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/finance/finance.php
r444 r451 170 170 $Cash = $Cash[0]; 171 171 172 $DbResult2 = $this->Database->query('SELECT SUM(Consumption) FROM Product WHERE (User='.$Member['Id'].') AND (Used = 1)'); 172 $DbResult2 = $this->Database->query('SELECT SUM(`Product`.`Consumption`) * `StockItem`.`Amount` '. 173 'FROM `StockItem` JOIN `Product` ON `Product`.`Id` = `StockItem`.`Product` '. 174 'WHERE (`StockItem`.`Location` = '.$Member['Id'].') AND (`StockItem`.`TimeElimination` IS NULL)'); 173 175 $ConsumptionPlus = $DbResult2->fetch_row(); 174 176 $ConsumptionPlus = $ConsumptionPlus[0]; … … 232 234 $RowP2 = $DbResult2->fetch_array(); 233 235 234 $DbResult2 = $this->Database->query('SELECT SUM(Price) AS Price, SUM(Consumption) AS Consumption FROM Product WHERE Segment='.$NetworkSegment['Id'].' AND Used=1'); 236 $DbResult2 = $this->Database->query('SELECT SUM(`Product`.`BuyPrice`) * `StockItem`.`Amount` AS `Price`, '. 237 'SUM(`Product`.`Consumption`) * `StockItem`.`Amount` AS `Consumption` '. 238 'FROM `StockItem` JOIN `Product` ON `Product`.`Id` = `StockItem`.`Product` '. 239 'WHERE (`StockItem`.`Segment`='.$NetworkSegment['Id'].') AND (`StockItem`.`TimeElimination` IS NULL)'); 235 240 $Row2 = $DbResult2->fetch_array(); 236 241 $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM Member WHERE NetworkSegment='.$NetworkSegment['Id']); -
trunk/finance/index.php
r438 r451 57 57 $TotalGain = 0; 58 58 $TotalExpense = 0; 59 $DbResult = $this->Database->query('SELECT SUM(Consumption) FROM Product WHERE Used=1'); 59 $DbResult = $this->Database->query('SELECT SUM(Product.Consumption) * StockItem.Amount FROM StockItem '. 60 'JOIN Product ON Product.Id=StockItem.Product WHERE (StockItem.TimeElimination IS NULL)'); 60 61 $Row = $DbResult->fetch_array(); 61 62 $TotalConsumption = $this->System->Modules['Finance']->W2Kc($Row[0]); -
trunk/form_classes.php
r449 r451 110 110 'Items' => array( 111 111 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 112 'SellPrice' => array('Type' => 'Integer', 'Caption' => 'Cena', 'Default' => '0'), 112 'SellPrice' => array('Type' => 'Integer', 'Caption' => 'Prodejní cena', 'Default' => '0'), 113 'BuyPrice' => array('Type' => 'Integer', 'Caption' => 'Kupní cena', 'Default' => '0'), 113 114 'VAT' => array('Type' => 'Integer', 'Caption' => 'DPH', 'Default' => '0'), 114 115 'Consumption' => array('Type' => 'Integer', 'Caption' => 'Spotřeba', 'Default' => ''), … … 133 134 'Location' => array('Type' => 'TMember', 'Caption' => 'Umístění', 'Default' => '', 'Null' => true), 134 135 'Segment' => array('Type' => 'TNetworkSegment', 'Caption' => 'Úsek sítě', 'Default' => '', 'Null' => true), 136 'Info' => array('Type' => 'Text', 'Caption' => 'Informace', 'Default' => ''), 135 137 ), 136 138 ), -
trunk/sql/updates/446.sql
r450 r451 4 4 RENAME TABLE `StockCard` TO `Product` ; 5 5 ALTER TABLE `Product` CHANGE `Code` `Code` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_czech_ci NULL ; 6 ALTER TABLE `Product` ADD `BuyPrice` FLOAT NOT NULL AFTER `SellPrice`; 6 7 7 8 DROP TABLE IF EXISTS `StockItem`; … … 31 32 ALTER TABLE `StockItem` CHANGE `Segment` `Segment` INT( 11 ) NULL; 32 33 ALTER TABLE `StockItem` ADD `Info` TEXT NOT NULL ; 34 ALTER TABLE `StockItem` CHANGE `TimeElimination` `TimeElimination` DATE NULL; 33 35 34 36 ALTER TABLE `Stock` ADD `Location` INT NULL , ADD INDEX ( `Location` ); -
trunk/temp/product.php
r450 r451 13 13 14 14 $System->Database->insert('Product', array('Name' => $DbRow['Name'], 'SellPrice' => $DbRow['Price'], 15 'Consumption' => $DbRow['Consumption'], 'UnitOfMeasure' => 1, 'VAT' => 20)); 15 'BuyPrice' => $DbRow['Price'], 16 'Consumption' => $DbRow['Consumption'], 'UnitOfMeasure' => 1, 'VAT' => 20)); 16 17 $ProductId = $System->Database->insert_id; 17 18 $Database->insert('StockItem', array('Stock' => 1, 'Product' => $ProductId, 'Amount' => $DbRow['Count'], 18 19 'Segment' => $DbRow['Segment'], 'TimeEnlistment' => $DbRow['Date'], 'SerialNumber' => $DbRow['DeviceId'], 19 20 'Location' => $DbRow['User'], 'Info' => $DbRow['Info'])); 20 21 } 21 22
Note:
See TracChangeset
for help on using the changeset viewer.