Title = 'Daňová evidence'; $this->ParentClass = 'PageFinance'; } function GetTimePeriodBalance(int $StartTime, int $EndTime): array { $Balance = array(); $DbResult = $this->Database->query('SELECT SUM(`Value`) FROM `FinanceOperation` '. 'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id` = `FinanceOperation`.`Group` '. 'WHERE (`Time` < "'.TimeToMysqlDateTime($StartTime).'") AND (`Time` >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (`Taxable` = 1) AND (`FinanceOperationGroup`.`ValueSign` = 1)'); $Row = $DbResult->fetch_array(); $Balance['Income']['Start'] = $Row[0] + 0; $DbResult = $this->Database->query('SELECT SUM(Value) FROM FinanceOperation '. 'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id` = `FinanceOperation`.`Group` '. 'WHERE (Time <= "'.TimeToMysqlDateTime($EndTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Taxable = 1) AND (`FinanceOperationGroup`.`ValueSign` = 1)'); $Row = $DbResult->fetch_array(); $Balance['Income']['End'] = $Row[0] + 0; $DbResult = $this->Database->query('SELECT SUM(Value*ValueSign) FROM FinanceOperation '. 'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id` = `FinanceOperation`.`Group` '. 'WHERE (`Time` < "'.TimeToMysqlDateTime($StartTime).'") AND (`Time` >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (`Taxable` = 1) AND (`FinanceOperationGroup`.`ValueSign` = -1)'); $Row = $DbResult->fetch_array(); $Balance['Spend']['Start'] = $Row[0] + 0; $DbResult = $this->Database->query('SELECT SUM(Value*ValueSign) FROM FinanceOperation '. 'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id` = `FinanceOperation`.`Group` '. 'WHERE (Time <= "'.TimeToMysqlDateTime($EndTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Taxable = 1) AND (`FinanceOperationGroup`.`ValueSign` = -1)'); $Row = $DbResult->fetch_array(); $Balance['Spend']['End'] = $Row[0] + 0; $DbResult = $this->Database->query('SELECT SUM(Value*ValueSign) FROM FinanceInvoice '. 'LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id` = `FinanceInvoice`.`Group` '. 'WHERE (Time < "'.TimeToMysqlDateTime($StartTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (`FinanceInvoiceGroup`.`ValueSign` = 1)'); $Row = $DbResult->fetch_array(); $Balance['Claims']['Start'] = $Row[0] + 0; $DbResult = $this->Database->query('SELECT SUM(Value*ValueSign) FROM FinanceInvoice '. 'LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id` = `FinanceInvoice`.`Group` '. 'WHERE (Time <= "'.TimeToMysqlDateTime($EndTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (`FinanceInvoiceGroup`.`ValueSign` = 1)'); $Row = $DbResult->fetch_array(); $Balance['Claims']['End'] = $Row[0] + 0; $DbResult = $this->Database->query('SELECT SUM(Value*ValueSign) FROM FinanceInvoice '. 'LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id` = `FinanceInvoice`.`Group` '. 'WHERE (Time < "'.TimeToMysqlDateTime($StartTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (`FinanceInvoiceGroup`.`ValueSign` = -1)'); $Row = $DbResult->fetch_array(); $Balance['Liabilities']['Start'] = $Row[0] + 0; $DbResult = $this->Database->query('SELECT SUM(Value*ValueSign) FROM FinanceInvoice '. 'LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id` = `FinanceInvoice`.`Group` '. 'WHERE (Time <= "'.TimeToMysqlDateTime($EndTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (`FinanceInvoiceGroup`.`ValueSign` = -1)'); $Row = $DbResult->fetch_array(); $Balance['Liabilities']['End'] = $Row[0] + 0; // SmallAssets $DbResult = $this->Database->query('SELECT SUM(SellPrice) FROM StockSerialNumber WHERE (TimeEnlistment < "'.TimeToMysqlDateTime($StartTime).'") AND (TimeEnlistment != 0) AND ((TimeElimination > "'.TimeToMysqlDateTime($StartTime).'") OR (TimeElimination IS NULL))'); //$Output .= $Database->error; $Row = $DbResult->fetch_array(); $Balance['SmallAssets']['Start'] = $Row[0] + 0; $DbResult = $this->Database->query('SELECT SUM(SellPrice) FROM StockSerialNumber WHERE (TimeEnlistment < "'.TimeToMysqlDateTime($EndTime).'") AND (TimeEnlistment != 0) AND ((TimeElimination > "'.TimeToMysqlDateTime($EndTime).'") OR (TimeElimination IS NULL))'); $Row = $DbResult->fetch_array(); $Balance['SmallAssets']['End'] = $Row[0] + 0; return $Balance; } function ShowAnnualBalance(): string { $Output = '
Účetní období | Na konci | Během | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Rok | Od | Do | Příjmy | Výdaje | Pohledávky | Závazky | Drobný majetek | Příjmy | Výdaje | Pohledávky | Závazky | Drobný majetek | Základ daně |
'.$Year.' | '.date(HumanDate(TimeToMysqlDateTime($StartTime))).' | '.date(HumanDate(TimeToMysqlDateTime($EndTime))).' | '; $Output .= ''.round($Balance['Income']['End']).' | '; $Output .= ''.round($Balance['Spend']['End']).' | '; $Output .= ''.round($Balance['Claims']['End']).' | '; $Output .= ''.round($Balance['Liabilities']['End']).' | '; $Output .= ''.round($Balance['SmallAssets']['End']).' | '; $Output .= ''.round($Balance['Income']['End'] - $Balance['Income']['Start']).' | '; $Output .= ''.round($Balance['Spend']['End'] - $Balance['Spend']['Start']).' | '; $Output .= ''.round($Balance['Claims']['End'] - $Balance['Claims']['Start']).' | '; $Output .= ''.round($Balance['Liabilities']['End'] - $Balance['Liabilities']['Start']).' | '; $Output .= ''.round($Balance['SmallAssets']['End'] - $Balance['SmallAssets']['Start']).' | '; $Output .= ''.round(($Balance['Income']['End'] - $Balance['Income']['Start']) - ($Balance['Spend']['End'] - $Balance['Spend']['Start'])).' |
Účetní období | Na konci | Během | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Rok | Měsíc | Od | Do | Příjmy | Výdaje | Pohledávky | Závazky | Drobný majetek | Příjmy | Výdaje | Pohledávky | Závazky | Drobný majetek | Základ daně |
'.$Year.' | '.$Month.' | '.date(HumanDate(TimeToMysqlDateTime($StartTime))).' | '.date(HumanDate(TimeToMysqlDateTime($EndTime))).' | '; $Output .= ''.round($Balance['Income']['End']).' | '; $Output .= ''.round($Balance['Spend']['End']).' | '; $Output .= ''.round($Balance['Claims']['End']).' | '; $Output .= ''.round($Balance['Liabilities']['End']).' | '; $Output .= ''.round($Balance['SmallAssets']['End']).' | '; $Output .= ''.round($Balance['Income']['End'] - $Balance['Income']['Start']).' | '; $Output .= ''.round($Balance['Spend']['End'] - $Balance['Spend']['Start']).' | '; $Output .= ''.round($Balance['Claims']['End'] - $Balance['Claims']['Start']).' | '; $Output .= ''.round($Balance['Liabilities']['End'] - $Balance['Liabilities']['Start']).' | '; $Output .= ''.round($Balance['SmallAssets']['End'] - $Balance['SmallAssets']['Start']).' | '; $Output .= ''.round(($Balance['Income']['End'] - $Balance['Income']['Start']) - ($Balance['Spend']['End'] - $Balance['Spend']['Start'])).' |
Čas | Kód | Subjekt | Text | Hodnota [Kč] | Daňový | Hotovost |
---|---|---|---|---|---|---|
'.HumanDate($Row['Time']).' | '.$Row['BillName']. ' | '.$Row['Name'].' | '.$Row['Text'].' | '.$Row['Value']. ' | '.$Table[$Row['Taxable']].' | '.$Table[$Row['Cash']].' |
Čas | Kód | Subjekt | Text | Hodnota [Kč] | Daňový | Hotovost |
---|---|---|---|---|---|---|
'.HumanDate($Row['Time']).' | '.$Row['BillName']. ' | '.$Row['SubjectName'].' | '.$Row['Text'].' | '.$Row['Value']. ' | '.$Table[$Row['Taxable']].' | '.$Table[$Row['Cash']].' |
Čas vystavení | Kód | Subjekt | Text | Hodnota [Kč] |
---|---|---|---|---|
'.HumanDate($Row['Time']).' | '.$Row['BillName']. ' | '.$Row['SubjectName'].' | '.$Row['Text'].' | '.$Row['Value'].' |
Čas vystavení | Kód | Subjekt | Text | Hodnota [Kč] |
---|---|---|---|---|
'.HumanDate($Row['Time']).' | '.$Row['BillName']. ' | '.$Row['SubjectName'].' | '.$Row['Text'].' | '.$Row['Value'].' |
Jméno | Závazky [Kč] | Pohledávky [Kč] | Příjmy [Kč] | Výdaje [Kč] | Stav účtu | Starý systém |
---|---|---|---|---|---|---|
'.$Row['Name'].' | '.$Row['Liabilities'].' / '.$Row['OpenedLiabilities'].' | '.$Row['Claims'].' / '.$Row['OpenedClaims'].' | '.$Row['Gains'].' | '.$Row['Spends'].' | '.($Row['Gains'] - $Row['Spends'] - $Row['Claims'] + $Row['Liabilities']).' | '.$Row['Cash'].' |
Název | Hodnota [Kč] | Datum zakoupení | Datum vyřezení |
---|---|---|---|
'.$Row['Name'].' | '.$Row['Price'].' | '.$Row['TimeEnlistment'].' | '.$Row['TimeElimination'].' |
';
$Output .= 'Výpis příjmů/výdajů';
$Output .= '
| ';
$Output .= 'Výpis závazků/pohledávek';
$Output .= '
|
Datum vytvoření | Datum zaplacení | Název | Hodnota [Kč] | |
---|---|---|---|---|
'.$Row['Time'].' | '.$Row['TimePass'].' | '.$Row['ValueSign'].' | '.($Row['Value']).' | '.$Row['CashFlowId'].' |
Datum | Subjekt |
---|
Datum | Subjekt | Suma [Kč] |
---|