Changeset 968 for trunk


Ignore:
Timestamp:
Apr 12, 2024, 9:43:27 PM (2 weeks ago)
Author:
chronos
Message:
  • Modified: Improved content of email with finance account state.
  • Added: Customer IS action to generate finance email into email queue.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Version.php

    r967 r968  
    11<?php
    22
    3 $Revision = 967; // Subversion revision
     3$Revision = 968; // Subversion revision
    44$DatabaseRevision = 967; // SQL structure revision
    5 $ReleaseTime = strtotime('2024-03-06');
     5$ReleaseTime = strtotime('2024-04-12');
  • trunk/Modules/Customer/Customer.php

    r961 r968  
    4646      'ItemActions' => array(
    4747        array('Caption' => 'Klientská sekce', 'URL' => '/finance/platby/?i=#RowId'),
     48        array('Caption' => 'Email s vyúčtováním do fronty', 'URL' => '/finance/sprava/?Operation=SendPaymentEmail&amp;i=#RowId'),
    4849      ),
    4950    ));
  • trunk/Modules/Finance/Finance.php

    r967 r968  
    4242    $this->System->RegisterPage(['finance', 'platby'], 'PageFinanceUserState');
    4343    $this->System->RegisterPage(['finance', 'import'], 'PageFinanceImportPayment');
    44     $this->System->RegisterPage(['finance', 'zivnost'], 'PageFinanceTaxFiling');
     44    $this->System->RegisterPage(['finance', 'zivnost'], 'PageFinanceTaxFiling');   
    4545
    4646    $this->System->FormManager->RegisterClass('FinanceOperation', array(
  • trunk/Modules/Finance/FinanceModels.php

    r960 r968  
    4040    $DbResult = $this->Database->query('SELECT * FROM `FinanceBillingPeriod`');
    4141    while ($BillingPeriod = $DbResult->fetch_assoc())
     42    {
    4243      $this->BillingPeriods[$BillingPeriod['Id']] = $BillingPeriod;
     44    }
    4345
    4446    // Period parameter is not used as it have to be determined from item replacement
     
    6567
    6668    $DbResult = $this->Database->query('SELECT SUM(`MemberPayment`.`MonthlyInternet`) AS `MonthlyInternet`, '.
    67         'SUM(`MemberPayment`.`MonthlyTotal`) AS `MonthlyTotal` '.
    68         'FROM `MemberPayment` JOIN `Member` ON `Member`.`Id`=`MemberPayment`.`Member` WHERE `Member`.`Blocked`=0');
     69      'SUM(`MemberPayment`.`MonthlyTotal`) AS `MonthlyTotal` '.
     70      'FROM `MemberPayment` JOIN `Member` ON `Member`.`Id`=`MemberPayment`.`Member` WHERE `Member`.`Blocked`=0');
    6971    $Row = $DbResult->fetch_assoc();
    7072    $this->TotalInternetPaid = $Row['MonthlyInternet'];
  • trunk/Modules/Finance/Import.php

    r929 r968  
    66  {
    77    parent::__construct($System);
    8     $this->itle = 'Import plateb';
     8    $this->Title = 'Import plateb';
    99    $this->ParentClass = 'PageFinance';
    1010  }
     
    6868      array_shift($Data);
    6969      $Automatic = '';
    70       $Manual = '';
    7170      $Output = '<form action="?Operation=insert" method="post">';
    7271      $I = 0;
  • trunk/Modules/Finance/Manage.php

    r939 r968  
    3737      case 'RegenerateOperation':
    3838        $Output = $this->GenerateOperation('AND (Id='.$_GET['i'].')');
     39        break;
     40      case 'SendPaymentEmail':
     41        $Output = $this->SendPaymentEmail($_GET['i']);
    3942        break;
    4043      default:
     
    171174      $Period = $this->GetBillingPeriod($Member['BillingPeriod']);
    172175
    173       /* Check if need to produce new invoice for customer */
     176      // Check if need to produce new invoice for customer
    174177      if (($Period['MonthCount'] > 0) and ($Member['Blocked'] == 0) and
    175178        ($Period['From'] > $Member['BillingPeriodLastUnixTime']))
     
    195198        {
    196199          $InvoiceGroupId = INVOICE_GROUP_OUT;
    197         } else {
     200        } else
     201        {
    198202          $InvoiceGroupId = INVOICE_GROUP_IN;
    199203        }
     
    215219          $Output .= $this->SendPaymentEmail($Member['Id']);
    216220        }
    217         /* Update last billing day */
     221        // Update last billing day
    218222        $this->Database->update('Member', '`Id`='.$Member['Id'],
    219223          array('BillingPeriodLastDate' => TimeToMysqlDateTime($Period['To'])));
     
    346350  function SendPaymentEmail(string $MemberId, string $FileId = ''): string
    347351  {
     352    $Finance = &ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance;
     353    $Finance->LoadMonthParameters(0);
     354
     355    if (!ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('Finance', 'Manage')) return 'Nemáte oprávnění';
    348356    global $Config;
    349357
     
    362370    $DbResult = $this->Database->select('Subject', '*', '`Id`='.$Config['Finance']['MainSubjectId']);
    363371    $MainSubject = $DbResult->fetch_assoc();
     372
     373    $DbResult = $this->Database->select('Company', '*', '`Id`='.$Config['Finance']['MainCompanyId']);
     374    $MainCompany = $DbResult->fetch_assoc();
    364375
    365376    $Period = $this->GetBillingPeriod($Member['BillingPeriod']);
     
    374385    if ($User['Email'] != '')
    375386    {
    376       $Title = 'Pravidelné vyúčtování služeb';
    377       $Content = 'Vyúčtovaní zákazníka <strong>'.$Subject['Name'].'</strong> zastoupeného uživatelem <strong>'.
     387      $Title = 'Pravidelné vyúčtování služeb '.$MainCompany['Name'];
     388      $Content = 'Dobrý den,<br/><br/>'.
     389        'Zasíláme vyúčtování klienta <strong>'.$Subject['Name'].'</strong> zastoupeného uživatelem <strong>'.
    378390        $User['Name'].'</strong> ke dni <strong>'.Core::Cast($this->System)->HumanDate(time()).'</strong>.<br/><br/>'."\n".
    379391        'Vaše aktuální služby: ';
     
    414426      'Pro aktuální informace, prohlížení elektronických dokladů a možnost změny údajů se prosím přihlaste na stránkách '.
    415427      '<a href="https://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'">https://'.
    416       $Config['Web']['Host'].$Config['Web']['RootFolder'].'</a>.<br /><br />'."\n";
    417 
    418       $Content .= '<br />Tento email je generován automaticky. V případě zjištění nesrovnalostí napište zpět.';
     428      $Config['Web']['Host'].$Config['Web']['RootFolder'].'</a>.<br/><br/>'."\n";
     429
     430      $Content .= '<br/>Tento email je generován automaticky. V případě zjištění nesrovnalostí prosím napište zpět.';
     431     
     432      $Content .= '<br/><br/>S pozdravem,<br/>'.$MainCompany['Name'].'<br/><a href="'.$MainSubject['WWW'].'">'.
     433        str_replace(array('https:', '/'), '', $MainSubject['WWW']).'</a>';
     434
    419435      ModuleEmailQueue::Cast($this->System->GetModule('EmailQueue'))->AddItem($User['Name'].' <'.$User['Email'].'>', $Title, $Content,
    420436         $Config['Web']['Admin'].' <'.$Config['Web']['AdminEmail'].'>');
  • trunk/Modules/Finance/Trade.php

    r929 r968  
    501501  {
    502502    $TimeDue = $Time + 15 * 24 * 3600; // 15 dnů
    503 
    504503  }
    505504}
Note: See TracChangeset for help on using the changeset viewer.