Changeset 786
- Timestamp:
- Jan 11, 2016, 12:06:08 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/FormClasses.php
r765 r786 30 30 'Shortcut' => array('Type' => 'String', 'Caption' => 'Kód', 'Default' => ''), 31 31 'Sequence' => array('Type' => 'TDocumentLineSequenceListLine', 'Caption' => 'Čísleníky', 'Default' => ''), 32 'Codes' => array('Type' => 'TDocumentLineCodeList', 'Caption' => 'Kódy', 'Default' => ''), 32 'Codes' => array('Type' => 'TDocumentLineCodeList', 'Caption' => 'Kódy', 'Default' => ''), 33 'Operations' => array('Type' => 'TFinanceOperationGroupListDocumentLine', 'Caption' => 'Skupiny finančních operací', 'Default' => ''), 34 'Invoices' => array('Type' => 'TFinanceInvoiceGroupListDocumentLine', 'Caption' => 'Skupiny faktur', 'Default' => ''), 33 35 ), 34 36 ), … … 42 44 'NextNumber' => array('Type' => 'Integer', 'Caption' => 'Další číslo', 'Default' => '1'), 43 45 'YearPrefix' => array('Type' => 'Boolean', 'Caption' => 'Rok jako přípona', 'Default' => '1'), 44 'Operations' => array('Type' => 'TFinanceOperationListDocumentLine', 'Caption' => 'Finanční operace', 'Default' => ''),45 'Invoices' => array('Type' => 'TFinanceInvoiceListDocumentLine', 'Caption' => 'Faktury', 'Default' => ''),46 46 ), 47 47 ), … … 461 461 'Filter' => '1', 462 462 ), 463 'TFinanceOperation ListDocumentLine' => array(464 'Type' => 'ManyToOne', 465 'Table' => 'FinanceOperation ',463 'TFinanceOperationGroupListDocumentLine' => array( 464 'Type' => 'ManyToOne', 465 'Table' => 'FinanceOperationGroup', 466 466 'Id' => 'Id', 467 467 'Ref' => 'DocumentLine', 468 468 'Filter' => '1', 469 469 ), 470 'TFinanceInvoice ListDocumentLine' => array(471 'Type' => 'ManyToOne', 472 'Table' => 'FinanceInvoice ',470 'TFinanceInvoiceGroupListDocumentLine' => array( 471 'Type' => 'ManyToOne', 472 'Table' => 'FinanceInvoiceGroup', 473 473 'Id' => 'Id', 474 474 'Ref' => 'DocumentLine', -
trunk/Application/UpdateTrace.php
r785 r786 1793 1793 { 1794 1794 $Manager->Execute('DROP TABLE `NetworkInterfaceStat`'); 1795 } 1796 1797 function UpdateTo786($Manager) 1798 { 1799 $Manager->Execute('ALTER TABLE `Member` DROP FOREIGN KEY Member_ibfk_28;'); 1800 $Manager->Execute('ALTER TABLE `Member` DROP `BillingPeriodNext`;'); 1801 $Manager->Execute('ALTER TABLE `Member` ADD `Action` ENUM( "add", "modify", "remove" ) NULL'); 1802 $Manager->Execute('ALTER TABLE `Member` ADD `ChangeTime` DATETIME NULL'); 1803 $Manager->Execute('ALTER TABLE `Member` ADD `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;'); 1804 $Manager->Execute('ALTER TABLE `Member` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `Member`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;'); 1795 1805 } 1796 1806 … … 1876 1886 768 => array('Revision' => 770, 'Function' => 'UpdateTo770'), 1877 1887 770 => array('Revision' => 785, 'Function' => 'UpdateTo785'), 1888 775 => array('Revision' => 786, 'Function' => 'UpdateTo786'), 1878 1889 )); 1879 1890 } -
trunk/Modules/Customer/Customer.php
r765 r786 27 27 'MembershipDate' => array('Type' => 'Date', 'Caption' => 'Datum členství', 'Default' => ''), 28 28 'BillingPeriod' => array('Type' => 'TFinanceBillingPeriod', 'Caption' => 'Fakturační období aktuální', 'Default' => ''), 29 'BillingPeriodNext' => array('Type' => 'TFinanceBillingPeriod', 'Caption' => 'Fakturační období příští', 'Default' => ''),30 29 'BillingPeriodLastDate' => array('Type' => 'Date', 'Caption' => 'Datum poslední fakturace', 'Default' => ''), 31 30 'Blocked' => array('Type' => 'Boolean', 'Caption' => 'Blokování', 'Default' => '0'), … … 36 35 'SupportActivity' => array('Type' => 'TSupportActivityListCustomer', 'Caption' => 'Zákaznická podpora', 'Default' => ''), 37 36 'Consumption' => array('Type' => 'TCustomerStockSerialNumber', 'Caption' => 'Spotřeba zařízení', 'Default' => ''), 37 'ChangeAction' => array('Type' => 'TActionEnum', 'Caption' => 'Změna - akce', 'Default' => '', 'Null' => true), 38 'ChangeTime' => array('Type' => 'DateTime', 'Caption' => 'Změna - čas', 'Default' => '', 'Null' => true), 39 'ChangeReplaceId' => array('Type' => 'TMember', 'Caption' => 'Změna - položka', 'Default' => '0', 'Null' => true), 38 40 ), 39 41 'ItemActions' => array( -
trunk/Modules/Finance/Finance.php
r781 r786 159 159 $Monthly = round($Monthly); 160 160 161 if($Member['BillingPeriod Next'] == 1)161 if($Member['BillingPeriod'] == 1) 162 162 { 163 163 // Inactive payer -
trunk/Modules/Finance/Manage.php
r773 r786 39 39 } 40 40 41 /* Get first day and last day of given billing period. Periods are aligned with year start/end. */ 41 42 function GetBillingPeriod($Period) 42 43 { 44 $Time = time(); 45 $Year = date('Y', $Time); 46 43 47 $MonthCount = $this->System->Modules['Finance']->BillingPeriods[$Period]['MonthCount']; 44 $PeriodFrom = mktime(0, 0, 0, date('n'), 1, date('Y')); 45 $PeriodTo = mktime(0, 0, 0, date('n') + $MonthCount - 1, date('t', mktime(0, 0, 0, date('n') + $MonthCount - 1, 1, date('Y'))) , date('Y')); 48 if($MonthCount <= 0) return(array('From' => NULL, 'To' => NULL, 'MonthCount' => 0)); 49 $MonthCurrent = date('n', $Time); 50 51 /* Get start and end of aligned period */ 52 $MonthFrom = floor(($MonthCurrent - 1) / $MonthCount) + 1; 53 $MonthTo = $MonthFrom + $MonthCount - 1; 54 55 /* Use period from current month to end month so months before current month are cut out */ 56 $MonthCount = $MonthTo - $MonthCurrent + 1; 57 $MonthFrom = $MonthCurrent; 58 59 /* Get first and last day of period */ 60 $PeriodFrom = mktime(0, 0, 0, $MonthFrom, 1, $Year); 61 $PeriodTo = mktime(0, 0, 0, $MonthTo, date('t', mktime(0, 0, 0, $MonthTo, 1, $Year)), $Year); 62 46 63 return(array('From' => $PeriodFrom, 'To' => $PeriodTo, 'MonthCount' => $MonthCount)); 47 64 } … … 59 76 'FROM `MemberPayment` JOIN `Member` ON `Member`.`Id`=`MemberPayment`.`Member` JOIN `Subject` '. 60 77 'ON `Subject`.`Id`=`Member`.`Subject` LEFT JOIN `FinanceBillingPeriod` ON '. 61 '`FinanceBillingPeriod`.`Id`=`Member`.`BillingPeriod Next` WHERE (`Member`.`Blocked` = 0)'.62 'AND (`Member`.`BillingPeriod Next` > 1) AND (`MemberPayment`.`MonthlyTotal` != 0)';78 '`FinanceBillingPeriod`.`Id`=`Member`.`BillingPeriod` WHERE (`Member`.`Blocked` = 0)'. 79 'AND (`Member`.`BillingPeriod` > 1) AND (`MemberPayment`.`MonthlyTotal` != 0)'; 63 80 64 81 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$SQL.') AS T'); … … 133 150 $Output = ''; 134 151 135 // Generuj účetní položky152 // Produce accounting items 136 153 $DbResult = $this->Database->query('SELECT `Member`.*, `MemberPayment`.`MonthlyTotal` AS `MonthlyTotal`, '. 137 154 'UNIX_TIMESTAMP(`Member`.`BillingPeriodLastDate`) AS `BillingPeriodLastUnixTime`, `Subject`.`Name` AS `SubjectName`,'. … … 142 159 { 143 160 $Output .= $Member['SubjectName'].': '; 144 $Period = $this->GetBillingPeriod($Member['BillingPeriodNext']);145 if($Period['From'] > $Member['BillingPeriodLastUnixTime'])146 {147 $this->Database->update('Member', 'Id='.$Member['Id'],148 array('BillingPeriod' => $Member['BillingPeriodNext']));149 $Member['BillingPeriod'] = $Member['BillingPeriodNext'];150 }151 161 $Period = $this->GetBillingPeriod($Member['BillingPeriod']); 162 163 /* Check if need to produce new invoice for customer */ 152 164 if(($Period['MonthCount'] > 0) and ($Member['Blocked'] == 0) and 153 165 ($Period['From'] > $Member['BillingPeriodLastUnixTime'])) … … 170 182 // TODO: In case of negative invoice it is not sufficient to reverse invoicing direction 171 183 // Other subject should invoice only positive items. Negative items should be somehow removed. 172 if($MonthlyTotal >= 0) { 184 if($MonthlyTotal >= 0) 185 { 173 186 $InvoiceGroupId = INVOICE_GROUP_OUT; 174 187 } else { … … 178 191 // Load invoice group 179 192 $FinanceGroup = $this->System->Modules['Finance']->GetFinanceGroupById($InvoiceGroupId, 'FinanceInvoiceGroup'); 180 foreach($InvoiceItems as $Index => $Item) { 193 foreach($InvoiceItems as $Index => $Item) 194 { 181 195 $InvoiceItems[$Index]['Price'] = $Item['Price'] * $FinanceGroup['ValueSign']; 182 196 } … … 191 205 192 206 $Output .= $this->SendPaymentEmail($Member['Id']); 193 } else $Output .= '<br />'; 194 $this->Database->update('Member', 'Id='.$Member['Id'], 207 } 208 /* Update last billing day */ 209 $this->Database->update('Member', '`Id`='.$Member['Id'], 195 210 array('BillingPeriodLastDate' => TimeToMysqlDateTime($Period['To']))); 196 } else $Output .= '<br />'; 211 } 212 $Output .= '<br />'; 197 213 } 198 214 return($Output); … … 233 249 function ProcessTableUpdates() 234 250 { 251 // Update customers 252 $Output = 'Měním zákazníky...<br>'; 253 $this->TableUpdateChanges('Member'); 254 235 255 // Update finance charge 236 256 $Output = 'Měním aktuální parametry sítě...<br>'; … … 288 308 if($MonthCurrent != $MonthLast) 289 309 { 290 $Output .= 'Odečítám měsíčnípoplatek...<br />';310 $Output .= 'Odečítám pravidelný poplatek...<br />'; 291 311 $Output .= $this->ProduceInvoices(); 292 312 … … 302 322 303 323 $Finance->RecalculateMemberPayment(); 304 //CreateMonthlyOverallBill();305 //$Finance->RecalculateUsersFinance();306 324 307 325 // Restart traffic shaping … … 309 327 //flush(); 310 328 //$this->GenerateBills(); 329 $this->System->ModuleManager->Modules['Log']->NewRecord('Finance', 'ProcessMonthlyPayment', $Output); 311 330 } 312 331 return($Output); … … 332 351 $MainSubject = $DbResult->fetch_assoc(); 333 352 334 $Period = $this->GetBillingPeriod($Member['BillingPeriod Next']);353 $Period = $this->GetBillingPeriod($Member['BillingPeriod']); 335 354 336 355 $DbResult = $this->Database->query('SELECT `FinanceBankAccount`.*, '. … … 382 401 $Output = ''; 383 402 } else $Output = 'Uživatel '.$User['Name'].' nemá email.'; 403 return $Output; 384 404 } 385 405 -
trunk/Modules/Portal/Portal.php
r738 r786 40 40 'DIC' => array('Type' => 'String', 'Caption' => 'DIČ', 'Default' => ''), 41 41 'FamilyMemberCount' => array('Type' => 'Integer', 'Caption' => 'Počet osob v domácnosti', 'Default' => '', 'Suffix' => 'osob'), 42 'BillingPeriodNext' => array('Type' => 'TFinanceBillingPeriod', 'Caption' => 'Požadované fakturované období', 'Default' => ''),43 42 ), 44 43 )); … … 196 195 $CustomerUserRel = $DbResult->fetch_assoc(); 197 196 $DbResult = $this->Database->query('SELECT Member.Id, '. 198 'Member.FamilyMemberCount, Member.BillingPeriodNext,Subject.Name, Subject.AddressStreet, '.197 'Member.FamilyMemberCount, Subject.Name, Subject.AddressStreet, '. 199 198 'Subject.AddressTown, Subject.AddressPSC, Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject '. 200 199 'ON Subject.Id = Member.Subject WHERE Member.Id='.$CustomerUserRel['Customer']); … … 215 214 if($Form->Values['FamilyMemberCount'] < 0) 216 215 $Form->Values['FamilyMemberCount'] = 0; 217 if($Form->Values['BillingPeriodNext'] < 2)218 $Form->Values['BillingPeriodNext'] = 2;219 216 220 217 $DbResult = $this->Database->update('Member', 'Id='.$this->System->User->User['Member'], 221 array('FamilyMemberCount' => $Form->Values['FamilyMemberCount'], 222 'BillingPeriodNext' => $Form->Values['BillingPeriodNext'])); 218 array('FamilyMemberCount' => $Form->Values['FamilyMemberCount'])); 223 219 $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$this->System->User->User['Member']); 224 220 $Member = $DbResult->fetch_assoc(); … … 231 227 $this->System->ModuleManager->Modules['Log']->NewRecord('Member+Subject', 'Nastavení člena/subjektu změněno', 232 228 $Form->Values['Name']); 233 $DbResult = $this->Database->query('SELECT Member.Id, Member.FamilyMemberCount, Member.BillingPeriodNext,'.229 $DbResult = $this->Database->query('SELECT Member.Id, Member.FamilyMemberCount, '. 234 230 'Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, '. 235 231 'Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject '. -
trunk/Modules/SpeedTest/results.php
r738 r786 123 123 <br /><br /> 124 124 <h2><a class="start_test" href="<?php echo $config->{'general'}->{'base_url'}; ?>/download.php">Test Again</a></h2> 125 </center>126 125 <div id="speedtest_credits"> 127 126 Powered by <a title="Brandon Checketts Fancy Speed Test" href="http://www.brandonchecketts.com/speedtest/" target="_new">Fancy Speed Test</a>
Note:
See TracChangeset
for help on using the changeset viewer.