Jump to content

Tjw

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by Tjw

  1. On 3/22/2014 at 3:54 AM, Tyson said:

    I'll assume you want it below the client name and address.

     

    There are a few things you should note first:

    1. If you plan to print invoices and mail them to your customers, certain envelopes with windows to show the recipient name/address will likely also show these custom fields.
    2. There is not a lot of space below the client address and above the invoice listing "Description", so you may only be able to show 1 to 3 custom fields before overlaps occur.
    3. The width of the custom field name and values is expected to be rather small. If the values are too long, they'll wrap and you'll have less space, as in #2.

     

    Update /components/invoice_templates/default_invoice/default_invoice.pdf (line 481 in v3.1 of Blesta) from:

    
    private function drawAddress() {
    		$address = $this->invoice->billing->first_name . " " . $this->invoice->billing->last_name . "\n";
    		if (strlen($this->invoice->billing->company) > 0)
    			$address .= $this->invoice->billing->company . "\n";
    		$address .= $this->invoice->billing->address1 . "\n";
    		if (strlen($this->invoice->billing->address2) > 0)
    			$address .= $this->invoice->billing->address2 . "\n";
    		$address .= $this->invoice->billing->city . ", " . $this->invoice->billing->state . " " . $this->invoice->billing->zip . " " . $this->invoice->billing->country->alpha3;
    		
    		$data = array(
    			array($address)
    		);
    		$options = array(
    			'font_size'=>self::$font_size,
    			'x_pos'=>44,
    			'y_pos'=>157,
    			'col'=> array(
    				array('width'=>210)
    			)
    		);
    		$this->drawTable($data, $options);
    	}

    to:

    
    private function drawAddress() {
    		$address = $this->invoice->billing->first_name . " " . $this->invoice->billing->last_name . "\n";
    		if (strlen($this->invoice->billing->company) > 0)
    			$address .= $this->invoice->billing->company . "\n";
    		$address .= $this->invoice->billing->address1 . "\n";
    		if (strlen($this->invoice->billing->address2) > 0)
    			$address .= $this->invoice->billing->address2 . "\n";
    		$address .= $this->invoice->billing->city . ", " . $this->invoice->billing->state . " " . $this->invoice->billing->zip . " " . $this->invoice->billing->country->alpha3;
    		
    		// Set my custom fields
    		$cf_data = array();
    		if (property_exists($this->invoice->client, "id")) {
    			Loader::loadModels($this, array("Clients"));
    			$field_ids = array(6, 10, 15);
    			$values = $this->Clients->getCustomFieldValues($this->invoice->client->id);
    			
    			foreach ($values as $value) {
    				if (in_array($value->id, $field_ids)) {
    					$cf_data[] = "\n" . $value->name . ": " . $value->value;
    				}
    			}
    			unset($values, $value);
    		}
    
    		$data = array(
    			array($address)
    		);
    		
    		// Include my custom field data below the address
    		if (!empty($cf_data)) {
    			foreach ($cf_data as $cf_value)
    				$data[] = $cf_value;
    		}
    		
    		$options = array(
    			'font_size'=>self::$font_size,
    			'x_pos'=>44,
    			'y_pos'=>157,
    			'col'=> array(
    				array('width'=>210)
    			)
    		);
    		$this->drawTable($data, $options);
    	}

    Remember to update the comma-separated list of field IDs.

    Hi Tyson, I also need to insert custom client field into the invoice. Is this code still valid. I check out with the current code and looks somewhat different.

  2. Hi Paul, I am currently on Blesta 4.11.2.  I was using timezone UTC +7 in the setting, and when I am trying to generate a report from the database, somehow it picks up UTC timezone.

    So, my report would be off by 1 day. For example, If I was looking for invoices starting from 1 July - 31 July. The report would not pick up the invoice created on July 1, since the database would show that invoice was created on June 30 at 17:00 hours, instead of July 1 at  00:00 hours. The difference is exactly +7 hours.

    From what I understand Blesta stores all dates in UTC in the database, then based on the timezone in the settings, it would offset them to fetch based on the appropriate date & time. So I assume it might be possible that the offset correction does not occur anywhere in Blesta 4.11.2. 

    Please look into this. Thanks.

  3. 13 hours ago, Tjw said:

    Hi Tyson, 

    I have a similar question. Let's say a recurring service has Date Renews on 1 July 2020. Does this mean a recurring invoice will show : Date Billed on 1 July 2020 and also Date Due on 1 July 2020? How do you change Date Due to 20 July 2020 for this recurring invoice?

    I have got the explanation from Paul and I will also submit this as a feature request. Thanks.

     

  4. Hi Tyson, 

    I have a similar question. Let's say a recurring service has Date Renews on 1 July 2020. Does this mean a recurring invoice will show : Date Billed on 1 July 2020 and also Date Due on 1 July 2020? How do you change Date Due to 20 July 2020 for this recurring invoice?

×
×
  • Create New...