Rerun
[fa-stable.git] / reporting / includes / reports_classes.inc
index cde5447ddb11c44177cb8fdd5f84402a077f95bd..aee1c00e4b7e2b244124ff335aa6ef245023a5a8 100644 (file)
@@ -32,7 +32,7 @@ class BoxReports
 
        function getDisplay($class=null)
        {
-               global $table_style2, $comp_path, $path_to_root, $pdf_debug, $Ajax;
+               global $table_style, $comp_path, $path_to_root, $pdf_debug, $Ajax;
 
 
                $temp = array_values($this->ar_classes);
@@ -50,7 +50,7 @@ class BoxReports
                                .$_SERVER['PHP_SELF']."?Class=$class_counter'"
                                ." class='menu_option' id='".default_focus()."'"
                                ." onclick='return showClass($class_counter);'$acc[1]>$acc[0]</a> <br>";
-                       $st_reports .= "<table id='TAB_" . $class_counter ."' $style cellpadding=0 cellspacing=0 border=0 width='100%'><tr><td><b>" . _("Reports For Class: ") . "&nbsp;$key</b></td></tr>\n";
+                       $st_reports .= "<table id='TAB_" . $class_counter ."' $style cellpadding=0 cellspacing=0 width='100%'><tr><td><b>" . _("Reports For Class: ") . "&nbsp;$key</b></td></tr>\n";
                        foreach($value as $report)
                        {
                                $acc = access_string($report->name);
@@ -62,12 +62,11 @@ class BoxReports
 
                                        $action = $path_to_root.'/reporting/prn_redirect.php';
        
-                                       $st_params = "<table border=0><tr><td>\n"
+                                       $st_params = "<table><tr><td>\n"
                                                . "<form method='POST' action='$action' target='_blank'>\n";
-                                       $st_params .= hidden('REP_ID', $report->id, false);
                                        $st_params .= submit('Rep'.$report->id,  
                                                _("Display: ") . access_string($report->name, true),
-                                               false, '', $pdf_debug ? false : 'default') . '<br><br>';
+                                               false, '', $pdf_debug ? false : 'default process') . hidden('REP_ID', $report->id, false).'<br><br>';
                                        $st_params .= $this->getOptions($report->get_controls());
                                        $st_params .= "\n</form></td></tr></table>\n";
                                        set_focus('Rep'.$report->id);
@@ -100,9 +99,9 @@ class BoxReports
                                        }
                                </script>
                                ";
-               $st .= "<table align='center' width='80%' $table_style2><tr valign='top'>";
+               $st .= "<table align='center' width='80%' style='border:1px solid #cccccc;'><tr valign='top'>";
                $st .= "<td width='30%'>$st_classes</td>";
-               $st .= "<td width='35%'>$st_reports</td>";
+               $st .= "<td width='35%' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc;padding-left:3px;'>$st_reports</td>";
                $st .= "<td width='35%'>$st_params</td>";
                $st .= "</tr></table><br>";
 
@@ -149,7 +148,7 @@ class BoxReports
        //
        function get_ctrl($name, $type)
        {
-               global $path_to_root, $use_date_picker, $pdf_debug, $print_invoice_no;
+               global $path_to_root, $use_date_picker, $pdf_debug, $print_invoice_no, $def_print_destination;
 
                $st = '';
                        switch ($type)
@@ -206,7 +205,10 @@ class BoxReports
 
                                case 'DESTINATION':
                                        $sel = array(_("PDF/Printer"), "Excel");
-                                       return array_selector($name, null, $sel);
+                                       $def = 0;
+                                       if (isset($def_print_destination) && $def_print_destination == 1)
+                                               $def = 1;
+                                       return array_selector($name, $def, $sel);
 
                                case 'COMPARE':
                                        $sel = array(_("Accumulated"), _("Period Y-1"), _("Budget"));
@@ -335,6 +337,16 @@ class BoxReports
                                                FROM ".TB_PREF."suppliers, ".TB_PREF."supp_trans WHERE (type=".ST_BANKPAYMENT." OR type=".ST_SUPPAYMENT." OR type=".ST_SUPPCREDIT.") AND ".TB_PREF."suppliers.supplier_id=".TB_PREF."supp_trans.supplier_id ORDER BY ".TB_PREF."supp_trans.trans_no DESC";
                                        return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false));
 
+                               case 'RECEIPT':
+                                       $BD = _("BD");
+                                       $CP = _("CP");
+                                       $CN = _("CN");
+                                       $ref = ($print_invoice_no == 1 ? "trans_no" : "reference");
+                                       $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-',
+                                               ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.$ref, if (type=".ST_BANKDEPOSIT.", ' $BD ', if (type=".ST_CUSTPAYMENT.", ' $CP ', ' $CN ')), ".TB_PREF."debtors_master.name) as IName
+                                               FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE (type=".ST_BANKDEPOSIT." OR type=".ST_CUSTPAYMENT." OR type=".ST_CUSTCREDIT.") AND ".TB_PREF."debtors_master.debtor_no=".TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC";
+                                       return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false));
+
                                case 'ITEMS':
                                        return stock_manufactured_items_list($name);