Changeset 727
- Timestamp:
- Jan 6, 2015, 12:02:36 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r726 r727 1 1 <?php 2 2 3 $Revision = 72 6; // Subversion revision3 $Revision = 727; // Subversion revision 4 4 $DatabaseRevision = 726; // SQL structure revision 5 5 $ReleaseTime = strtotime('2015-01-05'); -
trunk/Common/Global.php
r705 r727 385 385 } 386 386 387 function CommandExist($Command) 388 { 389 $Result = shell_exec('which '.$Command); 390 return(!empty($Result)); 391 } 392 387 393 function RemoveDiacritic($Text) 388 394 { -
trunk/Modules/Customer/Customer.php
r726 r727 48 48 'MonthlyInternet' => array('Type' => 'Integer', 'Caption' => 'Internet měsíčně', 'Default' => '', 'Suffix' => 'Kč', 'ReadOnly' => true), 49 49 'MonthlyConsumption' => array('Type' => 'Integer', 'Caption' => 'Spotřeba měsíčně', 'Default' => '', 'Suffix' => 'Kč', 'ReadOnly' => true), 50 'NetworkDevice' => array('Type' => 'Integer', 'Caption' => 'Podíl na zařízení', 'Default' => '', 'Suffix' => 'Kč', 'ReadOnly' => true),51 50 'MonthlyPlus' => array('Type' => 'Integer', 'Caption' => 'Měsíčně plus', 'Default' => '', 'Suffix' => 'Kč', 'ReadOnly' => true), 52 51 'Cash' => array('Type' => 'Integer', 'Caption' => 'Kredit', 'Default' => '', 'Suffix' => 'Kč', 'ReadOnly' => true), -
trunk/Modules/Finance/Bill.php
r720 r727 4 4 { 5 5 var $SpecificSymbol = 1; // počítačová sít 6 6 var $Checked; 7 7 8 function GenerateHTML() 8 9 { … … 21 22 { 22 23 $Encoding = new Encoding(); 24 if($this->Checked == false) { 25 if(CommandExist('htmldoc')) { 26 $this->Checked = true; 27 } else throw new Exception('htmldoc is not installed.'); 28 } 23 29 $Output = shell_exec('echo "'.addslashes($Encoding->FromUTF8($HtmlCode)). 24 30 '"|htmldoc --no-numbered --webpage --no-embedfonts --charset 8859-2 -t pdf -'); -
trunk/Modules/Finance/Manage.php
r726 r727 132 132 // Generuj účetní položky 133 133 $DbResult = $this->Database->query('SELECT `Member`.*, `MemberPayment`.`MonthlyTotal` AS `MonthlyTotal`, '. 134 'UNIX_TIMESTAMP(`Member`.`BillingPeriodLastDate`) , `Subject`.`Name` AS `SubjectName`,'.134 'UNIX_TIMESTAMP(`Member`.`BillingPeriodLastDate`) AS `BillingPeriodLastUnixTime`, `Subject`.`Name` AS `SubjectName`,'. 135 135 '`MemberPayment`.`MonthlyPlus` AS `MonthlyPlus` '. 136 136 'FROM `MemberPayment` JOIN `Member` ON `Member`.`Id`=`MemberPayment`.`Member` '. … … 140 140 $Output .= $Member['SubjectName'].': '; 141 141 $Period = $this->GetBillingPeriod($Member['BillingPeriodNext']); 142 if($Period['From'] > $Member[' UNIX_TIMESTAMP(Member.BillingPeriodLastDate)'])142 if($Period['From'] > $Member['BillingPeriodLastUnixTime']) 143 143 { 144 144 $this->Database->update('Member', 'Id='.$Member['Id'], … … 148 148 $Period = $this->GetBillingPeriod($Member['BillingPeriod']); 149 149 if(($Period['MonthCount'] > 0) and ($Member['Blocked'] == 0) and 150 ($Period['From'] > $Member[' UNIX_TIMESTAMP(Member.BillingPeriodLastDate)']))150 ($Period['From'] > $Member['BillingPeriodLastUnixTime'])) 151 151 { 152 152 $InvoiceItems = array(); … … 163 163 $MonthlyTotal += $Service['Price']; 164 164 } 165 $PayPerPeriod = $MonthlyTotal * $Period['MonthCount']; 165 $PayPerPeriod = $MonthlyTotal * $Period['MonthCount']; 166 166 // We can't produce negative invoice except storno invoice. 167 167 // TODO: In case of negative invoice it is not sufficient to reverse invoicing direction 168 168 // Other subject should invoice only possitive items. Negative items should be somehow removed. 169 if($MonthlyTotal >= 0) 169 if($MonthlyTotal >= 0) { 170 $DocumentLine = DOC_LINE_INVOICE_OUT; 170 171 $Direction = 1; // Standard out invoice 171 172 $Direction = -1; // In case of negative total value generate reverse invoice for other subject173 foreach($InvoiceItems as $Index => $Item)174 $InvoiceItems[$Index]['Price'] = -$Item['Price'];175 }176 172 } else { 173 $DocumentLine = DOC_LINE_INVOICE_IN; 174 $Direction = -1; // In case of negative total value generate reverse invoice for other subject 175 foreach($InvoiceItems as $Index => $Item) 176 $InvoiceItems[$Index]['Price'] = -$Item['Price']; 177 } 177 178 178 179 if($PayPerPeriod != 0) … … 181 182 $Output .= $TimePeriodText.': '.$MonthlyTotal.' * '.$Period['MonthCount'].' = '.$PayPerPeriod.'<br />'; 182 183 $this->InsertInvoice($Member['Subject'], time(), time() + 3600 * 24 * INVOICE_DUE_DAYS, 183 $Direction, $InvoiceItems, DOC_LINE_INVOICE_OUT, $Period['From'], $Period['To']);184 $Direction, $InvoiceItems, $DocumentLine, $Period['From'], $Period['To']); 184 185 185 186 $Output .= $this->SendPaymentEmail($Member['Id']); … … 308 309 global $Config; 309 310 310 $DbResult = $this->Database->select('Member', '*', ' Id='.$MemberId);311 $DbResult = $this->Database->select('Member', '*', '`Id`='.$MemberId); 311 312 $Member = $DbResult->fetch_assoc(); 312 313 313 $DbResult = $this->Database->select('MemberPayment', '*', ' Member='.$MemberId);314 $DbResult = $this->Database->select('MemberPayment', '*', '`Member`='.$MemberId); 314 315 $MemberPayment = $DbResult->fetch_assoc(); 315 316 316 $DbResult = $this->Database->select('Subject', 'Name', ' Id='.$Member['Subject']);317 $DbResult = $this->Database->select('Subject', 'Name', '`Id`='.$Member['Subject']); 317 318 $Subject = $DbResult->fetch_assoc(); 318 319 319 $DbResult = $this->Database->select('User', '*', ' Id='.$Member['ResponsibleUser']);320 $DbResult = $this->Database->select('User', '*', '`Id`='.$Member['ResponsibleUser']); 320 321 $User = $DbResult->fetch_assoc(); 321 322 … … 325 326 $Period = $this->GetBillingPeriod($Member['BillingPeriodNext']); 326 327 327 $DbResult = $this->Database->query('SELECT FinanceBankAccount.*, CONCAT(FinanceBankAccount.Number, "/", FinanceBank.Code) AS NumberFull FROM FinanceBankAccount '. 328 'JOIN FinanceBank ON FinanceBank.Id=FinanceBankAccount.Bank '. 329 'WHERE (FinanceBankAccount.`Subject`='.$Config['Finance']['MainSubjectId'].') AND (FinanceBankAccount.`Use`=1)'); 328 $DbResult = $this->Database->query('SELECT `FinanceBankAccount`.*, '. 329 'CONCAT(`FinanceBankAccount`.`Number`, "/", `FinanceBank`.`Code`) AS `NumberFull` FROM `FinanceBankAccount` '. 330 'JOIN `FinanceBank` ON `FinanceBank`.`Id`=`FinanceBankAccount`.`Bank` '. 331 'WHERE (`FinanceBankAccount`.`Subject`='.$Config['Finance']['MainSubjectId'].') '. 332 'AND (`FinanceBankAccount`.`Use`=1)'); 330 333 $MainSubjectAccount = $DbResult->fetch_assoc(); 331 334 … … 336 339 $User['Name'].'</strong> ke dni <strong>'.$this->System->HumanDate(time()).'</strong>.<br /><br />'."\n". 337 340 'Váše aktuální služby: '; 338 $DbResult = $this->Database->query('SELECT GROUP_CONCAT( Service.Name) AS Name FROM ServiceCustomerRel LEFT JOIN Service'.339 'ON Service.Id=ServiceCustomerRel.Service WHERE (ServiceCustomerRel.Customer='.$Member['Id'].') '.340 'AND ServiceCustomerRel.ChangeAction IS NULL');341 $DbResult = $this->Database->query('SELECT GROUP_CONCAT(`Service`.`Name`) AS `Name` FROM `ServiceCustomerRel` LEFT JOIN `Service` '. 342 'ON `Service`.`Id`=`ServiceCustomerRel`.`Service` WHERE (`ServiceCustomerRel`.`Customer`='.$Member['Id'].') '. 343 'AND (`ServiceCustomerRel`.`ChangeAction` IS NULL)'); 341 344 $Service = $DbResult->fetch_assoc(); 342 345 $Content .= '<strong>'.$Service['Name'].'</strong><br />'."\n". … … 351 354 '<th style="border-style: solid; border-width: 1px; padding: 1px 5px 1px 5px; text-align: center; font-weight: bold;">Popis</th>'. 352 355 '<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 $DbResult = $this->Database->query('SELECT T1.* FROM ((SELECT Text, Time, (Value*Direction) 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, -(Value*Direction) as Value, File FROM FinanceInvoice WHERE (Subject='. 355 $Member['Subject'].')) ORDER BY Time DESC) AS T1 WHERE (T1.Time > "'.$Member['BillingPeriodLastDate'].'")'); 356 $DbResult = $this->Database->query('SELECT T1.* FROM ((SELECT `Text`, `Time`, (`Value`*`Direction`) AS `Value`, `File` FROM `FinanceOperation` WHERE (`Subject`='.$Member['Subject'].')) UNION ALL '. 357 '(SELECT (SELECT GROUP_CONCAT(`Description` SEPARATOR ", ") FROM `FinanceInvoiceItem` '. 358 'WHERE `FinanceInvoiceItem`.`FinanceInvoice` = `FinanceInvoice`.`Id`) AS `Text`, '. 359 '`Time`, -(`Value`*`Direction`) AS `Value`, `File` FROM `FinanceInvoice` WHERE (`Subject`='. 360 $Member['Subject'].')) ORDER BY `Time` DESC) AS `T1` WHERE (`T1`.`Time` > "'.$Member['BillingPeriodLastDate'].'")'); 356 361 while($DbRow = $DbResult->fetch_assoc()) 357 362 { -
trunk/Modules/Subject/Subject.php
r720 r727 28 28 'AddressCountry' => array('Type' => 'TCountry', 'Caption' => 'Země', 'Default' => ''), 29 29 'IC' => array('Type' => 'String', 'Caption' => 'IČ', 'Default' => ''), 30 'DIC' => array('Type' => 'String', 'Caption' => 'DIČ', 'Default' => ''), 30 'DIC' => array('Type' => 'String', 'Caption' => 'DIČ', 'Default' => ''), 31 31 'MapPosition' => array('Type' => 'TMapPosition', 'Caption' => 'Pozice na mapě', 'Default' => '', 'Null' => true), 32 32 'WWW' => array('Type' => 'Hyperlink', 'Caption' => 'WWW', 'Default' => ''), … … 39 39 'WHERE `FinanceOperation`.`Subject`=#Id), 0) - IFNULL((SELECT SUM(`FinanceInvoice`.`Value` * `FinanceInvoice`.`Direction`) FROM `FinanceInvoice` '. 40 40 'WHERE `FinanceInvoice`.`Subject`=#Id), 0)'), 41 'BankAccounts' => array('Type' => 'TFinanceBankAccountListSubject', 'Caption' => 'Bankovní účety', 'Default' => ''), 41 42 ), 43 )); 44 $this->System->FormManager->RegisterFormType('TFinanceBankAccountListSubject', array( 45 'Type' => 'ManyToOne', 46 'Table' => 'FinanceBankAccount', 47 'Id' => 'Id', 48 'Ref' => 'Subject', 49 'Filter' => '1', 42 50 )); 43 51 $this->System->FormManager->RegisterClass('SubjectReport', array(
Note:
See TracChangeset
for help on using the changeset viewer.