Changeset 297


Ignore:
Timestamp:
Oct 2, 2010, 8:18:49 PM (14 years ago)
Author:
george
Message:
  • Opraveno: Generování časů vystavení a splatnosti u nových dokladů.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/finance/bills.php

    r295 r297  
    6262        'Datum zdanitel. plnění: '.HumanDate($Bill['TimeCreate']).'<br>'.
    6363        'Datum splatnosti: '.HumanDate($Bill['TimeDue']).'<br>';
    64         //if(($Bill['TimeFrom'] != '0000-00-00 00:00:00') and ($Bill['TimeTo'] != '0000-00-00 00:00:00'))
    65         //  $Output .= 'Fakturované období: '.HumanDate($Bill['TimeFrom']).' - '.HumanDate($Bill['TimeTo']).'<br>';
    6664        $Output .= '</td></tr>'.
    6765        '<tr><td colspan="2">'.
     
    122120  }
    123121
    124   function CreateBill($SubjectId, $Items, $TimeFrom, $TimeTo, $BillCode = '', $Type = 'invoice')
    125   {
    126     $this->Database->insert('FinanceBills', array('TimeCreate' => TimeToMysqlDateTime(time()), 'Subject' => $SubjectId, 'TimeFrom' => TimeToMysqlDateTime($TimeFrom), 'TimeTo' => TimeToMysqlDateTime($TimeTo), 'TimeDue' => TimeToMysqlDateTime($TimeFrom + 15 * 24 * 3600), 'BillCode' => $BillCode, 'Type' => $Type));
     122  function CreateBill($SubjectId, $Items, $TimeCreate, $TimeDue, $BillCode = '', $Type = 'invoice')
     123  {
     124    $this->Database->insert('FinanceBills', array('TimeCreate' => TimeToMysqlDateTime($TimeCreate), 'Subject' => $SubjectId, 'TimeDue' => TimeToMysqlDateTime($TimeDue), 'BillCode' => $BillCode, 'Type' => $Type));
    127125    $BillId = $this->Database->insert_id;
    128126    foreach($Items as $Item)
  • trunk/finance/manage.php

    r296 r297  
    541541          $Output .= $TimePeriodText.': '.$Member['MonthlyTotal'].' * '.$Period['MonthCount'].' = '.$PayPerPeriod.'<br />';
    542542          $BillCode = $Finance->GetNextDocumentLineNumber(6); // Faktury vydané
    543           $BillId = $this->System->Modules['Bill']->CreateBill($Member['Subject'], array(array('Description' => 'Připojení k síti', 'Price' => $PayPerPeriod, 'Quantity' => 1)), $Period['From'], $Period['To'], $BillCode);
     543          $BillId = $this->System->Modules['Bill']->CreateBill($Member['Subject'], array(array('Description' => 'Připojení k síti', 'Price' => $PayPerPeriod, 'Quantity' => 1)), time(), time() + 3600 * 24 * 15, $BillCode);
    544544          $this->Database->insert('FinanceClaimsLiabilities', array('Value' => $PayPerPeriod, 'Subject' => $Member['Subject'], 'TimeCreation' => 'NOW()', 'TimeDue' => 'DATE_ADD(NOW(), INTERVAL 15 DAY)', 'Text' => 'Připojení k síti za období '.$TimePeriodText, 'Bill' => $BillId, 'BillCode' => $BillCode));
    545545          $Output .= $this->SendPaymentEmail($Member['Id']);
     
    624624  {
    625625    // FinanceClaimsLiablities
    626     $DbResult = $this->Database->query('SELECT * FROM FinanceClaimsLiabilities WHERE (BillCode <> "") AND (Value >= 0) AND (BillId = 0)');
     626    $DbResult = $this->Database->query('SELECT * FROM FinanceClaimsLiabilities WHERE (BillCode <> "") AND (Value >= 0) AND (Bill = 0)');
    627627    while($Row = $DbResult->fetch_assoc())
    628628    {
  • trunk/sql/updates/295.sql

    r295 r297  
    11UPDATE `FinanceClaimsLiabilities` SET TimeDue = CONCAT(YEAR(TimeCreation), "-", MONTH(TimeCreation), "-16") WHERE (TimeDue = 0) AND (TimeCreation <= CONCAT(YEAR(TimeCreation), "-", MONTH(TimeCreation), "-16"));
    22
    3 UPDATE `FinanceClaimsLiabilities` SET TimeDue = TimeCreation WHERE TimeDue=0;
     3UPDATE `FinanceClaimsLiabilities` SET TimeDue = TimeCreation WHERE TimeDue="0000-00-00 00:00:00";
Note: See TracChangeset for help on using the changeset viewer.