Changeset 456


Ignore:
Timestamp:
Oct 31, 2012, 4:52:38 PM (12 years ago)
Author:
chronos
Message:
  • Opraveno: Opět se rozlišuje při načítání položek z databáze do jakého pole mají být data načtena. Indexy jmenné nebo číselné nebo obojí.
  • Opraveno: Převod starých produktů na novou strukturu.
  • Opraveno: Zobrazení výpisu zařízení ve stavu uživatele.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Database.php

    r448 r456  
    1212  function fetch_assoc()
    1313  {
    14     return($this->PDOStatement->fetch());
     14    return($this->PDOStatement->fetch(PDO::FETCH_ASSOC));
    1515  }
    1616 
    1717  function fetch_array()
    1818  {
    19     return($this->PDOStatement->fetch());
     19    return($this->PDOStatement->fetch(PDO::FETCH_BOTH));
    2020  }
    2121
    2222  function fetch_row()
    2323  {
    24     return($this->PDOStatement->fetch());
     24    return($this->PDOStatement->fetch(PDO::FETCH_NUM));
    2525  }
    2626}
  • trunk/finance/user_state.php

    r453 r456  
    3232   
    3333    if(!array_key_exists('show', $_GET)) $_GET['show'] = '';
    34     $DbResult = $this->Database->query('SELECT * FROM Member LEFT JOIN MemberPayment ON MemberPayment.Member=Member.Id WHERE Member.Subject='.$Subject['Id']);
     34    $DbResult = $this->Database->query('SELECT Member.*, MemberPayment.MonthlyPlus AS MonthlyPlus '.
     35      'FROM Member LEFT JOIN MemberPayment ON MemberPayment.Member=Member.Id WHERE Member.Subject='.$Subject['Id']);
    3536    $Member = $DbResult->fetch_assoc();
    3637    $TarifName = $Finance->Tariffs[$Member['InternetTariffCurrentMonth']]['Name'];
     
    122123      $DbResult = $this->Database->query('SELECT Product.Name AS Name, Product.Consumption AS Consumption '.
    123124        'FROM StockItem JOIN Product ON Product.Id = StockItem.Product '.
    124         'WHERE Location='.$Member['Id'].' AND (TimeElimination IS NULL)');
     125        'WHERE (StockItem.Location='.$Member['Id'].') AND (StockItem.TimeElimination IS NULL)');
    125126      $TotalW = 0;
    126127      $TotalPrice = 0;
  • trunk/temp/product.php

    r453 r456  
    1616    'Consumption' => $DbRow['Consumption'], 'UnitOfMeasure' => 1, 'VAT' => 20));
    1717  $ProductId = $System->Database->insert_id;
    18   if($DbRow['Used'] == 0) $Elimination = 'NULL';
    19     else $Elimination = $DbRow['TimeElimination'];
     18  //print_r($DbRow);
     19  switch($DbRow['Used'])
     20  {
     21    case 0: $Elimination = '0000-00-00'; break;
     22    case 1: $Elimination = NULL; break;
     23    case 2: $Elimination = NULL; break;
     24  }
     25       
     26  //  else $Elimination = $DbRow['TimeElimination'];
     27  if($DbRow['Used'] == 2) $DbRow['User'] = NULL;
     28  echo($DbRow['Used'].'"'.$Elimination.'"<br/>');
     29//  print_r(array('Stock' => 1, 'Product' => $ProductId, 'Amount' => $DbRow['Count'],
     30//    'Segment' => $DbRow['Segment'], 'TimeEnlistment' => $DbRow['Date'], 'TimeElimination' => $Elimination,
     31//    'SerialNumber' => $DbRow['DeviceId'], 'BuyPrice' => $DbRow['Price'], 'SellPrice' => $DbRow['Price'],
     32//    'Location' => $DbRow['User'], 'Info' => $DbRow['Info']));
    2033  $Database->insert('StockItem', array('Stock' => 1, 'Product' => $ProductId, 'Amount' => $DbRow['Count'],
    2134    'Segment' => $DbRow['Segment'], 'TimeEnlistment' => $DbRow['Date'], 'TimeElimination' => $Elimination,
Note: See TracChangeset for help on using the changeset viewer.