Added optional link for electronic payment on invoices (PayPal)
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 6 Sep 2007 15:13:38 +0000 (15:13 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 6 Sep 2007 15:13:38 +0000 (15:13 +0000)
CHANGELOG.txt
reporting/includes/doctext.inc
reporting/includes/doctext2.inc
reporting/includes/pdf_report.inc
reporting/includes/reports_classes.inc
reporting/rep107.php
reporting/reports_main.php

index 8e9e7b2d851caaf492ac8b1593f6ee379f4e4b58..4e59d502c19001c78bd7fe73d741f8333455e3a6 100644 (file)
@@ -19,6 +19,15 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+06-Sep-2007 Joe Hunt
+ + Added optional link for electronic payment on invoices (PayPal)
+ $ /reporting/reports_main.php
+   /reporting/rep107.php
+   /reporting/includes/report_classes.inc
+   /reporting/includes/pdf_report.inc
+   /reporting/includes/doc_text.inc
+   /reporting/includes/doc_text2.inc
+   
 23-Aug-2007 Joe Hunt
  # Unnecessary parameter ($db) in check_for_recursive_bom
  $ /manufacturing/manage/bom_edit.php
index 38ba3aa8558b3eeaec938f36d868f01e4db54271..8ef084b43a136676c90a9eadc7f9e129bc14863d 100644 (file)
@@ -22,6 +22,7 @@ if (isset($header2type))
        $doc_Phone_Fax_Email = _("Phone/Fax/Email");
        $doc_Bank = _("Bank");
        $doc_Bank_Account = _("Bank Account");
+       $doc_Payment_Link = _("You can pay through");
        if ($doctype == 8 || $doctype == 9 || $doctype == 10 || $doctype == 11)
        {
                if ($doctype == 8)
@@ -51,6 +52,7 @@ if (isset($emailtype))
        $doc_Dear_Sirs = _("Dear Sirs");
        $doc_AttachedFile = _("Attached you will find ");
        $doc_Kindest_regards = _("Kindest regards");
+       $doc_Payment_Link = _("You can pay through");
 }
 if (isset($header2type) || isset($linetype))
 {
index 43394c38a490204e07d5dcdf0390b18ca786ae57..f509b5d7173405a67883e7f5a52178e212cd1da7 100644 (file)
@@ -22,6 +22,7 @@ if (isset($header2type))
        $doc_Phone_Fax_Email = "Phone/Fax/Email";
        $doc_Bank = "Bank";
        $doc_Bank_Account = "Bank Account";
+       $doc_Payment_Link = "You can pay through";
        if ($doctype == 8 || $doctype == 9 || $doctype == 10 || $doctype == 11)
        {
                if ($doctype == 8)
@@ -51,6 +52,7 @@ if (isset($emailtype))
        $doc_Dear_Sirs = "Dear Sirs";
        $doc_AttachedFile = "Attached you will find ";
        $doc_Kindest_regards = "Kindest regards";
+       $doc_Payment_Link = "You can pay through";
 }
 if (isset($header2type) || isset($linetype))
 {
index e1455554def1682038dffbb58d0d03faaae73135..c6ea80bc65c67a4aeae6a1869aae4cf828a28b80 100644 (file)
@@ -326,7 +326,7 @@ class FrontReport extends Cpdf
                if ($this->company['coy_logo'] != '')
                {
                        $logo = $path_to_root . "themes/default/images/" . $this->company['coy_logo'];
-                       $this->AddImage($logo, $ccol, $iline1 + 5, 220, 40);
+                       $this->AddImage($logo, $ccol, $iline1 + 5, 250, 40);
                }
                else
                {
@@ -444,6 +444,21 @@ class FrontReport extends Cpdf
                $temp = $this->row - 2 * $this->lineHeight;
                $this->row = $iline5 - $this->lineHeight - 6;
                $this->Text($ccol, $doc_Please_Quote . " - " . $myrow['curr_code']);
+               if ($branch['disable_branch'] > 0) // payment links
+               {
+                       if ($branch['disable_branch'] == 1)
+                       {
+                               $this->NewLine();
+                               $amt = number_format($myrow["ov_freight"] + $myrow["ov_gst"] +  $myrow["ov_amount"], user_price_dec());
+                               $txt = $doc_Payment_Link . " PayPal: "; 
+                               $url = "https://www.paypal.com/xclick/business=" . $this->company['email'] . "&item_name=" .
+                                       $this->title . "+" . $myrow['reference'] . "&amount=" . $amt . "&currency_code=" . $myrow['curr_code'];
+                               $this->fontSize -= 2;
+                               $this->Text($ccol, $txt.$url);
+                               $this->addLink($url, $ccol, $this->row, $this->pageWidth - $this->rightMargin, $this->row - $this->lineHeight);
+                               $this->fontSize += 2;
+                       }       
+               }
                if ($this->params['comments'] != '')
                {
                        $this->NewLine(2);
@@ -632,7 +647,19 @@ class FrontReport extends Cpdf
                        $from = $this->company['coy_name'] . " <" . $this->company['email'] . ">";
                        $to = $myrow['DebtorName'] . " <" . $myrow['email'] . ">";
                        $msg = $doc_Dear_Sirs . ",\n\n" . $doc_AttachedFile . " " . $subject . 
-                               "\n\n" . $doc_Kindest_regards . "\n\n";
+                               "\n\n";
+                               if ($myrow['dimension_id'] > 0) // helper for payment links
+                               {
+                                       if ($myrow['dimension_id'] == 1)
+                                       {
+                                               $amt = number_format($myrow["ov_freight"] + $myrow["ov_gst"] +  $myrow["ov_amount"], user_price_dec());
+                                               $txt = $doc_Payment_Link . " PayPal: "; 
+                                               $url = "https://www.paypal.com/xclick/business=" . $this->company['email'] . "&item_name=" .
+                                                       $this->title . "+" . $myrow['reference'] . "&amount=" . $amt . "&currency_code=" . $myrow['curr_code'];
+                                               $msg .= $txt . $url . "\n\n";   
+                                       }       
+                               }
+                       $msg .= $doc_Kindest_regards . "\n\n";
                        $sender = $this->user . "\n" . $this->company['coy_name'];
                        $mail->to($to);
                        $mail->subject($subject);
index 9c6834a8f227bd134eda0507ffa183cc70244dec..badf6308fabea23ca8b5d05f3859058284a313ab 100644 (file)
@@ -164,6 +164,10 @@ class Report
                                        $sel = array(_('No'), _("Yes"));
                                        $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel);
                                        break;
+                               case 'PAYMENT_LINK':    
+                                       $sel = array(_("No Payment Link"), "PayPal");
+                                       $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel);
+                                       break;
                                case 'COMPARE':
                                        $sel = array(_("Accumulated"), _("Period Y-1"), _("Budget"));
                                        $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel);
index 653347e8a1ffc6f36f339c17afe43d5763d8b32d..966fe7dd2d667a47e859f21394093478eece6d7e 100644 (file)
@@ -32,7 +32,8 @@ function print_invoices()
        $currency = $_POST['PARAM_2'];
        $bankaccount = $_POST['PARAM_3'];
        $email = $_POST['PARAM_4'];     
-       $comments = $_POST['PARAM_5'];
+       $paylink = $_POST['PARAM_5'];   
+       $comments = $_POST['PARAM_6'];
 
        if ($from == null)
                $from = 0;
@@ -70,6 +71,7 @@ function print_invoices()
                                continue;
                        $myrow = get_customer_trans($i, $j);
                        $branch = get_branch($myrow["branch_code"]);
+                       $branch['disable_branch'] = $paylink; // helper
                        if ($j == 10)
                                $sales_order = get_sales_order($myrow["order_"]);
                        else
@@ -175,6 +177,7 @@ function print_invoices()
                        $rep->Font();   
                        if ($email == 1)
                        {
+                               $myrow['dimension_id'] = $paylink; // helper for pmt link
                                if ($myrow['email'] == '')
                                {
                                        $myrow['email'] = $branch['email'];
index 1cabc95504842d99396ac1d0843104a9deebf68b..fcaeab3938812270b0e97fe8ae666e70a9418a89 100644 (file)
@@ -53,6 +53,7 @@ $reports->addReport(_('Customer'),107,_('Print Invoices/Credit Notes'),
                        new ReportParam(_('Currency Filter'),'CURRENCY'), 
                        new ReportParam(_('Bank Account'),'BANK_ACCOUNTS'), 
                        new ReportParam(_('email Customers'),'YES_NO'), 
+                       new ReportParam(_('Payment Link'),'PAYMENT_LINK'), 
                        new ReportParam(_('Comments'),'TEXTBOX')));
 $reports->addReport(_('Customer'),108,_('Print Statements'),
        array(  new ReportParam(_('Customer'),'CUSTOMERS_NO_FILTER'),