Esempio n. 1
0
/**
 * Returns company invoicing logo url
 * 
 * @param void
 * @return null
 */
function get_company_invoicing_logo_url()
{
    $logo = get_company_invoicing_logo_path();
    if (is_file($logo)) {
        return URL_BASE == ROOT_URL . '/' ? ROOT_URL . '/public/brand/invoicing_logo.jpg' : ROOT_URL . '/brand/invoicing_logo.jpg';
    } else {
        return get_image_url('default-invoice-logo.gif', INVOICING_MODULE);
    }
    // if
}
 /**
  * Draws invoice header
  * 
  * @param null
  * @return null
  */
 function drawInvoiceHeaderBlock()
 {
     //  remember starting coordinates
     $starting_y = $this->GetY();
     $starting_x = $this->GetX();
     $company_image = get_company_invoicing_logo_path();
     if (is_file($company_image)) {
         $this->Image($company_image, $this->GetX(), $this->GetY(), null, 20);
     }
     // if
     $max_y1 = $this->getImageRBY();
     $this->SetX($starting_x);
     $this->SetY($starting_y);
     // draws company details
     $rgb = $this->convertHTMLColorToDec($this->getHeaderFontColor());
     $this->SetTextColor($rgb['R'], $rgb['G'], $rgb['B']);
     $company_name = ConfigOptions::getValue('invoicing_company_name');
     if (!$company_name) {
         $company_name = $this->owner_company->getName();
     }
     // if
     $company_details = ConfigOptions::getValue('invoicing_company_details');
     if (!$company_details) {
         $company_details = '';
         if ($this->owner_company->getConfigValue('office_address')) {
             $company_details .= "\n" . $this->owner_company->getConfigValue('office_address');
         }
         // if
         if ($this->owner_company->getConfigValue('office_phone')) {
             $company_details .= "\n" . $this->owner_company->getConfigValue('office_phone');
         }
         // if
         if ($this->owner_company->getConfigValue('office_fax')) {
             $company_details .= "\n" . $this->owner_company->getConfigValue('office_fax');
         }
         // if
         if ($this->owner_company->getConfigValue('office_homepage')) {
             $company_details .= "\n" . $this->owner_company->getConfigValue('office_homepage');
         }
         // if
     }
     // if
     $this->SetFont('', 'B', $this->font_size);
     $this->Cell(0, $this->line_height, $company_name, 0, 0, 'R');
     $this->Ln();
     $this->SetX($x);
     $this->SetFont('', '', $this->font_size);
     $this->MultiCell(0, $this->line_height, $company_details, 0, 'R', false, 1, '', '', true, 0, false, 1.25);
     $max_y2 = $this->GetY();
     $this->SetX($starting_x);
     $this->SetY(max($max_y1, $max_y2));
 }