Minor change in menu and function in view_print_transaction.php
[fa-stable.git] / reporting / includes / reporting.inc
1 <?php
2
3 // Put this on the page only once, e.g. print_hidden_script(systypes::sales_order());
4
5 function print_hidden_script($type_no)
6 {
7         global $path_to_root;
8         include_once($path_to_root . "/includes/types.inc");
9         $action = "";
10         $_POST['PARAM_0'] = $_POST['PARAM_1'] = 0; // the document no. is updated in print_document_link().
11
12         switch ($type_no)
13         {
14                 case systypes::sales_order() :
15                         $action = "$path_to_root/reporting/rep109.php";
16                         $_POST['PARAM_2'] = ""; // currency
17                         $_POST['PARAM_3'] = ""; // bank account
18                         $_POST['PARAM_4'] = 0; // email
19                         $_POST['PARAM_5'] = 0; // quote
20                         $_POST['PARAM_6'] = ""; // comments
21                         $params = 7;
22                         break;
23                 case systypes::cust_dispatch() :
24                         $action = "$path_to_root/reporting/rep110.php";
25                         $_POST['PARAM_2'] = 0; // email
26                         $_POST['PARAM_3'] = ""; // comments
27                         $params = 4;
28                         break;
29                 case 10 : // Sales Invoice
30                 case 11 : // Customer Credit Note
31                         $action = "$path_to_root/reporting/rep107.php";
32                         $_POST['PARAM_2'] = ""; // currency
33                         $_POST['PARAM_3'] = ""; // bank account
34                         $_POST['PARAM_4'] = 0; // email
35                         $_POST['PARAM_5'] = ""; // paylink
36                         $_POST['PARAM_6'] = ""; // comments
37                         $params = 7;
38                         break;
39                 case systypes::po() :
40                         $action = "$path_to_root/reporting/rep209.php";
41                         $_POST['PARAM_2'] = ""; // currency
42                         $_POST['PARAM_3'] = ""; // bank account
43                         $_POST['PARAM_4'] = 0; // email
44                         $_POST['PARAM_5'] = ""; // comments
45                         $params = 6;
46                         break;
47         }
48         $st = "";
49         for ($i = 0; $i < $params; $i++)
50         {
51                 $st .= "<input type='hidden' name='PARAM_".$i."' value='".$_POST['PARAM_'.$i]."' />";
52         }
53         $st = "<form method='post' name='pdf_form' action='$action'>" . $st . "</form>\n";
54         echo $st;
55 }
56
57 // Ex. label_cell(print_document_link($myrow['order_no'], _("Print")));
58 // or display_note(print_document_link($order_no, _("Print this order")));
59 // or if a button
60 // echo "<input type='button' name='button' value='"._("Print this order")."' onclick=\"".
61 //              print_document_link($order_no, "", false)."\" class='inputsubmit' />\n";
62
63 function print_document_link($doc_no, $link_text, $link=true)
64 {
65         $st = "document.pdf_form.PARAM_0.value = '$doc_no';";
66         $st .= "document.pdf_form.PARAM_1.value = '$doc_no';";
67         $st .= "window.open('','REP_WINDOW','toolbar=no,scrollbar=no,resizable=yes,menubar=no');
68                 document.pdf_form.target='REP_WINDOW';
69                 document.pdf_form.submit();\n";
70         if ($link)
71                 return "<a href=\"javascript:$st\">" . $link_text . "</a>";
72         else
73                 return "javascript:$st";
74 }
75 ?>