Fixes in sales reports to use debtor_trans.tax_included field instead of trans_tax_de...
[fa-stable.git] / reporting / includes / reporting.inc
index 12cffc11e558cba7e6841b55e94f9d91dac973a8..8dc119f6629dbd1cb924bf5aec88a44264511c8e 100644 (file)
@@ -15,7 +15,7 @@
 // You only need full parameter list for invoices/credit notes
 
 function print_document_link($doc_no, $link_text, $link=true, $type_no, 
-       $icon=false, $class='printlink', $id='', $email=0)
+       $icon=false, $class='printlink', $id='', $email=0, $extra=0)
 {
        global $path_to_root;
        include_once($path_to_root . "/includes/types.inc");
@@ -51,11 +51,12 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no,
                        $ar = array(
                                'PARAM_0' => $doc_no, 
                                'PARAM_1' => $doc_no, 
-                               'PARAM_2' => $email);
+                               'PARAM_2' => $email,
+                               'PARAM_3' => $extra);
                        break;
                case ST_SALESINVOICE : // Sales Invoice
                case ST_CUSTCREDIT : // Customer Credit Note
-                       $rep = 107;
+                       $rep = $type_no==ST_CUSTCREDIT ? 113 : 107;
                        // from, to, currency, bank acc, email, paylink, comments, type
                        $ar = array(
                                'PARAM_0' => $doc_no, 
@@ -76,6 +77,35 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no,
                                'PARAM_3' => $email, 
                                'PARAM_4' => '');
                        break;
+               case ST_CUSTPAYMENT :
+                       $rep = 112;
+                       // from, to, currency, bank acc, email, comments
+                       $ar = array(
+                               'PARAM_0' => $doc_no, 
+                               'PARAM_1' => $doc_no, 
+                               'PARAM_2' => '', 
+                               'PARAM_4' => '');
+                       break;
+               case ST_SUPPAYMENT :
+                       $rep = 210;
+                       // from, to, currency, bank acc, email, comments
+                       $ar = array(
+                               'PARAM_0' => $doc_no, 
+                               'PARAM_1' => $doc_no, 
+                               'PARAM_2' => '', 
+                               'PARAM_3' => $email, 
+                               'PARAM_4' => '');
+                       break;
+               case ST_WORKORDER :
+                       $rep = 409;
+                       // from, to, currency, bank acc, email, comments
+                       $ar = array(
+                               'PARAM_0' => $doc_no, 
+                               'PARAM_1' => $doc_no, 
+                               'PARAM_2' => $email, 
+                               'PARAM_3' => '', 
+                               'PARAM_4' => '');
+                       break;
 //             default: $ar = array();
        }