Jump to content

Unpaid red title in invoice.tpl cannot be located to change


kwood

Recommended Posts

My invoicepdf.tpl does not have the 'Unpaid' status within it, yet my invoices are still showing the 'Unpaid' title. Please can someone help me remove it? I just don't want it displayed for a particulate client.

Link to comment
Share on other sites

It's the default, so yes, it's there. 

# Invoice Status
$pdf->SetXY(0, 0);
$pdf->SetFont($pdfFont, 'B', 28);
$pdf->SetTextColor(255);
$pdf->SetLineWidth(0.75);
$pdf->StartTransform();
$pdf->Rotate(-35, 100, 225);
if ($status == 'Draft') {
    $pdf->SetFillColor(200);
    $pdf->SetDrawColor(140);
} elseif ($status == 'Paid') {
    $pdf->SetFillColor(151, 223, 74);
    $pdf->SetDrawColor(110, 192, 70);
} elseif ($status == 'Cancelled') {
    $pdf->SetFillColor(200);
    $pdf->SetDrawColor(140);
} elseif ($status == 'Refunded') {
    $pdf->SetFillColor(131, 182, 218);
    $pdf->SetDrawColor(91, 136, 182);
} elseif ($status == 'Collections') {
    $pdf->SetFillColor(3, 3, 2);
    $pdf->SetDrawColor(127);
} else {
    $pdf->SetFillColor(223, 85, 74);
    $pdf->SetDrawColor(171, 49, 43);
}

This bit at the bottom determines the color:

} else {
    $pdf->SetFillColor(223, 85, 74);
    $pdf->SetDrawColor(171, 49, 43);
}

This bit at the top determines the font, color and size of the text. 

$pdf->SetFont($pdfFont, 'B', 28);
$pdf->SetTextColor(255);

Link to comment
Share on other sites

1 minute ago, kwood said:

My invoicepdf.tpl does not have the 'Unpaid' status within it, yet my invoices are still showing the 'Unpaid' title.

it will unless you've removed / modified the #invoice status block of code - it would be applied using the two 'else' conditions for "Unpaid" invoices.

 

Link to comment
Share on other sites

1 minute ago, brian! said:

it will unless you've removed / modified the #invoice status block of code - it would be applied using the two 'else' conditions for "Unpaid" invoices.

 

Thank you for your response. So where would I find these 'else' condition, to be able to change its name etc?

Link to comment
Share on other sites

4 minutes ago, bear said:

It's the default, so yes, it's there. 


# Invoice Status
$pdf->SetXY(0, 0);
$pdf->SetFont($pdfFont, 'B', 28);
$pdf->SetTextColor(255);
$pdf->SetLineWidth(0.75);
$pdf->StartTransform();
$pdf->Rotate(-35, 100, 225);
if ($status == 'Draft') {
    $pdf->SetFillColor(200);
    $pdf->SetDrawColor(140);
} elseif ($status == 'Paid') {
    $pdf->SetFillColor(151, 223, 74);
    $pdf->SetDrawColor(110, 192, 70);
} elseif ($status == 'Cancelled') {
    $pdf->SetFillColor(200);
    $pdf->SetDrawColor(140);
} elseif ($status == 'Refunded') {
    $pdf->SetFillColor(131, 182, 218);
    $pdf->SetDrawColor(91, 136, 182);
} elseif ($status == 'Collections') {
    $pdf->SetFillColor(3, 3, 2);
    $pdf->SetDrawColor(127);
} else {
    $pdf->SetFillColor(223, 85, 74);
    $pdf->SetDrawColor(171, 49, 43);
}

This bit at the bottom determines the color:

} else {
    $pdf->SetFillColor(223, 85, 74);
    $pdf->SetDrawColor(171, 49, 43);
}

This bit at the top determines the font, color and size of the text. 

$pdf->SetFont($pdfFont, 'B', 28);
$pdf->SetTextColor(255);

Thank you for your help. This defines the default, but I would like to change it to not display at all on the invoice.

Link to comment
Share on other sites

1 minute ago, kwood said:

So where would I find these 'else' condition, to be able to change its name etc?

bear was close...

# Invoice Status
$pdf->SetXY(0, 0);
$pdf->SetFont($pdfFont, 'B', 28);
$pdf->SetTextColor(255);
$pdf->SetLineWidth(0.75);
$pdf->StartTransform();
$pdf->Rotate(-35, 100, 225);
if ($status == 'Draft') {
    $pdf->SetFillColor(200);
    $pdf->SetDrawColor(140);
} elseif ($status == 'Paid') {
    $pdf->SetFillColor(151, 223, 74);
    $pdf->SetDrawColor(110, 192, 70);
} elseif ($status == 'Cancelled') {
    $pdf->SetFillColor(200);
    $pdf->SetDrawColor(140);
} elseif ($status == 'Refunded') {
    $pdf->SetFillColor(131, 182, 218);
    $pdf->SetDrawColor(91, 136, 182);
} elseif ($status == 'Collections') {
    $pdf->SetFillColor(3, 3, 2);
    $pdf->SetDrawColor(127);
} else {
    $pdf->SetFillColor(223, 85, 74);
    $pdf->SetDrawColor(171, 49, 43);
}
if ($status == 'Payment Pending'){
$pdf->Cell(100, 18, strtoupper(Lang::trans('invoices' . str_replace(' ', '', $status))), 'TB', 0, 'C', '1');
} else {
$pdf->Cell(100, 18, strtoupper(Lang::trans('invoices' . strtolower($status))), 'TB', 0, 'C', '1');
}
$pdf->StopTransform();
$pdf->SetTextColor(0);

so the first else defines the colors if one of the previous status conditions haven't been met; the second else covers what to do if it's not "Payment Pending" (e.g every other status) - the trick might be to add a second condition to that last else to check if the current client is X and if it's the client who you don't want to see the unpaid text, to not output that line.

Link to comment
Share on other sites

if ($status == 'Payment Pending'){
$pdf->Cell(100, 18, strtoupper(Lang::trans('invoices' . str_replace(' ', '', $status))), 'TB', 0, 'C', '1');
} elseif ($userid == "1" && $status == "Unpaid") {
} else {
$pdf->Cell(100, 18, strtoupper(Lang::trans('invoices' . strtolower($status))), 'TB', 0, 'C', '1');
}
$pdf->StopTransform();
$pdf->SetTextColor(0);

that would prevent the "Unpaid" red banner showing for client #1 - all other statuses would appear for them, e.g Paid - but not Unpaid.... it should just be a case of changing the value of "1" to the ID value of this particular client.

Link to comment
Share on other sites

47 minutes ago, brian! said:

if ($status == 'Payment Pending'){
$pdf->Cell(100, 18, strtoupper(Lang::trans('invoices' . str_replace(' ', '', $status))), 'TB', 0, 'C', '1');
} elseif ($userid == "1" && $status == "Unpaid") {
} else {
$pdf->Cell(100, 18, strtoupper(Lang::trans('invoices' . strtolower($status))), 'TB', 0, 'C', '1');
}
$pdf->StopTransform();
$pdf->SetTextColor(0);

that would prevent the "Unpaid" red banner showing for client #1 - all other statuses would appear for them, e.g Paid - but not Unpaid.... it should just be a case of changing the value of "1" to the ID value of this particular client.

Thank you. I will give this a try, and let you know. Really appreciate your help

Link to comment
Share on other sites

  • 1 month later...

Could I put the if condition at the beginning of the report so that if it is that particular client it doesn't display any of the statuses?

Something like:

if ($userid == "1") {
    
} 
elseif ($status == 'Paid') {
    $pdf->SetFillColor(151, 223, 74);
    $pdf->SetDrawColor(110, 192, 70);

Or would it have to go something like:

if ($userid == "1" && $status == 'Draft') {
  
} elseif ($status == 'Draft') {
	  $pdf->SetFillColor(200);
    $pdf->SetDrawColor(140);

} elseif ($userid == "1" && $status == 'Cancelled') {

} elseif ($status == 'Cancelled')
    $pdf->SetFillColor(151, 223, 74);
    $pdf->SetDrawColor(110, 192, 70);

 

Link to comment
Share on other sites

So I have decided, that if I take out the whole status section it will just remove the statues completely. So I think that will be easier, as I seem to have some funny clients.

Please could I ask, this now seems to work, but only if the downloaded PDF is generated. How to I remove the statuses from the client view of an invoice, please and the printable version too? Where would this be?

Edited by kwood
Link to comment
Share on other sites

21 hours ago, kwood said:

Could I put the if condition at the beginning of the report so that if it is that particular client it doesn't display any of the statuses?

you could do this...

if ($userid != "1") {
# Invoice Status
$pdf->SetXY(0, 0);
$pdf->SetFont($pdfFont, 'B', 28);
$pdf->SetTextColor(255);
$pdf->SetLineWidth(0.75);
$pdf->StartTransform();
$pdf->Rotate(-35, 100, 225);
if ($status == 'Draft') {
    $pdf->SetFillColor(200);
    $pdf->SetDrawColor(140);
} elseif ($status == 'Paid') {
    $pdf->SetFillColor(151, 223, 74);
    $pdf->SetDrawColor(110, 192, 70);
} elseif ($status == 'Cancelled') {
    $pdf->SetFillColor(200);
    $pdf->SetDrawColor(140);
} elseif ($status == 'Refunded') {
    $pdf->SetFillColor(131, 182, 218);
    $pdf->SetDrawColor(91, 136, 182);
} elseif ($status == 'Collections') {
    $pdf->SetFillColor(3, 3, 2);
    $pdf->SetDrawColor(127);
} else {
    $pdf->SetFillColor(223, 85, 74);
    $pdf->SetDrawColor(171, 49, 43);
}
if ($status == 'Payment Pending'){
$pdf->Cell(100, 18, strtoupper(Lang::trans('invoices' . str_replace(' ', '', $status))), 'TB', 0, 'C', '1');
} else {
$pdf->Cell(100, 18, strtoupper(Lang::trans('invoices' . strtolower($status))), 'TB', 0, 'C', '1');
}
$pdf->StopTransform();
$pdf->SetTextColor(0);
}

which basically says that if the client ID = 1, then do nothing (show no status), otherwise for all other clients, show the status as normal.

16 hours ago, kwood said:

So I have decided, that if I take out the whole status section it will just remove the statues completely.

simple enough - but then how could a client tell whether an invoice is due or has been paid ?

16 hours ago, kwood said:

So I think that will be easier, as I seem to have some funny clients.

we've all had funny clients over the years - there are some weird people out there! 🙄

16 hours ago, kwood said:

How to I remove the statuses from the client view of an invoice, please and the printable version too? Where would this be?

technically, you could edit the viewinvoice.tpl template and modify it in there... however, if all you want to do is remove the status being displayed, then you could use an action hook to do that by emptying the appropriate variable...

<?php

# ViewInvoice Remove Status Hook
# Written by brian!

function hook_view_invoice_remove_status($vars) {
	
	return array("status" => NULL);
}
add_hook('ClientAreaPageViewInvoice', 1, 'hook_view_invoice_remove_status');

or CSS on the relevant div class (though be aware that this page doesn't use custom.css, so you would have to edit one of the CSS files it uses - but that's not really worth it).

.... and in case you only want to do this for your funny client, e.g remove status for them, but every other client gets to see it as normal...

<?php

# ViewInvoice Remove Status Hook
# Written by brian!

function hook_view_invoice_remove_status($vars) {
	
	$client = Menu::context('client');
	if ($client->id == "1") {
		return array("status" => NULL);
	}
}
add_hook('ClientAreaPageViewInvoice', 1, 'hook_view_invoice_remove_status');
Link to comment
Share on other sites

Hi Brian,

Yes, it is really for this one customer, they do not seem to like any of the statues available. But I honestly think it makes sense for their reference and mine. But like I have mentioned, they are a funny client.

I really appreciate your help, thank you. 

Link to comment
Share on other sites

On 19/06/2021 at 2:57 PM, brian! said:

<?php # ViewInvoice Remove Status Hook # Written by brian! function hook_view_invoice_remove_status($vars) { $client = Menu::context('client'); if ($client->id == "1") { return array("status" => NULL); } } add_hook('ClientAreaPageViewInvoice', 1, 'hook_view_invoice_remove_status');

I have done above what you have explained for my particular client:

 

function hook_view_invoice_remove_status($vars) {
    
    $client = Menu::context('client');
    if ($client->id == "14") {
        return array("status" => NULL);
    }
}
add_hook('ClientAreaPageViewInvoice', 1, 'hook_view_invoice_remove_status');

But this has not taken the status off, if the invoice is viewed by the client under the 'view as client' tab and also if you select to print it, and it still shows it in the preview.

Link to comment
Share on other sites

21 hours ago, kwood said:

But this has not taken the status off, if the invoice is viewed by the client under the 'view as client' tab and also if you select to print it, and it still shows it in the preview.

try...

<?php

# ViewInvoice Remove Status Hook
# Written by brian!

function hook_view_invoice_remove_status($vars) {
	
    if ($vars['userid'] == "14") {
        return array("status" => NULL);
    }
}
add_hook('ClientAreaPageViewInvoice', 1, 'hook_view_invoice_remove_status');
Link to comment
Share on other sites

2 hours ago, brian! said:

try...


<?php

# ViewInvoice Remove Status Hook
# Written by brian!

function hook_view_invoice_remove_status($vars) {
	
    if ($vars['userid'] == "14") {
        return array("status" => NULL);
    }
}
add_hook('ClientAreaPageViewInvoice', 1, 'hook_view_invoice_remove_status');

Great, that has worked perfectly, thank you

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated