Changeset 497


Ignore:
Timestamp:
Mar 3, 2013, 1:03:25 PM (11 years ago)
Author:
chronos
Message:
  • Upraveno: Zobecněn proces aktualizace dat tabulek při přechodu na nové období. Nyní se používá pole Action jakožto akce přidat, změnit, odebrat a ReplaceId jakožto id položky, které se operace týká.
  • Přidáno: Podpora pro uživatelské akce v seznamech v sekci Správa dat.
  • Upraveno: Řešení procesu generování nových faktur a plateb zákazníků při přechodu na nové období.
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Version.php

    r496 r497  
    11<?php
    22
    3 $Revision = 496; // Subversion revision
    4 $DatabaseRevision = 495;
    5 $ReleaseTime = '2013-03-01';
     3$Revision = 497; // Subversion revision
     4$DatabaseRevision = 497;
     5$ReleaseTime = '2013-03-03';
    66
    77?>
  • trunk/Modules/IS/IS.php

    r485 r497  
    219219    $Output .= '<ul class="ActionMenu">';
    220220    $Output .= '<li><a href="?a=add&amp;t='.$Table.'"><img alt="Přidat" title="Přidat" src="'.
    221         $this->System->Link('/images/add.png').'"/>Přidat</a></li>';
     221      $this->System->Link('/images/add.png').'"/>Přidat</a></li>';
    222222    $Output .= '<li><a href="?a=list&amp;t='.$Table.'"><img alt="Seznam" title="Seznam" src="'.
    223         $this->System->Link('/images/list.png').'"/>Seznam</a></li>';
     223      $this->System->Link('/images/list.png').'"/>Seznam</a></li>';
     224    if(array_key_exists('Actions', $FormClass))
     225    {
     226      foreach($FormClass['Actions'] as $Action)
     227        $Output .= '<li><a href="'.$this->System->Link($Action['URL']).'"><img alt="'.$Action['Caption'].'" title="'.$Action['Caption'].'" src="'.
     228            $this->System->Link('/images/action.png').'"/>'.$Action['Caption'].'</a></li>';
     229    }
    224230    $Output .= '</ul>';
    225231    return($Output);
  • trunk/admin/FullInstall.php

    r494 r497  
    33function FullInstall($Manager)
    44{
    5   $Manager->Execute("CREATE TABLE IF NOT EXISTS `ChatHistory` (
     5  $Manager->Execute("
     6--
     7-- Funkce
     8--
     9CREATE DEFINER=`centrala`@`localhost` FUNCTION `CompareNetworkPrefix`(Address1 INT(11) UNSIGNED, Address2 INT(11) UNSIGNED, Size INT(11)) RETURNS tinyint(1)
     10RETURN Address1 & (-1 << (32 - Size)) = Address2 & (-1 << (32 - Size));
     11     
     12--
     13-- Struktura tabulky `ChatHistory`
     14--
     15
     16CREATE TABLE IF NOT EXISTS `ChatHistory` (
    617  `Id` int(11) NOT NULL AUTO_INCREMENT,
    718  `Nick` varchar(64) COLLATE utf8_czech_ci NOT NULL,
     
    100111  `ValidTo` date DEFAULT NULL,
    101112  PRIMARY KEY (`Id`)
    102 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
     113) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
    103114
    104115-- --------------------------------------------------------
     
    115126  PRIMARY KEY (`Id`),
    116127  KEY `Employee` (`Employee`)
    117 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
     128) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
    118129
    119130-- --------------------------------------------------------
     
    127138  `Name` varchar(256) COLLATE utf8_czech_ci NOT NULL,
    128139  `Size` int(11) NOT NULL,
    129   PRIMARY KEY (`Id`)
    130 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;
     140  `Directory` int(11) DEFAULT NULL,
     141  PRIMARY KEY (`Id`),
     142  KEY `Directory` (`Directory`)
     143) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=6298 ;
     144
     145--
     146-- RELACE PRO TABULKU `File`:
     147--   `Directory`
     148--       `FileDirectory` -> `Id`
     149--
     150
     151-- --------------------------------------------------------
     152
     153--
     154-- Struktura tabulky `FileDirectory`
     155--
     156
     157CREATE TABLE IF NOT EXISTS `FileDirectory` (
     158  `Id` int(11) NOT NULL AUTO_INCREMENT,
     159  `Name` varchar(255) NOT NULL,
     160  `Parent` int(11) DEFAULT NULL,
     161  PRIMARY KEY (`Id`),
     162  KEY `Parent` (`Parent`)
     163) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
     164
     165--
     166-- RELACE PRO TABULKU `FileDirectory`:
     167--   `Parent`
     168--       `FileDirectory` -> `Id`
     169--
    131170
    132171-- --------------------------------------------------------
     
    184223
    185224--
    186 -- Struktura tabulky `FinanceBills`
    187 --
    188 
    189 CREATE TABLE IF NOT EXISTS `FinanceBills` (
     225-- Struktura tabulky `FinanceBillsItemsOld`
     226--
     227
     228CREATE TABLE IF NOT EXISTS `FinanceBillsItemsOld` (
     229  `Id` int(11) NOT NULL AUTO_INCREMENT,
     230  `Bill` int(11) NOT NULL DEFAULT '0',
     231  `Description` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     232  `Price` float NOT NULL DEFAULT '0',
     233  `Quantity` float NOT NULL DEFAULT '1',
     234  PRIMARY KEY (`Id`),
     235  KEY `Bill` (`Bill`)
     236) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=17839 ;
     237
     238--
     239-- RELACE PRO TABULKU `FinanceBillsItemsOld`:
     240--   `Bill`
     241--       `FinanceBillsOld` -> `Id`
     242--
     243
     244-- --------------------------------------------------------
     245
     246--
     247-- Struktura tabulky `FinanceBillsOld`
     248--
     249
     250CREATE TABLE IF NOT EXISTS `FinanceBillsOld` (
    190251  `Id` int(11) NOT NULL AUTO_INCREMENT,
    191252  `TimeFrom` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     
    204265
    205266--
    206 -- RELACE PRO TABULKU `FinanceBills`:
     267-- RELACE PRO TABULKU `FinanceBillsOld`:
    207268--   `Subject`
    208269--       `Subject` -> `Id`
    209 --
    210 
    211 -- --------------------------------------------------------
    212 
    213 --
    214 -- Struktura tabulky `FinanceBillsItems`
    215 --
    216 
    217 CREATE TABLE IF NOT EXISTS `FinanceBillsItems` (
    218   `Id` int(11) NOT NULL AUTO_INCREMENT,
    219   `Bill` int(11) NOT NULL DEFAULT '0',
    220   `Description` varchar(255) COLLATE utf8_czech_ci NOT NULL,
    221   `Price` float NOT NULL DEFAULT '0',
    222   `Quantity` float NOT NULL DEFAULT '1',
    223   PRIMARY KEY (`Id`),
    224   KEY `Bill` (`Bill`)
    225 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=17839 ;
    226 
    227 --
    228 -- RELACE PRO TABULKU `FinanceBillsItems`:
    229 --   `Bill`
    230 --       `FinanceBills` -> `Id`
    231270--
    232271
     
    252291
    253292--
    254 -- Struktura tabulky `FinanceClaimLiabilityItem`
    255 --
    256 
    257 CREATE TABLE IF NOT EXISTS `FinanceClaimLiabilityItem` (
    258   `Id` int(11) NOT NULL AUTO_INCREMENT,
    259   `FinanceClaimLiability` int(11) NOT NULL DEFAULT '0',
     293-- Struktura tabulky `FinanceGroup`
     294--
     295
     296CREATE TABLE IF NOT EXISTS `FinanceGroup` (
     297  `Id` int(11) NOT NULL AUTO_INCREMENT,
     298  `Description` varchar(128) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     299  PRIMARY KEY (`Id`)
     300) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=4 ;
     301
     302-- --------------------------------------------------------
     303
     304--
     305-- Struktura tabulky `FinanceInvoice`
     306--
     307
     308CREATE TABLE IF NOT EXISTS `FinanceInvoice` (
     309  `Id` int(11) NOT NULL AUTO_INCREMENT,
     310  `BillCode` varchar(16) COLLATE utf8_czech_ci NOT NULL,
     311  `Subject` int(11) NOT NULL DEFAULT '0',
     312  `TimeCreation` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     313  `TimeDue` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     314  `TimePayment` datetime DEFAULT NULL,
     315  `Value` float NOT NULL DEFAULT '0',
     316  `File` int(11) DEFAULT NULL,
     317  `Text` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     318  `PeriodTo` date DEFAULT NULL,
     319  `PeriodFrom` date DEFAULT NULL,
     320  PRIMARY KEY (`Id`),
     321  KEY `Subject` (`Subject`),
     322  KEY `Bill` (`File`)
     323) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=8773 ;
     324
     325--
     326-- RELACE PRO TABULKU `FinanceInvoice`:
     327--   `File`
     328--       `File` -> `Id`
     329--   `Subject`
     330--       `Subject` -> `Id`
     331--
     332
     333-- --------------------------------------------------------
     334
     335--
     336-- Struktura tabulky `FinanceInvoiceItem`
     337--
     338
     339CREATE TABLE IF NOT EXISTS `FinanceInvoiceItem` (
     340  `Id` int(11) NOT NULL AUTO_INCREMENT,
     341  `FinanceInvoice` int(11) NOT NULL DEFAULT '0',
    260342  `Description` varchar(255) COLLATE utf8_czech_ci NOT NULL,
    261343  `Price` float NOT NULL DEFAULT '0',
     
    263345  `Quantity` float NOT NULL DEFAULT '1',
    264346  PRIMARY KEY (`Id`),
    265   KEY `FinanceClaimLiability` (`FinanceClaimLiability`)
    266 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;
    267 
    268 --
    269 -- RELACE PRO TABULKU `FinanceClaimLiabilityItem`:
    270 --   `FinanceClaimLiability`
    271 --       `FinanceClaimsLiabilities` -> `Id`
    272 --
    273 
    274 -- --------------------------------------------------------
    275 
    276 --
    277 -- Struktura tabulky `FinanceClaimsLiabilities`
    278 --
    279 
    280 CREATE TABLE IF NOT EXISTS `FinanceClaimsLiabilities` (
    281   `Id` int(11) NOT NULL AUTO_INCREMENT,
    282   `BillCode` varchar(16) COLLATE utf8_czech_ci NOT NULL,
    283   `Subject` int(11) NOT NULL DEFAULT '0',
    284   `TimeCreation` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    285   `TimeDue` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    286   `TimePayment` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    287   `Value` float NOT NULL DEFAULT '0',
    288   `Bill` int(11) DEFAULT '0',
    289   `Text` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
    290   `PeriodTo` date DEFAULT NULL,
    291   `PeriodFrom` date DEFAULT NULL,
    292   PRIMARY KEY (`Id`),
    293   KEY `Subject` (`Subject`),
    294   KEY `Bill` (`Bill`)
    295 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=8770 ;
    296 
    297 --
    298 -- RELACE PRO TABULKU `FinanceClaimsLiabilities`:
    299 --   `Subject`
    300 --       `Subject` -> `Id`
    301 --
    302 
    303 -- --------------------------------------------------------
    304 
    305 --
    306 -- Struktura tabulky `FinanceGroup`
    307 --
    308 
    309 CREATE TABLE IF NOT EXISTS `FinanceGroup` (
    310   `Id` int(11) NOT NULL AUTO_INCREMENT,
    311   `Description` varchar(128) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
    312   PRIMARY KEY (`Id`)
    313 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=4 ;
     347  KEY `FinanceClaimLiability` (`FinanceInvoice`)
     348) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=8192 ;
     349
     350--
     351-- RELACE PRO TABULKU `FinanceInvoiceItem`:
     352--   `FinanceInvoice`
     353--       `FinanceInvoice` -> `Id`
     354--
    314355
    315356-- --------------------------------------------------------
     
    362403  `BillCode` varchar(32) COLLATE utf8_czech_ci DEFAULT NULL,
    363404  `Taxable` tinyint(1) NOT NULL DEFAULT '1',
    364   `Bill` int(11) DEFAULT NULL,
     405  `File` int(11) DEFAULT NULL,
    365406  `Text` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT 'Vklad',
    366407  `Network` int(11) NOT NULL DEFAULT '1',
     
    371412  UNIQUE KEY `BillCode_2` (`BillCode`),
    372413  KEY `Subject` (`Subject`),
    373   KEY `Bill` (`Bill`),
     414  KEY `Bill` (`File`),
    374415  KEY `BankAccount` (`BankAccount`),
    375416  KEY `Treasury` (`Treasury`)
    376 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=6543 ;
     417) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=6546 ;
    377418
    378419--
    379420-- RELACE PRO TABULKU `FinanceOperation`:
     421--   `File`
     422--       `File` -> `Id`
    380423--   `Subject`
    381424--       `Subject` -> `Id`
    382 --   `Bill`
    383 --       `FinanceBills` -> `Id`
    384425--   `BankAccount`
    385426--       `FinanceBankAccount` -> `Id`
    386427--   `Treasury`
    387428--       `FinanceTreasury` -> `Id`
    388 --
    389 
    390 -- --------------------------------------------------------
    391 
    392 --
    393 -- Struktura tabulky `FinanceOperationItem`
    394 --
    395 
    396 CREATE TABLE IF NOT EXISTS `FinanceOperationItem` (
    397   `Id` int(11) NOT NULL AUTO_INCREMENT,
    398   `FinanceOperation` int(11) NOT NULL DEFAULT '0',
    399   `Description` varchar(255) COLLATE utf8_czech_ci NOT NULL,
    400   `Price` float NOT NULL DEFAULT '0',
    401   `VAT` float NOT NULL DEFAULT '0',
    402   `Quantity` float NOT NULL DEFAULT '1',
    403   PRIMARY KEY (`Id`),
    404   KEY `FinanceOperation` (`FinanceOperation`)
    405 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;
    406 
    407 --
    408 -- RELACE PRO TABULKU `FinanceOperationItem`:
    409 --   `FinanceOperation`
    410 --       `FinanceOperation` -> `Id`
    411429--
    412430
     
    525543  PRIMARY KEY (`Id`),
    526544  KEY `Parent` (`Parent`)
    527 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=38 ;
     545) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=40 ;
    528546
    529547--
     
    561579  KEY `Time` (`Time`),
    562580  KEY `User` (`User`)
    563 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=41115 ;
     581) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=38283 ;
    564582
    565583--
     
    581599  `Longitude` double NOT NULL,
    582600  PRIMARY KEY (`Id`)
    583 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=260 ;
     601) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=767 ;
    584602
    585603-- --------------------------------------------------------
     
    636654  KEY `BillingPeriodNext` (`BillingPeriodNext`),
    637655  KEY `NetworkSegment` (`NetworkSegment`)
    638 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=200 ;
     656) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=201 ;
    639657
    640658--
     
    667685  PRIMARY KEY (`Id`),
    668686  KEY `Member` (`Member`)
    669 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=182 ;
     687) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=183 ;
    670688
    671689--
     
    787805  KEY `Type` (`Type`),
    788806  KEY `MapPosition` (`MapPosition`)
    789 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=644 ;
     807) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=645 ;
    790808
    791809--
     
    917935  KEY `Device` (`Device`),
    918936  KEY `Type` (`Type`)
    919 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=711 ;
     937) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=712 ;
    920938
    921939--
     
    956974  KEY `host_id` (`NetworkInterface`),
    957975  KEY `time` (`Time`)
    958 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
     976) ENGINE=MyISAM DEFAULT CHARSET=utf8;
    959977
    960978-- --------------------------------------------------------
     
    9871005  KEY `Interface1` (`Interface1`),
    9881006  KEY `Interface2` (`Interface2`)
    989 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=357 ;
     1007) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=356 ;
    9901008
    9911009--
    9921010-- RELACE PRO TABULKU `NetworkLink`:
     1011--   `Interface2`
     1012--       `NetworkInterface` -> `Id`
    9931013--   `Interface1`
    9941014--       `NetworkInterface` -> `Id`
    995 --   `Interface2`
    996 --       `NetworkInterface` -> `Id`
    9971015--
    9981016
     
    10211039  PRIMARY KEY (`Id`),
    10221040  KEY `Comment` (`Comment`)
    1023 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1422 ;
     1041) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1430 ;
    10241042
    10251043-- --------------------------------------------------------
     
    11191137  KEY `Link` (`Link`),
    11201138  KEY `User` (`User`)
    1121 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=973330 ;
     1139) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=973387 ;
    11221140
    11231141--
     
    12541272  KEY `AssignedGroup` (`AssignedGroup`),
    12551273  KEY `AssignedOperation` (`AssignedOperation`)
    1256 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=226 ;
     1274) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=227 ;
    12571275
    12581276--
     
    13041322  KEY `UnitOfMeasure` (`UnitOfMeasure`),
    13051323  KEY `Manufacturer` (`Manufacturer`)
    1306 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=180 ;
     1324) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=181 ;
    13071325
    13081326--
     
    13451363--
    13461364-- RELACE PRO TABULKU `Service`:
     1365--   `ReplaceId`
     1366--       `Service` -> `Id`
    13471367--   `Category`
    13481368--       `ServiceCategory` -> `Id`
    1349 --   `ReplaceId`
    1350 --       `Service` -> `Id`
    13511369--
    13521370
     
    13771395  KEY `Service` (`Service`),
    13781396  KEY `Customer` (`Customer`)
    1379 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=437 ;
     1397) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=511 ;
    13801398
    13811399--
    13821400-- RELACE PRO TABULKU `ServiceCustomerRel`:
     1401--   `Service`
     1402--       `Service` -> `Id`
    13831403--   `Customer`
    13841404--       `Member` -> `Id`
     
    14321452  KEY `Segment` (`Segment`),
    14331453  KEY `Location` (`Location`)
    1434 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=182 ;
     1454) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=186 ;
    14351455
    14361456--
     
    14621482  `DIC` varchar(32) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
    14631483  `PayVAT` int(11) NOT NULL,
    1464   `MapPositionX` float NOT NULL DEFAULT '0',
    1465   `MapPositionY` float NOT NULL DEFAULT '0',
     1484  `MapPosition` int(11) DEFAULT NULL,
    14661485  `WWW` varchar(255) COLLATE utf8_czech_ci NOT NULL,
    14671486  `Note` varchar(255) COLLATE utf8_czech_ci NOT NULL,
    14681487  PRIMARY KEY (`Id`),
    1469   KEY `AddressCountry` (`AddressCountry`)
    1470 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=231 ;
     1488  KEY `AddressCountry` (`AddressCountry`),
     1489  KEY `MapPosition` (`MapPosition`)
     1490) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=233 ;
    14711491
    14721492--
    14731493-- RELACE PRO TABULKU `Subject`:
     1494--   `MapPosition`
     1495--       `MapPosition` -> `Id`
    14741496--   `AddressCountry`
    14751497--       `Country` -> `Id`
     
    16631685  UNIQUE KEY `Name` (`Login`),
    16641686  UNIQUE KEY `Nick` (`Name`)
    1665 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=252 ;
     1687) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=253 ;
    16661688
    16671689-- --------------------------------------------------------
     
    16781700  KEY `Customer` (`Customer`),
    16791701  KEY `User` (`User`)
    1680 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=520 ;
     1702) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=521 ;
    16811703
    16821704--
     
    16961718CREATE TABLE IF NOT EXISTS `UserOnline` (
    16971719  `Id` int(11) NOT NULL AUTO_INCREMENT,
    1698   `User` int(11) NOT NULL DEFAULT '0' COMMENT 'User.Id',
     1720  `User` int(11) DEFAULT NULL COMMENT 'User.Id',
    16991721  `ActivityTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    17001722  `LoginTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     
    17051727  PRIMARY KEY (`Id`),
    17061728  KEY `User` (`User`)
    1707 ) ENGINE=MEMORY  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=2 ;
     1729) ENGINE=MEMORY  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=2430 ;
    17081730
    17091731-- --------------------------------------------------------
     
    17471769
    17481770--
     1771-- Omezení pro tabulku `File`
     1772--
     1773ALTER TABLE `File`
     1774  ADD CONSTRAINT `File_ibfk_1` FOREIGN KEY (`Directory`) REFERENCES `FileDirectory` (`Id`);
     1775
     1776--
     1777-- Omezení pro tabulku `FileDirectory`
     1778--
     1779ALTER TABLE `FileDirectory`
     1780  ADD CONSTRAINT `FileDirectory_ibfk_1` FOREIGN KEY (`Parent`) REFERENCES `FileDirectory` (`Id`);
     1781
     1782--
    17491783-- Omezení pro tabulku `FinanceBankAccount`
    17501784--
     
    17531787
    17541788--
    1755 -- Omezení pro tabulku `FinanceBills`
    1756 --
    1757 ALTER TABLE `FinanceBills`
    1758   ADD CONSTRAINT `FinanceBills_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`);
    1759 
    1760 --
    1761 -- Omezení pro tabulku `FinanceBillsItems`
    1762 --
    1763 ALTER TABLE `FinanceBillsItems`
    1764   ADD CONSTRAINT `FinanceBillsItems_ibfk_1` FOREIGN KEY (`Bill`) REFERENCES `FinanceBills` (`Id`);
    1765 
    1766 --
    1767 -- Omezení pro tabulku `FinanceClaimLiabilityItem`
    1768 --
    1769 ALTER TABLE `FinanceClaimLiabilityItem`
    1770   ADD CONSTRAINT `FinanceClaimLiabilityItem_ibfk_1` FOREIGN KEY (`FinanceClaimLiability`) REFERENCES `FinanceClaimsLiabilities` (`Id`);
    1771 
    1772 --
    1773 -- Omezení pro tabulku `FinanceClaimsLiabilities`
    1774 --
    1775 ALTER TABLE `FinanceClaimsLiabilities`
    1776   ADD CONSTRAINT `FinanceClaimsLiabilities_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`);
     1789-- Omezení pro tabulku `FinanceBillsItemsOld`
     1790--
     1791ALTER TABLE `FinanceBillsItemsOld`
     1792  ADD CONSTRAINT `FinanceBillsItemsOld_ibfk_1` FOREIGN KEY (`Bill`) REFERENCES `FinanceBillsOld` (`Id`);
     1793
     1794--
     1795-- Omezení pro tabulku `FinanceBillsOld`
     1796--
     1797ALTER TABLE `FinanceBillsOld`
     1798  ADD CONSTRAINT `FinanceBillsOld_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`);
     1799
     1800--
     1801-- Omezení pro tabulku `FinanceInvoice`
     1802--
     1803ALTER TABLE `FinanceInvoice`
     1804  ADD CONSTRAINT `FinanceInvoice_ibfk_2` FOREIGN KEY (`File`) REFERENCES `File` (`Id`),
     1805  ADD CONSTRAINT `FinanceInvoice_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`);
     1806
     1807--
     1808-- Omezení pro tabulku `FinanceInvoiceItem`
     1809--
     1810ALTER TABLE `FinanceInvoiceItem`
     1811  ADD CONSTRAINT `FinanceInvoiceItem_ibfk_1` FOREIGN KEY (`FinanceInvoice`) REFERENCES `FinanceInvoice` (`Id`);
    17771812
    17781813--
     
    17801815--
    17811816ALTER TABLE `FinanceOperation`
     1817  ADD CONSTRAINT `FinanceOperation_ibfk_5` FOREIGN KEY (`File`) REFERENCES `File` (`Id`),
    17821818  ADD CONSTRAINT `FinanceOperation_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`),
    1783   ADD CONSTRAINT `FinanceOperation_ibfk_2` FOREIGN KEY (`Bill`) REFERENCES `FinanceBills` (`Id`),
    17841819  ADD CONSTRAINT `FinanceOperation_ibfk_3` FOREIGN KEY (`BankAccount`) REFERENCES `FinanceBankAccount` (`Id`),
    17851820  ADD CONSTRAINT `FinanceOperation_ibfk_4` FOREIGN KEY (`Treasury`) REFERENCES `FinanceTreasury` (`Id`);
    1786 
    1787 --
    1788 -- Omezení pro tabulku `FinanceOperationItem`
    1789 --
    1790 ALTER TABLE `FinanceOperationItem`
    1791   ADD CONSTRAINT `FinanceOperationItem_ibfk_1` FOREIGN KEY (`FinanceOperation`) REFERENCES `FinanceOperation` (`Id`);
    17921821
    17931822--
     
    18681897--
    18691898ALTER TABLE `NetworkLink`
    1870   ADD CONSTRAINT `NetworkLink_ibfk_1` FOREIGN KEY (`Interface1`) REFERENCES `NetworkDevice` (`Id`),
    1871   ADD CONSTRAINT `NetworkLink_ibfk_2` FOREIGN KEY (`Interface1`) REFERENCES `NetworkInterface` (`Id`),
    1872   ADD CONSTRAINT `NetworkLink_ibfk_3` FOREIGN KEY (`Interface2`) REFERENCES `NetworkInterface` (`Id`);
     1899  ADD CONSTRAINT `NetworkLink_ibfk_2` FOREIGN KEY (`Interface2`) REFERENCES `NetworkInterface` (`Id`),
     1900  ADD CONSTRAINT `NetworkLink_ibfk_1` FOREIGN KEY (`Interface1`) REFERENCES `NetworkInterface` (`Id`);
    18731901
    18741902--
     
    19251953--
    19261954ALTER TABLE `Service`
    1927   ADD CONSTRAINT `Service_ibfk_1` FOREIGN KEY (`Category`) REFERENCES `ServiceCategory` (`Id`),
    1928   ADD CONSTRAINT `Service_ibfk_2` FOREIGN KEY (`ReplaceId`) REFERENCES `Service` (`Id`);
     1955  ADD CONSTRAINT `Service_ibfk_2` FOREIGN KEY (`ReplaceId`) REFERENCES `Service` (`Id`),
     1956  ADD CONSTRAINT `Service_ibfk_1` FOREIGN KEY (`Category`) REFERENCES `ServiceCategory` (`Id`);
    19291957
    19301958--
     
    19321960--
    19331961ALTER TABLE `ServiceCustomerRel`
     1962  ADD CONSTRAINT `ServiceCustomerRel_ibfk_3` FOREIGN KEY (`Service`) REFERENCES `Service` (`Id`),
    19341963  ADD CONSTRAINT `ServiceCustomerRel_ibfk_2` FOREIGN KEY (`Customer`) REFERENCES `Member` (`Id`);
    19351964
     
    19531982--
    19541983ALTER TABLE `Subject`
     1984  ADD CONSTRAINT `Subject_ibfk_2` FOREIGN KEY (`MapPosition`) REFERENCES `MapPosition` (`Id`),
    19551985  ADD CONSTRAINT `Subject_ibfk_1` FOREIGN KEY (`AddressCountry`) REFERENCES `Country` (`Id`);
    19561986
     
    19992029ALTER TABLE `Work`
    20002030  ADD CONSTRAINT `Work_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`),
    2001   ADD CONSTRAINT `Work_ibfk_2` FOREIGN KEY (`Task`) REFERENCES `Task` (`Id`);");
     2031  ADD CONSTRAINT `Work_ibfk_2` FOREIGN KEY (`Task`) REFERENCES `Task` (`Id`);
     2032      ");
    20022033  $Manager->Execute("INSERT INTO `SystemVersion` (`Id`, `Revision`) VALUES
    2003 (1, 491);");
     2034(1, 495);");
    20042035 
    20052036}
     
    20182049  $Manager->Execute("INSERT INTO `User` (`Id`, `Login`, `Name`, `Password`, `Salt`, `Email`, `LastIpAddress`, `LastLoginTime`, `RegistrationTime`, `Locked`, `ICQ`, `PhoneNumber`, `InitPassword`) VALUES
    20192050(1, 'admin', 'Správce', '05d97409afcce47d028c0d2a04cf359998cbaaf1', 'b295d117135a9763da282e7dae73a5ca7d3e5b11', 'admin@localhost', '', '0000-00-00 00:00:00', '2013-03-01 19:40:22', 0, 0, '+420123456789', '');");
    2020   $Manager->Execute("INSERT INTO `Subject` (`Id`, `Name`, `AddressStreet`, `AddressTown`, `AddressPSC`, `AddressCountry`, `IC`, `DIC`, `PayVAT`, `MapPositionX`, `MapPositionY`, `WWW`, `Note`) VALUES
    2021 (1, 'Franta Vopršálek', 'Na hradě 1001', 'Bouzov', 12345, 1, '12345667', 'CZ1234567890', 0, 1, 2, '', '');");
     2051  $Manager->Execute("INSERT INTO `MapPosition` (`Id`, `Name`, `Latitude`, `Longitude`) VALUES
     2052(1, 'Franta Vopršálek', 47.555, 11.082)");
     2053  $Manager->Execute("INSERT INTO `Subject` (`Id`, `Name`, `AddressStreet`, `AddressTown`, `AddressPSC`, `AddressCountry`, `IC`, `DIC`, `PayVAT`, `MapPosition`, `WWW`, `Note`) VALUES
     2054(1, 'Franta Vopršálek', 'Na hradě 1001', 'Bouzov', 12345, 1, '12345667', 'CZ1234567890', 0, 1, '', '');");
    20222055  $Manager->Execute("INSERT INTO `UnitOfMeasure` (`Id`, `Unit`, `Name`) VALUES
    20232056(1, 'ks', 'kus'),
     
    21862219(15, 'Kino Vatra', 0, 15, 1, 'http://www.dkvsetin.cz/rss/kino/8'),
    21872220(16, 'Obec Hovězí', 0, 16, 1, 'http://www.obec-hovezi.cz/web/rss.xml');");
    2188   $Manager->Execute("INSERT INTO `MapPosition` (`Id`, `Name`, `Latitude`, `Longitude`) VALUES
    2189 (1, 'Franta Vopršálek', 47.555, 11.082)");
    21902221  $Manager->Execute("INSERT INTO `FinanceBillingPeriod` (`Id`, `Name`, `MonthCount`) VALUES
    21912222(1, 'Nikdy', 0),
     
    23622393  $Manager->Execute("INSERT INTO `ServiceCustomerRel` (`Id`, `Service`, `Customer`, `Period`) VALUES
    23632394(1, 1, 1, 0), (2, 1, 1, 1);");
    2364   $Manager->Execute("INSERT INTO `File` (`Id` ,`Name` ,`Size` ,`Directory`) VALUES (NULL , 'invoice_1.pdf', '123', NULL);");
     2395  $Manager->Execute("INSERT INTO `File` (`Id` ,`Name` ,`Size` ,`Directory`) ".
     2396    "VALUES (1 , 'invoice_1.pdf', '123', NULL);");
    23652397  $Manager->Execute("INSERT INTO `FinanceInvoice` (`Id` ,`BillCode` ,`Subject` ,`TimeCreation` ,`TimeDue` ,`TimePayment` ,`Value` ,`File` ,`Text` ,`PeriodTo` ,`PeriodFrom`) ".
    23662398    "VALUES (1 , 'VF123/2013', '1', NOW( ) , '0000-00-00 00:00:00', NULL , '300', '1', 'Měsíční paušál', '2013-01-01', '2013-01-31');");
    23672399  $Manager->Execute("INSERT INTO `FinanceInvoiceItem` (`Id` ,`FinanceInvoice` ,`Description` ,`Price` ,`VAT` ,`Quantity`) ".
    2368      "VALUES (1 , '1', 'Internet 16M', '300', '21', '1');");
     2400    "VALUES (1 , '1', 'Internet 16M', '300', '21', '1');");
    23692401  $Manager->Execute("INSERT INTO `FinanceYear` (`Id`, `Year`, `DateStart`, `DateEnd`) VALUES
    23702402(1, 2007, '2007-12-01', '2007-12-31'),
     
    23782410(1, 10000, 100000, 10000, 50, 6, 1024, 50, 138),
    23792411(0, 10000, 100000, 10000, 50, 6, 1024, 50, 138);");
     2412  $Manager->Execute("INSERT INTO `DocumentLine` (`Id`, `Name`, `Shortcut`) VALUES
     2413(1, 'Příjmy do pokladny', 'PP'),
     2414(2, 'Výdeje z pokladny', 'VP'),
     2415(3, 'Příjem na účet', 'BV'),
     2416(4, 'Výdej z účtu', 'PR'),
     2417(5, 'Přijaté faktury', 'PF'),
     2418(6, 'Vydané faktury', 'VF'),
     2419(7, 'Výdej ze skladu', 'VS'),
     2420(8, 'Příjem na sklad', 'PS');");
    23802421}
    23812422
  • trunk/admin/Updates.php

    r495 r497  
    2424}
    2525
     26function UpdateTo497($Manager)
     27{
     28  $Manager->Execute("ALTER TABLE `FinanceCharge` ADD `Id` INT NOT NULL AUTO_INCREMENT FIRST , ADD PRIMARY KEY ( `Id` ) ");
     29  $Manager->Execute("ALTER TABLE `FinanceCharge` ADD `ReplaceId` INT NULL ,ADD INDEX ( `ReplaceId` ) ");
     30  $Manager->Execute("DELETE FROM `FinanceCharge` WHERE `FinanceCharge`.`Period` = 1");
     31  $Manager->Execute("ALTER TABLE `FinanceCharge` DROP `Period`");
     32  $Manager->Execute("ALTER TABLE `FinanceCharge` ADD `Action` ENUM( 'add', 'modify', 'remove' ) NULL AFTER `TopTariffPrice` ");
     33  $Manager->Execute("ALTER TABLE `FinanceCharge` ADD FOREIGN KEY ( `ReplaceId` ) REFERENCES `FinanceCharge` (".
     34    "`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;");
     35  $Manager->Execute("ALTER TABLE `FinanceCharge` ADD INDEX ( `Action` )");
     36  $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ".
     37    "VALUES (NULL , 'Parametry účtování', '2', 'FinanceCharge', '');");
     38  $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ".
     39    "VALUES (NULL , 'Úseky sítě', '2', 'NetworkSegment', ''");
     40  $Manager->Execute("ALTER TABLE `ServiceCustomerRel` ADD `Action` ENUM( 'add', 'modify', 'remove' ) NULL , ".
     41    "ADD `ReplaceId` INT NULL");
     42  $Manager->Execute("DELETE FROM `ServiceCustomerRel` WHERE `Period`=1");
     43  $Manager->Execute("ALTER TABLE `ServiceCustomerRel` DROP `Period`");
     44  $Manager->Execute("ALTER TABLE `ServiceCustomerRel` ADD INDEX ( `Action` )");
     45  $Manager->Execute("ALTER TABLE `ServiceCustomerRel` ADD INDEX ( `ReplaceId` ) ");
     46  $Manager->Execute("ALTER TABLE `ServiceCustomerRel` ADD FOREIGN KEY ( `ReplaceId` ) REFERENCES `ServiceCustomerRel` (".
     47    "`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;");
     48  $Manager->Execute("ALTER TABLE `Service` ADD `Action` ENUM( 'add', 'modify', 'remove' ) NULL AFTER `CustomerCount`");
     49  $Manager->Execute("ALTER TABLE `Service` ADD INDEX ( `Action` )");
     50  $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ".
     51    "VALUES (NULL , 'Placení zákazníků', '2', 'MemberPayment', '');");
     52}
     53
    2654$Updates = array(
    2755        491 => array('Revision' => 493, 'Function' => 'UpdateTo493'),
    2856  493 => array('Revision' => 494, 'Function' => 'UpdateTo494'),
    2957  494 => array('Revision' => 495, 'Function' => 'UpdateTo495'),
     58  495 => array('Revision' => 497, 'Function' => 'UpdateTo497'),
    3059);
    3160
  • trunk/finance/clenove.php

    r479 r497  
    1717      'Subject.Name, NetworkDevice, '.
    1818      '(SELECT GROUP_CONCAT(Service.Name) FROM ServiceCustomerRel LEFT JOIN Service '.
    19       'ON Service.Id=ServiceCustomerRel.Service WHERE ServiceCustomerRel.Customer=Member.Id AND ServiceCustomerRel.Period=0) AS ServicesCurrentMonth, '.
    20       '(SELECT GROUP_CONCAT(Service.Name) FROM ServiceCustomerRel LEFT JOIN Service '.
    21       'ON Service.Id=ServiceCustomerRel.Service WHERE ServiceCustomerRel.Customer=Member.Id AND ServiceCustomerRel.Period=1) AS ServicesNextMonth, '.
     19      'ON Service.Id=ServiceCustomerRel.Service WHERE ServiceCustomerRel.Customer=Member.Id AND '.
     20      'ServiceCustomerRel.Action IS NULL) AS ServicesCurrentMonth, '.
     21      //'(SELECT GROUP_CONCAT(Service.Name) FROM ServiceCustomerRel LEFT JOIN Service '.
     22      //'ON Service.Id=ServiceCustomerRel.Service WHERE ServiceCustomerRel.Customer=Member.Id AND '.
     23      //'ServiceCustomerRel.Period=1) AS ServicesNextMonth, '.
    2224      'User.Name AS FullName FROM MemberPayment LEFT JOIN Member ON '.
    2325      'Member.Id=MemberPayment.Member LEFT JOIN Subject ON Subject.Id=Member.Subject '.
     
    3638      array('Name' => 'Cash', 'Title' => 'Stav účtu [Kč]'),
    3739      array('Name' => 'ServicesCurrentMonth', 'Title' => 'Běžící tarif'),
    38       array('Name' => 'ServicesNextMonth', 'Title' => 'Příští tarif'),
     40      //array('Name' => 'ServicesNextMonth', 'Title' => 'Příští tarif'),
    3941      array('Name' => 'Note', 'Title' => 'Poznámky'),
    4042      array('Name' => 'WWW', 'Title' => 'WWW'),
     
    5557      if($Row['Cash'] < 0) $Row['Cash'] = '<span style="color: red;">'.$Row['Cash'].'</span>';
    5658      $Tarif = $Row['ServicesCurrentMonth'];
    57       $PristiTarif = $Row['ServicesNextMonth'];
     59      //$PristiTarif = $Row['ServicesNextMonth'];
    5860      $Output .= '<tr><td>'.$Row['FullName'].'</td><td><a href="user_state.php?Subject='.$Row['Id'].'">'.$Row['Name'].'</a></td>';
    5961      //<td align="right">'.$Row['network_device'].'</td>
    60       $Output .= '<td align="right">'.$Row['MonthlyTotal'].'</td><td align="right">'.$Row['Cash'].'</td><td align="center">'.$Tarif.'</td><td align="center">'.$PristiTarif.'</td><td>'.$Row['Note'].'</td><td>'.$Row['WWW'].'</td></tr>';
     62      $Output .= '<td align="right">'.$Row['MonthlyTotal'].'</td><td align="right">'.$Row['Cash'].'</td>'.
     63      '<td align="center">'.$Tarif.'</td>'.
     64      //'<td align="center">'.$PristiTarif.'</td>'.
     65      '<td>'.$Row['Note'].'</td><td>'.$Row['WWW'].'</td></tr>';
    6166      $TotalDevice += $Row['NetworkDevice'];
    6267      $TotalMonth += ($Row['MonthlyTotal']);
     
    6469    $Output .= '<tr><td><strong>Celkem</strong></td><td>&nbsp;</td>';
    6570    //<td align="right"><strong>'.$TotalDevice.'</strong></td>
    66     $Output .= '<td align="right"><strong>'.$TotalMonth.'</strong></td><td align="right"><strong>'.$TotalCash.'</strong></td><td align="right">&nbsp;</td><td align="right">&nbsp;</td><td align="right">&nbsp;</td><td align="right">&nbsp;</td></tr>';
     71    $Output .= '<td align="right"><strong>'.$TotalMonth.'</strong></td>'.
     72    '<td align="right"><strong>'.$TotalCash.'</strong></td><td align="right">&nbsp;</td>'.
     73    //'<td align="right">&nbsp;</td>'.
     74    '<td align="right">&nbsp;</td><td align="right">&nbsp;</td></tr>';
    6775    $Output .= '</table>';
    6876    $Output .= $PageList['Output'];
  • trunk/finance/finance.php

    r494 r497  
    5454      $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Member` '.
    5555        'LEFT JOIN `ServiceCustomerRel` ON `ServiceCustomerRel`.`Customer`=`Member`.`Id` '.
    56         'WHERE (`ServiceCustomerRel`.`Service`='.$Index.') AND (`Member`.`BillingPeriod` > 1) AND (`Member`.`Blocked`=0)');
     56        'WHERE (`ServiceCustomerRel`.`Service`='.$Index.') AND (`Member`.`BillingPeriod` > 1) '.
     57        'AND (`Member`.`Blocked`=0)');
    5758      $Row = $DbResult->fetch_row();
    5859      $this->Tariffs[$Index]['CustomerCount'] = $Row[0];
     
    103104      $this->BillingPeriods[$BillingPeriod['Id']] = $BillingPeriod;
    104105   
    105     $DbResult = $this->Database->query('SELECT * FROM `FinanceCharge` WHERE `Period`='.$Period);
     106    // Period parameter is not used as it have to be determined from item replacement
     107    $DbResult = $this->Database->query('SELECT * FROM `FinanceCharge` WHERE `ReplaceId` IS NULL LIMIT 1');
    106108    $Row = $DbResult->fetch_array();
    107109    $this->kWh = $Row['kWh'];
     
    203205         'FROM `ServiceCustomerRel` LEFT JOIN '.
    204206         '`Service` ON `Service`.`Id` = `ServiceCustomerRel`.`Service` WHERE `ServiceCustomerRel`.`Customer`='.
    205          $Member['Id'].' AND `ServiceCustomerRel`.`Period`=1');
     207         $Member['Id'].' AND `ServiceCustomerRel`.`Action` IS NULL');
    206208      $DbRow = $DbResult2->fetch_assoc();     
    207209      $Monthly = 0;
     
    259261        $DbResult2 = $this->Database->query('SELECT * FROM NetworkSegment WHERE Id='.$ID);
    260262        $Row4 = $DbResult2->fetch_array();
    261         $this->Database->update('NetworkSegment', 'Id='.$Row4['Id'], array('Users' => ($Row4['Users'] + $Row3[0]), 'UsersOverheads' => ($Row4['UsersOverheads'] + $Row3[0])));
     263        $this->Database->update('NetworkSegment', 'Id='.$Row4['Id'],
     264          array('Users' => ($Row4['Users'] + $Row3[0]), 'UsersOverheads' => ($Row4['UsersOverheads'] + $Row3[0])));
    262265        $ID = $Row4['Parent'];
    263266      }
    264       $this->Database->update('NetworkSegment', 'Id='.$NetworkSegment['Id'], array('Price' => $Row2['Price'], 'Users' => ($Row3[0] + $RowP['Users']), 'Consumption' => $Row2['Consumption'], 'UsersOverheads' => ($Row3[0] + $RowP2['UsersOverheads'])));
     267      $this->Database->update('NetworkSegment', 'Id='.$NetworkSegment['Id'],
     268        array('Price' => $Row2['Price'], 'Users' => ($Row3[0] + $RowP['Users']), 'Consumption' => $Row2['Consumption'], 'UsersOverheads' => ($Row3[0] + $RowP2['UsersOverheads'])));
    265269    }
    266270
     
    268272    $DbResult = $this->Database->select('Member', 'COUNT(*)');
    269273    $Row = $DbResult->fetch_array();
    270     $DbResult = $this->Database->update('NetworkSegment', 'Id='.$this->InternetSegmentId, array('Users' => $Row[0], 'UsersOverheads' => $Row[0]));
     274    $DbResult = $this->Database->update('NetworkSegment', 'Id='.$this->InternetSegmentId,
     275      array('Users' => $Row[0], 'UsersOverheads' => $Row[0]));
    271276    $this->System->Modules['Log']->NewRecord('Finance', 'RecalculateSegmentParameters');
    272277    return($Output);
  • trunk/finance/manage.php

    r486 r497  
    7171        $Output .= '<a href="?Operation=ConvertPDFToFile">Převést data z databáze do souborů</a><br />';
    7272        $Output .= '<a href="?Operation=Bills">Správa dokladů</a><br />';
    73         $Output .= '<a href="?Operation=Recalculate">Přepočet financí</a><br />';
     73        //$Output .= '<a href="?Operation=Recalculate">Přepočet financí</a><br />';
    7474        $Output .= '<a href="?Operation=ShowMonthlyPayment">Měsíční vyúčtování</a><br />';
    75         $Output .= '<a href="clenove.php">Seznam členů</a><br />';
     75        //$Output .= '<a href="clenove.php">Seznam členů</a><br />';
    7676        $Output .= '<a href="zivnost.php">Živnost</a><br />';
    7777        $Output .= '<a href="?Operation=GenerateBills">Generovat chybějící doklady</a><br />';
     
    135135      $DbResult = $this->Database->select('FinanceInvoice', '*', 'Subject='.$Subject.
    136136      ' AND TimePayment IS NULL AND Value > 0 ORDER BY TimeCreation LIMIT 1');
    137       //echo($Database->error);
    138137      if($DbResult->num_rows > 0)
    139138      {
     
    147146            'TimeCreation' => TimeToMysqlDateTime($LastInsertTime),
    148147            'CashFlowId' => $OpenedClaim['Id'], 'Direction' => 'In'));
    149           //echo($Database->LastQuery);
    150148        } else break;
    151149      } else break;
     
    153151  }
    154152
    155   function InsertLiability($Subject, $Value, $TimeCreation, $TimeDue, $Text,
     153  function InsertInvoice($Subject, $TimeCreation, $TimeDue, $Items,
    156154    $DocumentLine, $PeriodFrom, $PeriodTo)
    157155  {
     
    159157
    160158    $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine);
     159    $SumValue = 0;
     160    foreach($Items as $Item)
     161      $SumValue = $SumValue + $Item['Price'];
    161162    $this->Database->insert('FinanceInvoice', array(
    162163      'Subject' => $Subject, 'TimeCreation' => TimeToMysqlDateTime($TimeCreation),
    163       'TimeDue' => TimeToMysqlDateTime($TimeDue), 'Value' => $Value, 'BillCode' => $BillCode,
     164      'TimeDue' => TimeToMysqlDateTime($TimeDue), 'Value' => $SumValue, 'BillCode' => $BillCode,
    164165      'PeriodFrom' => TimeToMysqlDate($PeriodFrom), 'PeriodTo' => TimeToMysqlDate($PeriodTo)));
    165166    $InvoiceId = $this->Database->insert_id;
    166     $this->Database->insert('FinanceInvoice', array('FinanceInvoice' => $InvoiceId,
    167       'Description' => $Text, 'Price' => $Value, 'Quantity' => 1, 'VAT' => 0));
    168     $Output = '.'; //$this->Database->LastQuery.'<br />';
     167    foreach($Items as $Item)
     168    $this->Database->insert('FinanceInvoiceItem', array('FinanceInvoice' => $InvoiceId,
     169      'Description' => $Item['Description'], 'Price' => $Item['Price'], 'Quantity' => $Item['Quantity'], 'VAT' => $Item['VAT']));
    169170    //$LastInsertTime = $Time;
    170171    //$this->CheckAdvancesAndLiabilities($Subject);
    171     return($Output);
     172    return($InvoiceId);
    172173  }
    173174
     
    256257    $Form = new Form('NewInvoice');
    257258    $Form->LoadvaluesFromForm();
    258     //print_r($Form->Values);
    259     $this->InsertLiability($Form->Values['Subject'], $Form->Values['Value'],
    260       $Form->Values['TimeCreation'], $Form->Values['TimeDue'], $Form->Values['Text'],
     259    $Items = array(array('Price' => $Form->Values['Value'],
     260      'Description' => $Form->Values['Text'], 'Quantity' => 1, 'VAT' => 21));
     261    $LastId = $this->InsertInvoice($Form->Values['Subject'], 
     262      $Form->Values['TimeCreation'], $Form->Values['TimeDue'], $Items,
    261263      $Form->Values['DocumentLine'], NULL, NULL);
    262     $LastId = $this->Database->insert_id;
    263264    $DbResult = $this->Database->select('FinanceInvoice', 'BillCode', 'Id='.$LastId);
    264265    $DbRow = $DbResult->fetch_assoc();
     
    304305      'MemberPayment.Cash AS Cash, '.
    305306      '(SELECT GROUP_CONCAT(Service.Name) FROM ServiceCustomerRel LEFT JOIN Service '.
    306       'ON Service.Id=ServiceCustomerRel.Service WHERE ServiceCustomerRel.Customer=Member.Id AND ServiceCustomerRel.Period=1) AS ServicesNextMonth, '.
     307      'ON Service.Id=ServiceCustomerRel.Service WHERE ServiceCustomerRel.Customer=Member.Id AND '.
     308      'ServiceCustomerRel.Action IS NULL) AS ServicesNextMonth, '.
    307309      'UNIX_TIMESTAMP(Member.BillingPeriodLastDate) AS LastDate, Subject.Name AS SubjectName, '.
    308310      'FinanceBillingPeriod.Name AS BillingPeriodName '.
     
    350352  }
    351353 
     354  function ProduceInvoices()
     355  {
     356    $Output = '';
     357   
     358    // Generuj účetní položky
     359    $DbResult = $this->Database->query('SELECT Member.*, MemberPayment.MonthlyTotal, UNIX_TIMESTAMP(Member.BillingPeriodLastDate), Subject.Name AS SubjectName FROM MemberPayment JOIN Member ON Member.Id=MemberPayment.Member JOIN Subject ON Subject.Id=Member.Subject');
     360    while($Member = $DbResult->fetch_assoc())
     361    {
     362      $Output .= $Member['SubjectName'].': ';
     363      $Period = $this->GetBillingPeriod($Member['BillingPeriodNext']);
     364      if($Period['From'] > $Member['UNIX_TIMESTAMP(Member.BillingPeriodLastDate)'])
     365      {
     366        $this->Database->update('Member', 'Id='.$Member['Id'],
     367            array('BillingPeriod' => $Member['BillingPeriodNext']));
     368        $Member['BillingPeriod'] = $Member['BillingPeriodNext'];
     369      }
     370      $Period = $this->GetBillingPeriod($Member['BillingPeriod']);
     371      if(($Period['From'] > $Member['UNIX_TIMESTAMP(Member.BillingPeriodLastDate)']) and
     372          ($Member['Blocked'] == 0))
     373      {
     374        $InvoiceItems = array();
     375        $MonthlyTotal = 0;
     376        $DbResult2 = $this->Database->query('SELECT Service.* FROM ServiceCustomerRel LEFT JOIN Service '.
     377          'ON Service.Id=ServiceCustomerRel.Service WHERE (ServiceCustomerRel.Customer='.
     378          $Member['Id'].') AND (ServiceCustomerRel.Action IS NULL)');
     379        while($Service = $DbResult2->fetch_assoc())
     380        {
     381          $InvoiceItems[] = array('Description' => $Service['Name'], 'Price' => $Service['Price'],
     382              'Quantity' => $Period['MonthCount'], 'VAT' => 21);
     383          $MonthlyTotal += $Service['Price'];
     384        }
     385        if($Member['Hire'] != 0)
     386        {
     387          $Output .= '<tr><td>Nájem</td><td>'.(-$Member['Hire']).'</td></tr>';
     388          $MonthlyTotal -= $Member['Hire'];
     389        }
     390        if($Member['MonthlyPlus'] != 0)
     391        {
     392          $MonthlyTotal -= $Member['MonthlyPlus'];
     393        }
     394        $PayPerPeriod = $MonthlyTotal * $Period['MonthCount'];
     395   
     396        $TimePeriodText = date('j.n.Y', $Period['From']).' - '.date('j.n.Y', $Period['To']);
     397        $Output .= $TimePeriodText.': '.$MonthlyTotal.' * '.$Period['MonthCount'].' = '.$PayPerPeriod.'<br />';
     398        $this->InsertInvoice($Member['Subject'], 'NOW()', 'DATE_ADD(NOW(), INTERVAL '.INVOICE_DUE_DAYS.' DAY)',
     399          $InvoiceItems, INVOICE_OUT_DOC_LINE, $Period['From'], $Period['To']);
     400   
     401        $Output .= $this->SendPaymentEmail($Member['Id']);
     402        $this->Database->update('Member', 'Id='.$Member['Id'], array('BillingPeriodLastDate' => TimeToMysqlDateTime($Period['To'])));
     403      } else $Output .= '<br />';
     404    } 
     405    return($Output);
     406  }
     407 
     408  function TableUpdatePeriod($Table)
     409  {
     410    $DbResult = $this->Database->select($Table, '*', '`Action` IS NOT NULL');
     411    while($Service = $DbResult->fetch_array())
     412    {
     413      if($Service['Action'] == 'add')
     414      {
     415        unset($Service['Id']);
     416        unset($Serivce['ReplaceId']);
     417        unset($Serivce['Action']);
     418        $this->Database->insert($Table, $Service);
     419      } else
     420      if($Service['Action'] == 'modify')
     421      {
     422        unset($Service['Id']);
     423        unset($Service['Action']);
     424        $ReplaceId = $Service['ReplaceId'];
     425        unset($Service['ReplaceId']);
     426        $this->Database->update($Table, 'Id='.$ReplaceId, $Service);
     427      } else
     428      if($Service['Action'] == 'delete')
     429      {
     430        $this->Database->delete($Table, '`Id`='.$Service['ReplaceId']);
     431      }
     432    }
     433    $this->Database->delete($Table, '`Action` IS NOT NULL');
     434  } 
     435 
    352436  function ProcessMonthlyPayment()
    353437  {
     
    363447    $Output -= 'Datum: '.date('j.n.Y').'<br />';
    364448   
    365     $Datum = explode('-', $Overall['Date']);
    366     $Mesic = date('m') + 0;
     449    $DateParts = explode('-', $Overall['Date']);
     450    $MonthLast = $DateParts[1];
     451    $MonthCurrent = date('m') + 0;
    367452
    368453    $Output .= $Finance->RecalculateSegmentParameters();
     
    402487
    403488    // Zkontrolovat odečtení měsíčního poplatku
    404     //$Mesic = '1';
    405     $Output .= 'Kontrola odečtení poplatků: Poslední měsíc-'.round($Datum[1]).' Aktuální měsíc-'.$Mesic.'<br />';
    406     if($Mesic != $Datum[1])
     489    $Output .= 'Kontrola odečtení poplatků: Poslední měsíc-'.$MonthLast.' Aktuální měsíc-'.$MonthCurrent.'<br />';
     490    //if($MonthCurrent != $MonthLast)
    407491    {
    408492      $Output .= 'Odečítám měsíční poplatek...<br />';
    409 
    410       // Generuj účetní položky
    411       $DbResult = $this->Database->query('SELECT Member.*, MemberPayment.MonthlyTotal, UNIX_TIMESTAMP(Member.BillingPeriodLastDate), Subject.Name AS SubjectName FROM MemberPayment JOIN Member ON Member.Id=MemberPayment.Member JOIN Subject ON Subject.Id=Member.Subject');
    412       while($Member = $DbResult->fetch_assoc())
    413       {
    414         $Output .= $Member['SubjectName'].': ';
    415         //$Member['UNIX_TIMESTAMP(Member.BillingPeriodLastDate)'] = MysqlDateTimeToTime('2009-04-01 1:1:1');
    416         $Period = $this->GetBillingPeriod($Member['BillingPeriodNext']);
    417         if($Period['From'] > $Member['UNIX_TIMESTAMP(Member.BillingPeriodLastDate)'])
    418         {
    419           $this->Database->update('Member', 'Id='.$Member['Id'],
    420             array('BillingPeriod' => $Member['BillingPeriodNext']));
    421           $Member['BillingPeriod'] = $Member['BillingPeriodNext'];
    422         }
    423         $Period = $this->GetBillingPeriod($Member['BillingPeriod']);
    424         if(($Period['From'] > $Member['UNIX_TIMESTAMP(Member.BillingPeriodLastDate)']) and ($Member['InternetTariffCurrentMonth'] != TARIFF_FREE) and ($PayPerPeriod > 0) and
    425         ($Member['Blocked'] == 0))
    426         {
    427           $BillItems = array();
    428           $MonthlyTotal = 0;
    429           $DbResult2 = $this->Database->query('(SELECT Service.* FROM ServiceCustomerRel LEFT JOIN Service '.
    430             'ON Service.Id=ServiceCustomerRel.Service WHERE ServiceCustomerRel.Customer='.$Member['Id'].') AND (ServiceCustomerRel.Period=0)');
    431           while($Service = $DbResult2->fetch_assoc())
    432           {
    433             $BillItems[] = array('Description' => $Service['Name'], 'Price' => $Service['Price'],
    434             'Quantity' => $Period['MonthCount']);
    435             $MonthlyTotal += $ServicePrice['Price'];
    436             $this->Database->update('ServiceCustomerRel', 'Id='); 
    437           }
    438           if($Member['Hire'] != 0)
    439           {
    440             $Output .= '<tr><td>Nájem</td><td>'.(-$Member['Hire']).'</td></tr>';
    441             $MonthlyTotal -= $Member['Hire'];
    442           }
    443           if($Member['MonthlyPlus'] != 0)
    444           {
    445             $MonthlyTotal -= $Member['MonthlyPlus'];
    446           }
    447           $PayPerPeriod = $MonthlyTotal * $Period['MonthCount'];
    448    
    449 //echo($Mesic.'%'.$MonthCount.'='.($Mesic % $MonthCount).' ');                 
    450           $TimePeriodText = date('j.n.Y', $Period['From']).' - '.date('j.n.Y', $Period['To']);
    451           $Output .= $TimePeriodText.': '.$MonthlyTotal.' * '.$Period['MonthCount'].' = '.$PayPerPeriod.'<br />';
    452           $BillCode = $Finance->GetNextDocumentLineNumber(INVOICE_OUT_DOC_LINE);
    453           $BillId = $this->System->Modules['Bill']->CreateBill($Member['Subject'],
    454             $BillItems, time(), time() + 3600 * 24 * INVOICE_DUE_DAYS, $BillCode, $Period['From'], $Period['To']);
    455           $this->Database->insert('FinanceInvoice', array(
    456             'Subject' => $Member['Subject'], 'TimeCreation' => 'NOW()',
    457             'TimeDue' => 'DATE_ADD(NOW(), INTERVAL '.INVOICE_DUE_DAYS.' DAY)',             
    458             'Bill' => $BillId, 'BillCode' => $BillCode));
    459           $InvoiceId = $this->Database->insert_id;
    460           $this->Database->insert('FinanceInvoiceItem', array('FinanceInvoice' => $InvoiceId,
    461             'Value' => $PayPerPeriod, 'Text' => 'Vyúčtování služeb za období '.$TimePeriodText,
    462            'Quantity' => 1, 'VAT' => 0));
    463          
    464           $Output .= $this->SendPaymentEmail($Member['Id']);
    465           $this->Database->update('Member', 'Id='.$Member['Id'], array('BillingPeriodLastDate' => TimeToMysqlDateTime($Period['To'])));
    466         } else $Output .= '<br />';
    467       }
     493      $this->ProduceInvoices();   
    468494     
    469495      // Update finance charge
    470496      $Output .= 'Měním aktuální parametry sítě...<br>';
    471       $this->Database->delete('FinanceCharge', 'Period = 0');
    472       $DbResult = $this->Database->select('FinanceCharge', '*', 'Period = 1');
    473       $Charge = $DbResult->fetch_assoc();
    474       //print_r($Charge);
    475       $DbResult = $this->Database->insert('FinanceCharge', array('Period' => 0, 'Internet' => $Charge['Internet'], 'InternetSpeed' => $Charge['InternetSpeed'], 'InternetSpeedReserve' => $Charge['InternetSpeedReserve'], 'AdministrationPerUser' => $Charge['AdministrationPerUser'], 'kWh' => $Charge['kWh'], 'BaseSpeedElement' => $Charge['BaseSpeedElement'], 'BaseTariffPrice' => $Charge['BaseTariffPrice'], 'TopTariffPrice' => $Charge['TopTariffPrice']));
     497      $this->TableUpdatePeriod('FinanceCharge');
    476498
    477499      $Output .= 'Přidávám měsíční přehled...<br />';
    478       $this->Database->insert('FinanceMonthlyOverall', array('Date' => 'NOW()', 'Money' => $Finance->Internet, 'kWh' => $Finance->kWh, 'Administration' => $Finance->Sprava, 'AdministrationTotal' => $SpravaCelkem, 'ConsumptionTotal' => $TotalConsumptionCost, 'TotalPaid' => $Finance->TotalPaid, 'BaseTariffPrice' => $Charge['BaseTariffPrice'], 'TopTariffPrice' => $Charge['TopTariffPrice'], 'MemberCount' => $Finance->InternetUsers));
     500      $this->Database->insert('FinanceMonthlyOverall', array('Date' => 'NOW()',
     501        'Money' => $Finance->Internet, 'kWh' => $Finance->kWh,
     502        'Administration' => $Finance->Sprava, 'AdministrationTotal' => $SpravaCelkem,
     503        'ConsumptionTotal' => $TotalConsumptionCost, 'TotalPaid' => $Finance->TotalPaid,
     504        'BaseTariffPrice' => $Charge['BaseTariffPrice'],
     505        'TopTariffPrice' => $Charge['TopTariffPrice'], 'MemberCount' => $Finance->InternetUsers));
    479506
    480507      // Update services
    481       $Output .= 'Měním aktuální tarify....<br>';
    482       $DbResult = $this->Database->select('Service', '*', '`ReplaceId` IS NOT NULL');
    483       while($Service = $DbResult->fetch_array())
    484       {
    485         $Service['Id'] = $Service['ReplaceId'];
    486         $Service['ReplaceId'] = '';
    487         $this->Database->update('Service', 'Id='.$Service['ReplaceId'], $Service);
    488       }
    489       $this->Database->delete('Service', '`ReplaceId` IS NOT NULL');
    490 
     508      $Output .= 'Aktualizuji služby....<br>';
     509      $this->TableUpdatePeriod('Service');   
     510      // Update customer service selections
     511      $Output .= 'Aktualizuji výběr služeb zákazníků....<br>';
     512      $this->TableUpdatePeriod('ServiceCustomerRel');     
     513     
    491514      $Finance->RecalculateMemberPayment();
    492515      //CreateMonthlyOverallBill();
  • trunk/form_classes.php

    r496 r497  
    1414*/
    1515
    16 
    1716$FormClasses = array(   
     17  'MemberPayment' => array(
     18    'Title' => 'Placení zákazníků',
     19    'Table' => 'MemberPayment',
     20    'Items' => array(
     21      'Member' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => '', 'ReadOnly' => true),
     22      'MonthlyTotal' => array('Type' => 'Integer', 'Caption' => 'Celkem měsíčně', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true),
     23      'MonthlyInternet' => array('Type' => 'Integer', 'Caption' => 'Internet měsíčně', 'Default' => '', 'Suffix' => 'Kč', 'ReadOnly' => true),
     24      'MonthlyConsumption' => array('Type' => 'Integer', 'Caption' => 'Spotřeba měsíčně', 'Default' => '', 'Suffix' => 'Kč', 'ReadOnly' => true),
     25      'NetworkDevice' => array('Type' => 'Integer', 'Caption' => 'Podíl na zařízení', 'Default' => '', 'Suffix' => 'Kč', 'ReadOnly' => true),
     26      'MonthlyPlus' => array('Type' => 'Integer', 'Caption' => 'Měsíčně plus', 'Default' => '', 'Suffix' => 'Kč', 'ReadOnly' => true),
     27      'Cash' => array('Type' => 'Integer', 'Caption' => 'Kredit', 'Default' => '', 'Suffix' => 'Kč', 'ReadOnly' => true),
     28    ),
     29    'Actions' => array(
     30      array('Caption' => 'Přepočítat', 'URL' => '/finance/manage.php?Operation=Recalculate'),
     31    ),
     32  ),
     33  'NetworkSegment' => array(
     34    'Title' => 'Úsek sítě',
     35    'Table' => 'NetworkSegment',
     36    'Items' => array(
     37      'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
     38      'Price' => array('Type' => 'Integer', 'Caption' => 'Cena', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true),
     39      'Parent' => array('Type' => 'TNetworkSegment', 'Caption' => 'Nadřazený', 'Default' => '', 'Null' => true),
     40      'Users' => array('Type' => 'Integer', 'Caption' => 'Uživatelů', 'Default' => '0', 'ReadOnly' => true),
     41      'Consumption' => array('Type' => 'Integer', 'Caption' => 'Spotřeba', 'Default' => '0', 'ReadOnly' => true, 'Suffix' => 'Wattů'),
     42      'UsersOverheads' => array('Type' => 'Integer', 'Caption' => 'Podílníků', 'Default' => '0', 'ReadOnly' => true),
     43    ),
     44  ),
     45  'FinanceCharge' => array(
     46    'Title' => 'Parametry účtování',
     47    'Table' => 'FinanceCharge',
     48    'Items' => array(
     49      'Internet' => array('Type' => 'Integer', 'Caption' => 'Platba Internetu', 'Default' => '0', 'Suffix' => 'Kč'),
     50      'InternetSpeed' => array('Type' => 'Integer', 'Caption' => 'Rychlost Internetu', 'Default' => '0', 'Suffix' => 'Mbit/s'),
     51      'InternetSpeedReserve' => array('Type' => 'Integer', 'Caption' => 'Rezerva rychlosti', 'Default' => '0', 'Suffix' => 'Mbit/s'),
     52      'AdministrationPerUser' => array('Type' => 'Integer', 'Caption' => 'Správa za uživatele', 'Default' => '0', 'Suffix' => 'Kč'),
     53      'kWh' => array('Type' => 'Integer', 'Caption' => 'Cena kWh', 'Default' => '0', 'Suffix' => 'Kč'),
     54      'BaseSpeedElement' => array('Type' => 'Integer', 'Caption' => 'Základní díl rychlosti', 'Default' => '0', 'Suffix' => 'Mbit/s'),
     55      'BaseTariffPrice' => array('Type' => 'Integer', 'Caption' => 'Základní cena tarifu', 'Default' => '0', 'Suffix' => 'Kč'),
     56      'TopTariffPrice' => array('Type' => 'Integer', 'Caption' => 'Nejvyšší cena tarifu', 'Default' => '0', 'Suffix' => 'Kč'),
     57      'Action' => array('Type' => 'TActionEnum', 'Caption' => 'Změna období', 'Default' => ''),       
     58      'ReplaceId' => array('Type' => 'TFinanceCharge', 'Caption' => 'Cílová položka', 'Default' => '0', 'Null' => true),
     59    ),
     60  ),
    1861  'File' => array(
    1962    'Title' => 'Soubor',
     
    94137      'Service' => array('Type' => 'TService', 'Caption' => 'Služba', 'Default' => ''),       
    95138      'Customer' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => ''),       
    96       'Period' => array('Type' => 'Integer', 'Caption' => 'Období', 'Default' => ''),       
     139      'Action' => array('Type' => 'TActionEnum', 'Caption' => 'Změna období', 'Default' => ''),       
     140      'ReplaceId' => array('Type' => 'TServiceCustomerRel', 'Caption' => 'Cílová položka', 'Default' => '', 'Null' => true),       
    97141    ),
    98142  ),
     
    309353      'Storage' => array('Type' => 'Integer', 'Caption' => 'Úložiště', 'Default' => '0', 'Suffix' => 'GB'),
    310354      'CPUCount' => array('Type' => 'Integer', 'Caption' => 'Počet jader', 'Default' => '0', 'Suffix' => ''),
    311       'ReplaceId' => array('Type' => 'TService', 'Caption' => 'Nahradit', 'Default' => '', 'Null' => true),
     355      'Action' => array('Type' => 'TActionEnum', 'Caption' => 'Změna období', 'Default' => ''),       
     356      'ReplaceId' => array('Type' => 'TService', 'Caption' => 'Cílová položka', 'Default' => '', 'Null' => true),
    312357    ),
    313358  ),
     
    536581  ),
    537582  'FinanceInvoice' => array(
    538     'Title' => 'Závazky a pohledávky',
     583    'Title' => 'Faktury',
    539584    'Table' => 'FinanceInvoice',
    540585    'DefaultSortColumn' => 'TimeCreation',
     
    556601      'FinanceInvoice' => array('Type' => 'TFinanceInvoice', 'Caption' => 'Faktura', 'Default' => '0'),
    557602      'Description' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => 'Položka'),
    558       'Price' => array('Type' => 'Float', 'Caption' => 'Částka [Kč]', 'Default' => '0', 'Suffix' => 'Kč'),
     603      'Price' => array('Type' => 'Float', 'Caption' => 'Částka', 'Default' => '0', 'Suffix' => 'Kč'),
    559604      'Quantity' => array('Type' => 'Integer', 'Caption' => 'Množství', 'Default' => '1'),
    560       'VAT' => array('Type' => 'Integer', 'Caption' => 'Daň [%]', 'Default' => '19', 'Suffix' => '%'),
     605      'VAT' => array('Type' => 'Integer', 'Caption' => 'Daň', 'Default' => '19', 'Suffix' => '%'),
    561606    ),
    562607  ),
     
    720765    'States' => array('Zakoupeno', 'Prodáno', 'Zařazeno do použití', 'Vyřazeno z použití', 'Zasláno do reklamace', 'Přijato z reklamace'),
    721766  ),
     767  'TActionEnum' => array(
     768    'Type' => 'Enumeration',
     769    'States' => array('' => '', 'add' => 'Přidat', 'modify' => 'Upravit', 'remove' => 'Odstranit'),
     770  ),   
    722771  'TService' => array(
    723772    'Type' => 'Reference',
     
    813862    'Filter' => '1',
    814863  ),
     864  'TServiceCustomerRel' => array(
     865    'Type' => 'Reference',
     866    'Table' => 'ServiceCustomerRel',
     867    'Id' => 'Id',
     868    'Name' => 'Id',
     869    'Filter' => '1',
     870  ),
    815871  'TNetworkSegment' => array(
    816872    'Type' => 'Reference',
     
    9911047    'Type' => 'Reference',
    9921048    'Table' => 'PermissionOperation',
     1049    'Id' => 'Id',
     1050    'Name' => 'Id',
     1051    'Filter' => '1',
     1052  ),
     1053  'TFinanceCharge' => array(
     1054    'Type' => 'Reference',
     1055    'Table' => 'FinanceCharge',
    9931056    'Id' => 'Id',
    9941057    'Name' => 'Id',
Note: See TracChangeset for help on using the changeset viewer.