Jump to content

Client Billing Statement


mrrsm

Recommended Posts

I did some brief searching and could find any threads even though I thought this was talked about before.

 

There should be a way to print out a current statement for a customer.  For example if they have 2 invoices, 1 is partially paid, I should be able to print out a statement that shows the total from both invoices minus the amount paid and the total they owe.

 

I looked in reporting and couldn't find anything either although I would figure I would find this on the clients page in the admin section.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Like Tyson posted here: http://www.blesta.com/forums/index.php?/topic/3128-can-more-data-become-available-to-the-email-templates/?p=22655

{% for invoice in invoices}
Invoice: #{invoice.id_code}
Invoice Total: {invoice.due | currency_format invoice.currency}
Previous Due: {invoice.previous_due | currency_format invoice.currency}
{% endfor %}

I think a email template related to this posted every .... would be amazing as a statement.

Link to comment
Share on other sites

Like Tyson posted here: http://www.blesta.com/forums/index.php?/topic/3128-can-more-data-become-available-to-the-email-templates/?p=22655

{% for invoice in invoices}
Invoice: #{invoice.id_code}
Invoice Total: {invoice.due | currency_format invoice.currency}
Previous Due: {invoice.previous_due | currency_format invoice.currency}
{% endfor %}

I think a email template related to this posted every .... would be amazing as a statement.

 

While that is useful, I don't think it would be best for this request.  It doesn't add the totals up/etc.  Being able to expand on that and then include it in an email would be nice (having the ability to pull those overdue balances, list them as line items, and then have a total would be awesome).

 

Of course, it's a good start at least :).

Link to comment
Share on other sites

While that is useful, I don't think it would be best for this request.  It doesn't add the totals up/etc.  Being able to expand on that and then include it in an email would be nice (having the ability to pull those overdue balances, list them as line items, and then have a total would be awesome).

 

Of course, it's a good start at least :).

 

Yeah the guys would have to modify it like maybe list totals due total paid etc

Link to comment
Share on other sites

The code snippit is not that useful unless I am adding it to an existing email or something similar.  I am hoping for some client reports that would be editable in the email section.

I guess another way it could work would be a plugin that allows you to create email templates, then allow you to email them out to customers on demand or at an interval.  That would be more work I would have to do but it would be more flexible.

Link to comment
Share on other sites

The code snippit is not that useful unless I am adding it to an existing email or something similar.  I am hoping for some client reports that would be editable in the email section.

I guess another way it could work would be a plugin that allows you to create email templates, then allow you to email them out to customers on demand or at an interval.  That would be more work I would have to do but it would be more flexible.

 

Yeah I was thinking Blesta could have a template for it which is set on the cron just like sending invoices / other emails like welcome email.

Link to comment
Share on other sites

Like Tyson posted here: http://www.blesta.com/forums/index.php?/topic/3128-can-more-data-become-available-to-the-email-templates/?p=22655

{% for invoice in invoices}
Invoice: #{invoice.id_code}
Invoice Total: {invoice.due | currency_format invoice.currency}
Previous Due: {invoice.previous_due | currency_format invoice.currency}
{% endfor %}

I think a email template related to this posted every .... would be amazing as a statement.

 

 

this for invoice sent , the OP ask for something in the client area like a new section for this .

Link to comment
Share on other sites

  • 3 months later...

It was suggested that I post a request for a Statement Feature by a Besta Support staffer. We genertae a number of recuring invoices per client, per month - AND we also genertate invoices for break/fix site repairs and on-site and off-site support functions - a statement that rolls up all charges in a given billing cycle would be most beneficial to clients

Link to comment
Share on other sites

  • 4 months later...
  • 8 months later...

Just a note on this. Since this thread was started, we added a setting under Settings > Company > Billing/Payments > Invoice Customization called "Payments/Credits". If this is checked, invoices will show any payments already applied to the invoice.

 

If sending all open invoices to a client, they will be able to see how much is effectively due for each invoice when payments/credits are displayed. The only issue I think, is that it does not show a summary of the total due across all open invoices.

Link to comment
Share on other sites

  • 3 months later...

A few years ago, WHMCS didn't have client statements. Not sure if it does now. So I wrote this code and uploaded it to one of my servers. It's a set of custom mysql queries to calculate the amount owed, amount paid and amount of credits. Kind of like a simple bank statement - amount in and amount out, with balance. It takes all the information and uses FPDF to generate a downloadable PDF document.

 

I then made an email template in WHMCS that included the link to the page on my server that served my script.

 

I created MD5 hash from some of the user information, to check against, so that clients wouldn't have to log in when opening the link.

 

When the link is openend, the user gets a download prompt from their browser, asking if they want to download or open the PDF document. The filename is "Statement_YYYY-mm-dd". All these variables can be changed easily, of course, including the date range.

 

I'm attaching the code and a screenshot of what the statement looks like.

 

It's definitely not perfect and probably has some flaws, but maybe it can be modified to work with Blesta.

 

post-10991-0-88216800-1459760498_thumb.j

<?php

ini_set( 'display_errors', 1 );

## Path to logo
$logo = 'logo_vector_2.jpg';

## Company/organistion information

# Name
$org_name = 'Acme';

# Address
$org_addr_1 = "Address 1";
$org_addr_2 = "Address 2";
$org_addr_3 = "Ireland";

# Contact information 1
$org_contact_1 = 'Phone: +353 xxxx';

# Tax ID
$org_tax_id = "VAT ID: 1234567M";


## Database information
$dbhost = "example.com";
$dbuser = "xxx";
$dbpass = "xxx";
$dbname = "xxx";

$uid = isset( $_REQUEST['uid'] ) ? (int)$_REQUEST['uid'] : NULL;
$key = isset( $_REQUEST['key'] ) ? $_REQUEST['key'] : NULL;

if ( empty( $uid ) || empty( $key ) ) {
	die( 'Error: no user ID or access key supplied. The link you entered may have expired.' );
}

$mysqli = new mysqli( $dbhost, $dbuser, $dbpass, $dbname );

if ( $mysqli->connect_errno ) {
	echo "Failed to connect to MySQL: ( " . $mysqli->connect_errno . " ) " . $mysqli->connect_error;
	exit;
}

$result = $mysqli->query( "SELECT *, CONCAT( firstname, ' ', lastname, ' (', companyname, ')' ) AS client FROM tblclients WHERE id='$uid' LIMIT 1" );

if ( $result->num_rows !== 1 ) {
	die( 'Error: we could not access any account data with the information that was provided.' );
}

$d = $result->fetch_assoc();
$result->free_result();

$md5 = md5( $d['id'] . ' : ' . $d['client'] . ' : ' . $d['email'] );

if ( $key !== $md5 ) {
	die( 'Error: the access key provided could not be validated. The link you followed may have expired.' );
}

$date = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) -6 ) );

$result = $mysqli->query( "SELECT SUM(total) AS total FROM tblinvoices WHERE userid = '$uid' AND DATE_FORMAT(`date`, '%Y-%m-%d') < '$date' AND status != 'Cancelled'" );
$balforward = $result->fetch_array()[0];
$result->free_result();

$result = $mysqli->query( "SELECT SUM(amountin) FROM tblaccounts WHERE userid='$uid' AND DATE_FORMAT(`date`, '%Y-%m-%d') < '$date'" );
$balforward -= $result->fetch_array()[0];
$result->free_result();

$result = $mysqli->query( "SELECT SUM(amount) FROM tblcredit WHERE clientid='$uid' AND DATE_FORMAT(`date`, '%Y-%m-%d') < '$date'" );
$balforward += $result->fetch_array()[0];
$result->free_result();

$result = $mysqli->query( "
	(SELECT id, ( subtotal + tax ) AS `amount`, DATE_FORMAT(`date`, '%Y-%m-%d') AS `date`, 'Invoice' AS txtype
											 FROM tblinvoices
											 WHERE userid='$uid'
											 AND `date` >= '$date'
											 AND status != 'Cancelled'
											 AND ( subtotal + tax ) != 0)
	UNION
	(SELECT id, amountin AS `amount`, DATE_FORMAT(`date`, '%Y-%m-%d') AS `date`, 'Payment' AS txtype
												FROM tblaccounts
												WHERE userid='$uid'
												AND `date` >= '$date')
	UNION
	(SELECT id, amount AS `amount`, DATE_FORMAT(`date`, '%Y-%m-%d') AS `date`, 'Credit' AS txtype
											  FROM tblcredit
											  WHERE clientid='$uid'
											  AND `date` >= '$date')
	ORDER BY `date` ASC
" );

$i = array();

$n = 0;

$balance = $balforward;

while( $r = $result->fetch_assoc() ) {
	$i[$n] = $r;
	if ( $r['txtype'] === 'Invoice' ) {
		$balance += $r['amount'];
	}
	else {
		$balance -= $r['amount'];
	}
	$i[$n]['balance'] = number_format( $balance, 2, '.', ',' );
	$n++;
}

$result->free_result();
$mysqli->close();

define( 'FPDF_FONTPATH', '../includes/font/' );

require( '../includes/fpdf.php' );

$pdf = new FPDF();

//Column titles
$header = array( 'Date', 'Type', 'ID', 'Amount', 'Balance' );
//Data loading
//$data=$pdf->LoadData($i);

//$pdf->AddPage();
//$pdf->BasicTable($header,$data);
//$pdf->AddPage();
//$pdf->ImprovedTable($header,$data);
$pdf->AddPage();

$pdf->Image( $logo, 0, 0 );

$pdf->SetFont( 'Arial', 'B', 10 );
$pdf->Cell( 120, 6, '', 0, 0, 'L' );
$pdf->Cell( 0, 6, $org_name, 0, 0, 'L' );
$pdf->Ln();

$pdf->SetFont( 'Arial', '', 10 );

$pdf->Cell( 120, 6, '', 0, 0, 'L' );
$pdf->Cell( 0, 6, $org_addr_1, 0, 0, 'L' );
$pdf->Ln();
$pdf->Cell( 120, 6, '', 0, 0, 'L' );
$pdf->Cell( 0, 6, $org_addr_2, 0, 0, 'L' );
$pdf->Ln();
$pdf->Cell( 120, 6, '', 0, 0, 'L' );
$pdf->Cell( 0, 6, $org_addr_3, 0, 0, 'L' );
$pdf->Ln( 8 );
$pdf->Cell( 120, 6, '', 0, 0, 'L' );
$pdf->Cell( 0, 6, $org_contact_1, 0, 0, 'L' );
$pdf->Ln();
$pdf->Cell( 120, 6, '', 0, 0, 'L' );
$pdf->Cell( 0, 6, $org_tax_id, 0, 0, 'L' );
$pdf->Ln( 18 );

$pdf->SetFont( 'Arial', '', 14 );
$pdf->Cell( 80, 6, 'Account Statement', 0, 0, 'L' );
$pdf->Cell( 80, 6, gmdate( 'Y-m-d'), 0, 0, 'R' );
$pdf->Ln(10);
$pdf->SetFont( 'Arial', 'B', 10 );
$pdf->Cell( 0, 6, $d['client'] );
$pdf->Ln();
$pdf->SetFont( 'Arial', '', 10 );
$pdf->Cell( 0, 6, $d['address1'] . ', '. $d['city'] . ', ' . $d['state'] );
$pdf->Ln( 20 );

//$pdf->FancyTable($header,$data);

$data = $i;

//Colors, line width and bold font
$pdf->SetFillColor( 90, 135, 190 );
$pdf->SetTextColor( 255 );
$pdf->SetDrawColor( 128, 0, 0 );
$pdf->SetLineWidth( .3 );
$pdf->SetFont( '', 'B', 11 );
//Header
$w = array( 30, 40, 30, 40, 40 );
for ( $i = 0; $i < count( $header ); $i++ )
$pdf->Cell( $w[$i], 7, $header[$i], 1, 0, 'C', true );
$pdf->Ln();
//Color and font restoration
$pdf->SetFillColor( 224, 235, 255 );
$pdf->SetTextColor( 0 );
$pdf->SetFont( '' );
//Data
$fill = false;

$pdf->Cell( 30, 6, $date, 0, 0, 'L', $fill );
$pdf->Cell( 40, 6, 'Balance Forward', 0, 0, 'C', $fill );
$pdf->Cell( 30, 6, '-', 0, 0, 'L', $fill );
$pdf->Cell( 40, 6, number_format( $balforward, 2, '.', ',' ), 0, 0, 'R', $fill );
$pdf->Cell( 40, 6, number_format( $balforward, 2, '.', ',' ), 0, 0, 'R', $fill );
$pdf->Ln();

foreach( $data as $row )
{
	$pdf->Cell( 30, 6, $row['date'], 0, 0, 'L', $fill );
	$pdf->Cell (40, 6, $row['txtype'], 0, 0, 'C', $fill );
	$pdf->Cell( 30, 6, $row['id'], 0, 0, 'L', $fill );
	
	if ( $row['txtype'] === 'Payment' || $row['txtype'] === 'Credit' ) {
		$pdf->Cell( 40, 6, '-' . $row['amount'], 0, 0, 'R', $fill );
	}
	else {
		$pdf->Cell( 40, 6, $row['amount'], 0, 0, 'R', $fill );
	}
	$pdf->Cell( 40, 6, $row['balance'], 0, 0, 'R', $fill );
	$pdf->Ln();
	$fill =! $fill;
}

$pdf->Cell( array_sum( $w ), 0, '', 'T' );

$pdf->Ln( 20 );

$pdf->Cell( 80, 6, 'Your current account balance is:', 0, 0, 'L' );
$pdf->SetFont( 'Arial', 'B', 13 );
$pdf->Cell( 80, 6, number_format( $balance, 2, '.', ',' ), 0, 0, 'L' );

$pdf->Ln( 8 );

$pdf->SetFont( 'Arial', '', 8 );

$pdf->MultiCell( 150, 6, 'Please note this is not an official invoice. Errors and omissions excepted. Please refer to your invoice for transaction details and tax information. Please contact us with any questions.' );

$pdf->Ln(5);
$pdf->Ln(1);

header( "Cache-Control: no-cache, must-revalidate" ); // HTTP/1.1
header( "Expires: Sat, 26 Jul 1997 05:00:00 GMT" ); // Date in the past

header( "Content-type: application/pdf" );
header( 'Content-Disposition: attachment; filename="Statement_' . gmdate( 'Y_m_d' ) . '.pdf"' );

$pdf->Output( 'Statement_' .gmdate( 'Y_m_d' ) . '.pdf', 'D' );

Link to comment
Share on other sites

A few years ago, WHMCS didn't have client statements. Not sure if it does now. So I wrote this code and uploaded it to one of my servers. It's a set of custom mysql queries to calculate the amount owed, amount paid and amount of credits. Kind of like a simple bank statement - amount in and amount out, with balance. It takes all the information and uses FPDF to generate a downloadable PDF document.

 

I then made an email template in WHMCS that included the link to the page on my server that served my script.

 

I created MD5 hash from some of the user information, to check against, so that clients wouldn't have to log in when opening the link.

 

When the link is openend, the user gets a download prompt from their browser, asking if they want to download or open the PDF document. The filename is "Statement_YYYY-mm-dd". All these variables can be changed easily, of course, including the date range.

 

I'm attaching the code and a screenshot of what the statement looks like.

 

It's definitely not perfect and probably has some flaws, but maybe it can be modified to work with Blesta.

 

data:image/gif;base64,R0lGODlhCAAKAIABAAAAAP///yH5BAEAAAEALAAAAAAIAAoAAAISTIBmoLy9XDqyxktfkuo05AQFADs= 1459760355112.jpg

<?php

ini_set( 'display_errors', 1 );

## Path to logo
$logo = 'logo_vector_2.jpg';

## Company/organistion information

# Name
$org_name = 'Acme';

# Address
$org_addr_1 = "Address 1";
$org_addr_2 = "Address 2";
$org_addr_3 = "Ireland";

# Contact information 1
$org_contact_1 = 'Phone: +353 xxxx';

# Tax ID
$org_tax_id = "VAT ID: 1234567M";


## Database information
$dbhost = "example.com";
$dbuser = "xxx";
$dbpass = "xxx";
$dbname = "xxx";

$uid = isset( $_REQUEST['uid'] ) ? (int)$_REQUEST['uid'] : NULL;
$key = isset( $_REQUEST['key'] ) ? $_REQUEST['key'] : NULL;

if ( empty( $uid ) || empty( $key ) ) {
	die( 'Error: no user ID or access key supplied. The link you entered may have expired.' );
}

$mysqli = new mysqli( $dbhost, $dbuser, $dbpass, $dbname );

if ( $mysqli->connect_errno ) {
	echo "Failed to connect to MySQL: ( " . $mysqli->connect_errno . " ) " . $mysqli->connect_error;
	exit;
}

$result = $mysqli->query( "SELECT *, CONCAT( firstname, ' ', lastname, ' (', companyname, ')' ) AS client FROM tblclients WHERE id='$uid' LIMIT 1" );

if ( $result->num_rows !== 1 ) {
	die( 'Error: we could not access any account data with the information that was provided.' );
}

$d = $result->fetch_assoc();
$result->free_result();

$md5 = md5( $d['id'] . ' : ' . $d['client'] . ' : ' . $d['email'] );

if ( $key !== $md5 ) {
	die( 'Error: the access key provided could not be validated. The link you followed may have expired.' );
}

$date = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) -6 ) );

$result = $mysqli->query( "SELECT SUM(total) AS total FROM tblinvoices WHERE userid = '$uid' AND DATE_FORMAT(`date`, '%Y-%m-%d') < '$date' AND status != 'Cancelled'" );
$balforward = $result->fetch_array()[0];
$result->free_result();

$result = $mysqli->query( "SELECT SUM(amountin) FROM tblaccounts WHERE userid='$uid' AND DATE_FORMAT(`date`, '%Y-%m-%d') < '$date'" );
$balforward -= $result->fetch_array()[0];
$result->free_result();

$result = $mysqli->query( "SELECT SUM(amount) FROM tblcredit WHERE clientid='$uid' AND DATE_FORMAT(`date`, '%Y-%m-%d') < '$date'" );
$balforward += $result->fetch_array()[0];
$result->free_result();

$result = $mysqli->query( "
	(SELECT id, ( subtotal + tax ) AS `amount`, DATE_FORMAT(`date`, '%Y-%m-%d') AS `date`, 'Invoice' AS txtype
											 FROM tblinvoices
											 WHERE userid='$uid'
											 AND `date` >= '$date'
											 AND status != 'Cancelled'
											 AND ( subtotal + tax ) != 0)
	UNION
	(SELECT id, amountin AS `amount`, DATE_FORMAT(`date`, '%Y-%m-%d') AS `date`, 'Payment' AS txtype
												FROM tblaccounts
												WHERE userid='$uid'
												AND `date` >= '$date')
	UNION
	(SELECT id, amount AS `amount`, DATE_FORMAT(`date`, '%Y-%m-%d') AS `date`, 'Credit' AS txtype
											  FROM tblcredit
											  WHERE clientid='$uid'
											  AND `date` >= '$date')
	ORDER BY `date` ASC
" );

$i = array();

$n = 0;

$balance = $balforward;

while( $r = $result->fetch_assoc() ) {
	$i[$n] = $r;
	if ( $r['txtype'] === 'Invoice' ) {
		$balance += $r['amount'];
	}
	else {
		$balance -= $r['amount'];
	}
	$i[$n]['balance'] = number_format( $balance, 2, '.', ',' );
	$n++;
}

$result->free_result();
$mysqli->close();

define( 'FPDF_FONTPATH', '../includes/font/' );

require( '../includes/fpdf.php' );

$pdf = new FPDF();

//Column titles
$header = array( 'Date', 'Type', 'ID', 'Amount', 'Balance' );
//Data loading
//$data=$pdf->LoadData($i);

//$pdf->AddPage();
//$pdf->BasicTable($header,$data);
//$pdf->AddPage();
//$pdf->ImprovedTable($header,$data);
$pdf->AddPage();

$pdf->Image( $logo, 0, 0 );

$pdf->SetFont( 'Arial', 'B', 10 );
$pdf->Cell( 120, 6, '', 0, 0, 'L' );
$pdf->Cell( 0, 6, $org_name, 0, 0, 'L' );
$pdf->Ln();

$pdf->SetFont( 'Arial', '', 10 );

$pdf->Cell( 120, 6, '', 0, 0, 'L' );
$pdf->Cell( 0, 6, $org_addr_1, 0, 0, 'L' );
$pdf->Ln();
$pdf->Cell( 120, 6, '', 0, 0, 'L' );
$pdf->Cell( 0, 6, $org_addr_2, 0, 0, 'L' );
$pdf->Ln();
$pdf->Cell( 120, 6, '', 0, 0, 'L' );
$pdf->Cell( 0, 6, $org_addr_3, 0, 0, 'L' );
$pdf->Ln( 8 );
$pdf->Cell( 120, 6, '', 0, 0, 'L' );
$pdf->Cell( 0, 6, $org_contact_1, 0, 0, 'L' );
$pdf->Ln();
$pdf->Cell( 120, 6, '', 0, 0, 'L' );
$pdf->Cell( 0, 6, $org_tax_id, 0, 0, 'L' );
$pdf->Ln( 18 );

$pdf->SetFont( 'Arial', '', 14 );
$pdf->Cell( 80, 6, 'Account Statement', 0, 0, 'L' );
$pdf->Cell( 80, 6, gmdate( 'Y-m-d'), 0, 0, 'R' );
$pdf->Ln(10);
$pdf->SetFont( 'Arial', 'B', 10 );
$pdf->Cell( 0, 6, $d['client'] );
$pdf->Ln();
$pdf->SetFont( 'Arial', '', 10 );
$pdf->Cell( 0, 6, $d['address1'] . ', '. $d['city'] . ', ' . $d['state'] );
$pdf->Ln( 20 );

//$pdf->FancyTable($header,$data);

$data = $i;

//Colors, line width and bold font
$pdf->SetFillColor( 90, 135, 190 );
$pdf->SetTextColor( 255 );
$pdf->SetDrawColor( 128, 0, 0 );
$pdf->SetLineWidth( .3 );
$pdf->SetFont( '', 'B', 11 );
//Header
$w = array( 30, 40, 30, 40, 40 );
for ( $i = 0; $i < count( $header ); $i++ )
$pdf->Cell( $w[$i], 7, $header[$i], 1, 0, 'C', true );
$pdf->Ln();
//Color and font restoration
$pdf->SetFillColor( 224, 235, 255 );
$pdf->SetTextColor( 0 );
$pdf->SetFont( '' );
//Data
$fill = false;

$pdf->Cell( 30, 6, $date, 0, 0, 'L', $fill );
$pdf->Cell( 40, 6, 'Balance Forward', 0, 0, 'C', $fill );
$pdf->Cell( 30, 6, '-', 0, 0, 'L', $fill );
$pdf->Cell( 40, 6, number_format( $balforward, 2, '.', ',' ), 0, 0, 'R', $fill );
$pdf->Cell( 40, 6, number_format( $balforward, 2, '.', ',' ), 0, 0, 'R', $fill );
$pdf->Ln();

foreach( $data as $row )
{
	$pdf->Cell( 30, 6, $row['date'], 0, 0, 'L', $fill );
	$pdf->Cell (40, 6, $row['txtype'], 0, 0, 'C', $fill );
	$pdf->Cell( 30, 6, $row['id'], 0, 0, 'L', $fill );
	
	if ( $row['txtype'] === 'Payment' || $row['txtype'] === 'Credit' ) {
		$pdf->Cell( 40, 6, '-' . $row['amount'], 0, 0, 'R', $fill );
	}
	else {
		$pdf->Cell( 40, 6, $row['amount'], 0, 0, 'R', $fill );
	}
	$pdf->Cell( 40, 6, $row['balance'], 0, 0, 'R', $fill );
	$pdf->Ln();
	$fill =! $fill;
}

$pdf->Cell( array_sum( $w ), 0, '', 'T' );

$pdf->Ln( 20 );

$pdf->Cell( 80, 6, 'Your current account balance is:', 0, 0, 'L' );
$pdf->SetFont( 'Arial', 'B', 13 );
$pdf->Cell( 80, 6, number_format( $balance, 2, '.', ',' ), 0, 0, 'L' );

$pdf->Ln( 8 );

$pdf->SetFont( 'Arial', '', 8 );

$pdf->MultiCell( 150, 6, 'Please note this is not an official invoice. Errors and omissions excepted. Please refer to your invoice for transaction details and tax information. Please contact us with any questions.' );

$pdf->Ln(5);
$pdf->Ln(1);

header( "Cache-Control: no-cache, must-revalidate" ); // HTTP/1.1
header( "Expires: Sat, 26 Jul 1997 05:00:00 GMT" ); // Date in the past

header( "Content-type: application/pdf" );
header( 'Content-Disposition: attachment; filename="Statement_' . gmdate( 'Y_m_d' ) . '.pdf"' );

$pdf->Output( 'Statement_' .gmdate( 'Y_m_d' ) . '.pdf', 'D' );

Wow looks a mobile statement +1

Link to comment
Share on other sites

Okay, guys. Here we go...

https://github.com/NETLINK/BlestaClientStatements

 

I've tested it a bit and it seems to be working well. Right now, it's a standalone script. Would just have to figure out how to create the access key and maybe create an email template with the link and access hash included.

 

It's an MD5 hash made up of:

[ClientID][ClientFirstName ClientLastName (ClientCompany)][ClientEmailAddress][salt]

Line 48: $md5 = md5( $d['id'] . $d['client'] . $d['email'] . $salt );

But obviously, it would be a lot better to have it integrated with Blesta, like a plugin, as Naja suggested. Looking forward to thoughts/ideas.

Link to comment
Share on other sites

Okay, guys. Here we go...

https://github.com/NETLINK/BlestaClientStatements

 

I've tested it a bit and it seems to be working well. Right now, it's a standalone script. Would just have to figure out how to create the access key and maybe create an email template with the link and access hash included.

 

It's an MD5 hash made up of:

[ClientID][ClientFirstName ClientLastName (ClientCompany)][ClientEmailAddress][salt]

Line 48: $md5 = md5( $d['id'] . $d['client'] . $d['email'] . $salt );

But obviously, it would be a lot better to have it integrated with Blesta, like a plugin, as Naja suggested. Looking forward to thoughts/ideas.

 

 

Awesome mate anyway to connect it to Blesta so there's no need to put database information it just picks it up from config/blesta.php?

Link to comment
Share on other sites

Awesome mate anyway to connect it to Blesta so there's no need to put database information it just picks it up from config/blesta.php?

 

Yeah, I'll work on it when I get a moment. I can probably hook it into the client interface. The mail template will take longer, I think. For me, personally, the mail thing is more important because most of my clients never log in to Blesta. They get their invoices via email and then either pay by credit car or cheque. But I'll see what I can do about hooking the statement into the client menu. I don't think it should take too long to do that.

Link to comment
Share on other sites

Yeah, I'll work on it when I get a moment. I can probably hook it into the client interface. The mail template will take longer, I think. For me, personally, the mail thing is more important because most of my clients never log in to Blesta. They get their invoices via email and then either pay by credit car or cheque. But I'll see what I can do about hooking the statement into the client menu. I don't think it should take too long to do that.

 

i see your code , is easy ( at least for me) making it as a plugin or components . but i can't now do anything , unless i resolve my issues with v3 .

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...