From 389cac488ce0809645650187f0e11258d4f519e2 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Wed, 1 May 2019 10:00:31 +0200 Subject: [PATCH] Fixed Email Receipt to customer. --- reporting/includes/reporting.inc | 5 +++-- reporting/rep112.php | 28 +++++++++++++++++++++------- reporting/reports_main.php | 1 + sales/customer_payments.php | 1 + 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/reporting/includes/reporting.inc b/reporting/includes/reporting.inc index 80632db2..6062ddca 100644 --- a/reporting/includes/reporting.inc +++ b/reporting/includes/reporting.inc @@ -92,8 +92,9 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no, 'PARAM_0' => $doc_no, 'PARAM_1' => $doc_no, 'PARAM_2' => '', - 'PARAM_3' => '', - 'PARAM_4' => $def_orientation); + 'PARAM_3' => $email, + 'PARAM_4' => '', + 'PARAM_5' => $def_orientation); break; case ST_SUPPAYMENT : $rep = 210; diff --git a/reporting/rep112.php b/reporting/rep112.php index a70b78cb..aaaf783c 100644 --- a/reporting/rep112.php +++ b/reporting/rep112.php @@ -60,8 +60,9 @@ function print_receipts() $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; $currency = $_POST['PARAM_2']; - $comments = $_POST['PARAM_3']; - $orientation = $_POST['PARAM_4']; + $email = $_POST['PARAM_3']; + $comments = $_POST['PARAM_4']; + $orientation = $_POST['PARAM_5']; if (!$from || !$to) return; @@ -82,12 +83,10 @@ function print_receipts() $cur = get_company_Pref('curr_default'); - $rep = new FrontReport(_('RECEIPT'), "ReceiptBulk", user_pagesize(), 9, $orientation); + if ($email == 0) + $rep = new FrontReport(_('RECEIPT'), "ReceiptBulk", user_pagesize(), 9, $orientation); if ($orientation == 'L') recalculate_cols($cols); - $rep->currency = $cur; - $rep->Font(); - $rep->Info($params, $cols, null, $aligns); for ($i = $from; $i <= $to; $i++) { @@ -107,6 +106,16 @@ function print_receipts() $baccount = db_fetch($res); $params['bankaccount'] = $baccount['bank_act']; + if ($email == 1) + { + $rep = new FrontReport("", "", user_pagesize(), 9, $orientation); + $rep->title = _('RECEIPT'); + $rep->filename = "Receipt" . $i . ".pdf"; + } + $rep->currency = $cur; + $rep->Font(); + $rep->Info($params, $cols, null, $aligns); + $contacts = get_branch_contacts($myrow['branch_code'], 'invoice', $myrow['debtor_no']); $rep->SetCommonData($myrow, null, $myrow, $baccount, ST_CUSTPAYMENT, $contacts); $rep->SetHeaderType('Header2'); @@ -180,8 +189,13 @@ function print_receipts() $rep->TextCol(4, 5, _("Branch"), - 2); $rep->TextCol(5, 6, "__________________", - 2); $rep->TextCol(6, 7, "__________________"); + if ($email == 1) + { + $rep->End($email); + } } } - $rep->End(); + if ($email == 0) + $rep->End(); } diff --git a/reporting/reports_main.php b/reporting/reports_main.php index 85c2612f..92bf3d92 100644 --- a/reporting/reports_main.php +++ b/reporting/reports_main.php @@ -156,6 +156,7 @@ $reports->addReport(RC_CUSTOMER, 112, _('Print Receipts'), array( _('From') => 'RECEIPT', _('To') => 'RECEIPT', _('Currency Filter') => 'CURRENCY', + _('Email Customers') => 'YES_NO', _('Comments') => 'TEXTBOX', _('Orientation') => 'ORIENTATION')); diff --git a/sales/customer_payments.php b/sales/customer_payments.php index f314b988..907f789e 100644 --- a/sales/customer_payments.php +++ b/sales/customer_payments.php @@ -102,6 +102,7 @@ if (isset($_GET['AddedID'])) { display_notification_centered(_("The customer payment has been successfully entered.")); submenu_print(_("&Print This Receipt"), ST_CUSTPAYMENT, $payment_no."-".ST_CUSTPAYMENT, 'prtopt'); + submenu_print(_("&Email This Receipt"), ST_CUSTPAYMENT, $payment_no."-".ST_CUSTPAYMENT, null, 1); submenu_view(_("&View this Customer Payment"), ST_CUSTPAYMENT, $payment_no); -- 2.30.2