Changeset 627 for trunk/Modules/Finance
- Timestamp:
- Jan 2, 2014, 12:42:49 PM (11 years ago)
- Location:
- trunk/Modules/Finance
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Finance/Bill.php
r565 r627 86 86 '</td><td valign="top">'. 87 87 '<br>'. 88 'Datum vystavení: '.HumanDate($Invoice['Time Creation']).'<br>'.89 'Datum zdanitel. plnění: '.HumanDate($Invoice['Time Creation']).'<br>'.88 'Datum vystavení: '.HumanDate($Invoice['Time']).'<br>'. 89 'Datum zdanitel. plnění: '.HumanDate($Invoice['Time']).'<br>'. 90 90 'Datum splatnosti: '.HumanDate($Invoice['TimeDue']).'<br>'; 91 91 if(($Invoice['PeriodFrom'] != '') and ($Invoice['PeriodTo'] != '')) -
trunk/Modules/Finance/Finance.php
r605 r627 164 164 // Get latest year 165 165 $DbResult = $this->Database->select('FinanceYear', '*', '1 ORDER BY `Year` DESC LIMIT 1'); 166 } else $DbResult = $this->Database->select('FinanceYear', '*', 'Id='.$FinanceYear); 166 } else $DbResult = $this->Database->select('FinanceYear', '*', '`Year`='.$FinanceYear); 167 echo('rok:'.$FinanceYear.' '.$DbResult->num_rows); 168 if($DbResult->num_rows == 0) throw new Exception('Rok '.$FinanceYear.' nenalezen'); 167 169 $FinanceYear = $DbResult->fetch_assoc(); 170 if($FinanceYear['Closed'] == 1) throw new Exception('Rok '.$FinanceYear['Year'].' je již uzavřen. Nelze do něj přidávat položky.'); 168 171 169 172 $DbResult = $this->Database->query('SELECT `Shortcut`, `Id` FROM `DocumentLine` WHERE `Id`='.$Id); … … 349 352 'Title' => 'Faktury', 350 353 'Table' => 'FinanceInvoice', 351 'DefaultSortColumn' => 'Time Creation',354 'DefaultSortColumn' => 'Time', 352 355 'Items' => array( 353 356 'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''), 354 357 'BillCode' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => ''), 355 358 'Subject' => array('Type' => 'TSubject', 'Caption' => 'Subjekt', 'Default' => ''), 356 'Time Creation' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''),359 'Time' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''), 357 360 'TimeDue' => array('Type' => 'Date', 'Caption' => 'Čas splatnosti', 'Default' => ''), 358 361 'TimePayment' => array('Type' => 'Date', 'Caption' => 'Čas zaplacení', 'Default' => '', 'Null' => true), … … 462 465 function BeforeInsertFinanceOperation($Form) 463 466 { 467 $Year = date("Y", $Form->Values['Time']); 464 468 $DocumentLine = $Form->Values['DocumentLine']; 465 $Form->Values['BillCode'] = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine );469 $Form->Values['BillCode'] = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine, $Year); 466 470 return($Form->Values); 467 471 } -
trunk/Modules/Finance/Manage.php
r609 r627 111 111 $SumValue = $SumValue + $Item['Price'] * $Item['Quantity']; 112 112 $this->Database->insert('FinanceInvoice', array( 113 'Subject' => $Subject, 'Time Creation' => TimeToMysqlDateTime($TimeCreation),113 'Subject' => $Subject, 'Time' => TimeToMysqlDateTime($TimeCreation), 114 114 'TimeDue' => TimeToMysqlDateTime($TimeDue), 'Value' => $SumValue, 'BillCode' => $BillCode, 115 115 'PeriodFrom' => TimeToMysqlDate($PeriodFrom), 'PeriodTo' => TimeToMysqlDate($PeriodTo), … … 352 352 '<th style="border-style: solid; border-width: 1px; padding: 1px 5px 1px 5px; text-align: center; font-weight: bold;">Částka [Kč]</th></tr>'."\n"; 353 353 $DbResult = $this->Database->query('SELECT T1.* FROM ((SELECT Text, Time, Value AS Value, File FROM FinanceOperation WHERE (Subject='.$Member['Subject'].')) UNION ALL '. 354 '(SELECT CONCAT(`Text`, (SELECT GROUP_CONCAT(`Description` SEPARATOR "<br/>") FROM `FinanceInvoiceItem` WHERE `FinanceInvoiceItem`.`FinanceInvoice` = `FinanceInvoice`.`Id`)) AS `Text`, Time Creation as Time, -Value as Value, File FROM FinanceInvoice WHERE (Subject='.354 '(SELECT CONCAT(`Text`, (SELECT GROUP_CONCAT(`Description` SEPARATOR "<br/>") FROM `FinanceInvoiceItem` WHERE `FinanceInvoiceItem`.`FinanceInvoice` = `FinanceInvoice`.`Id`)) AS `Text`, Time, -Value as Value, File FROM FinanceInvoice WHERE (Subject='. 355 355 $Member['Subject'].')) ORDER BY Time DESC) AS T1 WHERE (T1.Time > "'.$Member['BillingPeriodLastDate'].'")'); 356 356 while($DbRow = $DbResult->fetch_assoc()) -
trunk/Modules/Finance/UserState.php
r554 r627 69 69 'FROM FinanceOperation WHERE (Subject='.$Subject['Id'].')) UNION ALL '. 70 70 '(SELECT (SELECT GROUP_CONCAT(Description SEPARATOR ",") FROM FinanceInvoiceItem WHERE FinanceInvoice=FinanceInvoice.Id) AS Text, '. 71 'Time Creation as Time, -Value as Value, File, BillCode, PeriodFrom, PeriodTo FROM FinanceInvoice WHERE (Subject='.$Subject['Id'].')) ORDER BY Time DESC) AS T1';71 'Time, -Value as Value, File, BillCode, PeriodFrom, PeriodTo FROM FinanceInvoice WHERE (Subject='.$Subject['Id'].')) ORDER BY Time DESC) AS T1'; 72 72 $DbResult = $this->Database->query('SELECT SUM(T1.Value) AS Total FROM '.$UserOperationTableQuery); 73 73 $DbRow = $DbResult->fetch_array(); -
trunk/Modules/Finance/Zivnost.php
r548 r627 28 28 $Balance['Spend']['End'] = $Row[0] + 0; 29 29 30 $DbResult = $this->Database->query('SELECT SUM(Value) FROM FinanceInvoice WHERE (Time Creation < "'.TimeToMysqlDateTime($StartTime).'") AND (TimeCreation>= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value > 0)');30 $DbResult = $this->Database->query('SELECT SUM(Value) FROM FinanceInvoice WHERE (Time < "'.TimeToMysqlDateTime($StartTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value > 0)'); 31 31 $Row = $DbResult->fetch_array(); 32 32 $Balance['Claims']['Start'] = $Row[0] + 0; 33 $DbResult = $this->Database->query('SELECT SUM(Value) FROM FinanceInvoice WHERE (Time Creation <= "'.TimeToMysqlDateTime($EndTime).'") AND (TimeCreation>= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value > 0)');33 $DbResult = $this->Database->query('SELECT SUM(Value) FROM FinanceInvoice WHERE (Time <= "'.TimeToMysqlDateTime($EndTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value > 0)'); 34 34 $Row = $DbResult->fetch_array(); 35 35 $Balance['Claims']['End'] = $Row[0] + 0; 36 36 37 $DbResult = $this->Database->query('SELECT SUM(-Value) FROM FinanceInvoice WHERE (Time Creation < "'.TimeToMysqlDateTime($StartTime).'") AND (TimeCreation>= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value < 0)');37 $DbResult = $this->Database->query('SELECT SUM(-Value) FROM FinanceInvoice WHERE (Time < "'.TimeToMysqlDateTime($StartTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value < 0)'); 38 38 $Row = $DbResult->fetch_array(); 39 39 $Balance['Liabilities']['Start'] = $Row[0] + 0; 40 $DbResult = $this->Database->query('SELECT SUM(-Value) FROM FinanceInvoice WHERE (Time Creation <= "'.TimeToMysqlDateTime($EndTime).'") AND (TimeCreation>= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value < 0)');40 $DbResult = $this->Database->query('SELECT SUM(-Value) FROM FinanceInvoice WHERE (Time <= "'.TimeToMysqlDateTime($EndTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value < 0)'); 41 41 $Row = $DbResult->fetch_array(); 42 42 $Balance['Liabilities']['End'] = $Row[0] + 0; … … 207 207 $DbResult = $this->Database->query('SELECT *, (SELECT GROUP_CONCAT(Description SEPARATOR ",") FROM FinanceInvoiceItem WHERE FinanceInvoiceItem.FinanceInvoice = FinanceInvoice.Id) AS Text '. 208 208 'FROM FinanceInvoice JOIN Subject ON Subject.Id = FinanceInvoice.Subject '. 209 'WHERE (Value > 0) AND (FinanceInvoice.Time Creation>= "'.$Year['DateStart'].210 '") AND (FinanceInvoice.Time Creation <= "'.$Year['DateEnd'].'") ORDER BY TimeCreation');209 'WHERE (Value > 0) AND (FinanceInvoice.Time >= "'.$Year['DateStart']. 210 '") AND (FinanceInvoice.Time <= "'.$Year['DateEnd'].'") ORDER BY Time'); 211 211 while($Row = $DbResult->fetch_array()) 212 212 { 213 213 if($Row['TimePayment'] == '0000-00-00 00:00:00') $Row['TimePayment'] = ' '; 214 $Output .= '<tr><td>'.HumanDate($Row['Time Creation']).'</td><td>'.$Row['BillCode'].'</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td></tr>';214 $Output .= '<tr><td>'.HumanDate($Row['Time']).'</td><td>'.$Row['BillCode'].'</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td></tr>'; 215 215 $Total += $Row['Value']; 216 216 } … … 229 229 $DbResult = $this->Database->query('SELECT *, (SELECT GROUP_CONCAT(Description SEPARATOR ",") FROM FinanceInvoiceItem WHERE FinanceInvoiceItem.FinanceInvoice = FinanceInvoice.Id) AS Text '. 230 230 'FROM FinanceInvoice JOIN Subject ON Subject.Id = FinanceInvoice.Subject '. 231 'WHERE (Value < 0) AND (FinanceInvoice.Time Creation>= "'.$Year['DateStart'].232 '") AND (FinanceInvoice.Time Creation <= "'.$Year['DateEnd'].'") ORDER BY TimeCreation');231 'WHERE (Value < 0) AND (FinanceInvoice.Time >= "'.$Year['DateStart']. 232 '") AND (FinanceInvoice.Time <= "'.$Year['DateEnd'].'") ORDER BY Time'); 233 233 while($Row = $DbResult->fetch_array()) 234 234 { 235 235 if($Row['TimePayment'] == '0000-00-00 00:00:00') $Row['TimePayment'] = ' '; 236 236 $Row['Value'] = $Row['Value'] * -1; 237 $Output .= '<tr><td>'.HumanDate($Row['Time Creation']).'</td><td>'.$Row['BillCode'].'</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td></tr>';237 $Output .= '<tr><td>'.HumanDate($Row['Time']).'</td><td>'.$Row['BillCode'].'</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td></tr>'; 238 238 $Total += $Row['Value']; 239 239 } … … 288 288 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'; 289 289 $Output .= '<tr><th>Datum vytvoření</th><th>Datum zaplacení</th><th>Název</th><th>Hodnota [Kč]</th><th>Doklad</th></tr>'; 290 $DbResult = $this->Database->select('FinanceInvoice', '*, (SELECT GROUP_CONCAT(Description SEPARATOR ",") FROM FinanceInvoiceItem WHERE FinanceInvoiceItem.FinanceInvoice = FinanceInvoice.Id) AS Text', 'Subject='.$_GET['Id'].' ORDER BY Time Creation');291 while($Row = $DbResult->fetch_array()) 292 { 293 $Output .= '<tr><td>'.HumanDate($Row['Time Creation']).'</td><td>'.HumanDate($Row['TimePayment']).290 $DbResult = $this->Database->select('FinanceInvoice', '*, (SELECT GROUP_CONCAT(Description SEPARATOR ",") FROM FinanceInvoiceItem WHERE FinanceInvoiceItem.FinanceInvoice = FinanceInvoice.Id) AS Text', 'Subject='.$_GET['Id'].' ORDER BY Time'); 291 while($Row = $DbResult->fetch_array()) 292 { 293 $Output .= '<tr><td>'.HumanDate($Row['Time']).'</td><td>'.HumanDate($Row['TimePayment']). 294 294 '</td><td>'.$Row['Text'].'</td><td>'.($Row['Value']).'</td><td>'.$Row['BillCode'].'</td></tr>'; 295 295 } … … 302 302 while($Row = $DbResult->fetch_array()) 303 303 { 304 $Output .= '<tr><td>'.$Row['Time Creation'].'</td><td>'.$Row['TimePass'].'</td><td>'.$Row['Direction'].'</td><td>'.($Row['Value']).'</td><td>'.$Row['CashFlowId'].'</td></tr>';304 $Output .= '<tr><td>'.$Row['Time'].'</td><td>'.$Row['TimePass'].'</td><td>'.$Row['Direction'].'</td><td>'.($Row['Value']).'</td><td>'.$Row['CashFlowId'].'</td></tr>'; 305 305 } 306 306 $Output .= '</table>';*/
Note:
See TracChangeset
for help on using the changeset viewer.