Ignore:
Timestamp:
Oct 24, 2012, 10:42:58 PM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Korekce tabulek Product a StockItem.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/finance/finance.php

    r444 r451  
    170170      $Cash = $Cash[0];
    171171   
    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)');
    173175      $ConsumptionPlus = $DbResult2->fetch_row();
    174176      $ConsumptionPlus = $ConsumptionPlus[0];
     
    232234      $RowP2 = $DbResult2->fetch_array();
    233235
    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)');
    235240      $Row2 = $DbResult2->fetch_array();
    236241      $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM Member WHERE NetworkSegment='.$NetworkSegment['Id']);
Note: See TracChangeset for help on using the changeset viewer.