Changeset 52 for www/finance/bills.php


Ignore:
Timestamp:
Feb 24, 2008, 3:18:56 PM (17 years ago)
Author:
george
Message:

Přidáno: Funkce pro vygenerování faktur za tři předchozí měsíce.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • www/finance/bills.php

    r50 r52  
    3939      $User['fullname'].'<br>'.
    4040      $User['street'].'<br>'.
    41       $User['psc'].' '.$User['town'].'<br>'.
    42       'IČO: '.$User['ico'].'<br>'.
     41      $User['psc'].' '.$User['town'].'<br>';
     42      if($User['ico'] != 0) $Output .= 'IČO: '.$User['ico'].'<br>';
     43      $Output .=
    4344      '</td></tr>'.
    4445      '<tr><td colspan="2"><hr></td></tr>'.
     
    8283    global $Database;
    8384 
    84     $Database->insert('finance_bills', array('time_create' => 'NOW()', 'user_id' => $UserId, 'time_from' => TimeToMysqlDateTime($TimeFrom), 'time_to' => TimeToMysqlDateTime($TimeTo), 'time_due' => TimeToMysqlDateTime(time() + 15*24*3600)));
     85    $Database->insert('finance_bills', array('time_create' => TimeToMysqlDateTime($TimeFrom), 'user_id' => $UserId, 'time_from' => TimeToMysqlDateTime($TimeFrom), 'time_to' => TimeToMysqlDateTime($TimeTo), 'time_due' => TimeToMysqlDateTime($TimeFrom + 15*24*3600)));
    8586    $BillId = $Database->insert_id;
    8687    foreach($Items as $Item)
     
    122123    $Output = shell_exec('echo "'.addslashes(from_utf8($HtmlCode)).'"|htmldoc --no-numbered --webpage --charset 8859-2 -t pdf -');
    123124    return($Output);
     125  }
     126
     127  function CustomGenerate()
     128  {
     129    global $Database;
     130   
     131    $DbResult = $Database->select('finance_operations', '*', '(date="2008-02-01" AND comment="Poplatek za měsíc Únor") OR '.
     132    '(date="2008-01-01" AND comment="Poplatek za měsíc Leden") OR (date="2007-12-01" AND comment="Poplatek za měsíc Prosinec") AND (bill_id = 0)');
     133    while($Row = $DbResult->fetch_array())
     134    {
     135      echo($Row['id']."<br>\n");
     136      $Time = MysqlDateToTime($Row['date']);
     137      $BillId = $this->CreateBill($Row['user'], array(array('description' => 'Poplatek za připojení k síti', 'price' => (-$Row['money']), 'quantity' => 1)), $Time, $Time + (date("t", time()) - 1) * 24 * 3600); 
     138     $Database->update('finance_operations', 'id='.$Row['id'], array('bill_id' => $BillId));
     139    }
    124140  }
    125141
Note: See TracChangeset for help on using the changeset viewer.