Rerun. Backport of fixing vertical alignment on date picker icon
[fa-stable.git] / reporting / includes / reports_classes.inc
index f9d49d788ff02e834a8cf82a18847885c1aaabd5..b227e114d94965dcee78edf91378543184601d90 100644 (file)
@@ -78,7 +78,7 @@ class BoxReports
                                ."$acc[1]>$acc[0]</a> <br>";
 
                        $style = $class_id==$cur_class ? '' : "style='display:none'";
-                       $st_reports .= "<table class='repclass' id='TAB_" . $class_id ."' $style cellpadding=0 cellspacing=0 border=0 width='100%'><tr><td><b>" . _("Reports For Class: ") . "&nbsp;$name</b></td></tr>\n";
+                       $st_reports .= "<table class='repclass' id='TAB_" . $class_id ."' $style cellpadding='0' cellspacing='0' border='0' width='100%'><tr><td><b>" . _("Reports For Class: ") . "&nbsp;$name</b></td></tr>\n";
                        foreach($this->ar_reports[$class_id] as $rep_id => $report)
                        {
                                $acc = access_string($report->name);
@@ -137,6 +137,9 @@ class BoxReports
                                if ($ctrl) break;
                        }
                        if ($ctrl == '') {
+                               if (($id == 102 || $id == 202) && $cnt == 3) // set default Show Also Allocated to Yes in aged reports 2014-09-19 Joe Hunt
+                                       $_POST['PARAM_'.$cnt] = 1;
+                               
                                if (isset($_COOKIE['select'][$id][$cnt])) // saved parameters 2010-10-06 Joe Hunt
                                        $_POST['PARAM_'.$cnt] = $_COOKIE['select'][$id][$cnt];
                                $ctrl = $this->get_ctrl('PARAM_'.$cnt, $type);
@@ -165,7 +168,7 @@ class BoxReports
        function get_ctrl($name, $type)
        {
                global $path_to_root, $use_date_picker, $pdf_debug, $print_invoice_no,
-                       $def_print_destination, $type_shortcuts;
+                       $def_print_destination, $def_print_orientation, $type_shortcuts;
 
                $st = '';
                        switch ($type)
@@ -212,8 +215,12 @@ class BoxReports
                                                $date = $_POST[$name];
                                        $st = "<input type='text' name='$name' value='$date'>";
                                        if ($use_date_picker)
+                                       {
+                                               $calc_image = (file_exists("$path_to_root/themes/".user_theme()."/images/cal.gif")) ? 
+                                                       "$path_to_root/themes/".user_theme()."/images/cal.gif" : "$path_to_root/themes/default/images/cal.gif";
                                                $st .= "<a href=\"javascript:date_picker(document.forms[0].$name);\">"
-                                               . "     <img src='$path_to_root/themes/default/images/cal.gif' width='16' height='16' border='0' alt='"._('Click Here to Pick up the date')."'></a>\n";
+                                               . "     <img src='$calc_image' style='vertical-align:middle;padding-bottom:4px;width:16px;height:16px;border:0;' alt='"._('Click Here to Pick up the date')."'></a>\n";
+                                       }       
                                        return $st;
                                        break;
 
@@ -221,8 +228,7 @@ class BoxReports
                                        return yesno_list($name);
 
                                case 'PAYMENT_LINK':
-                                       $sel = array(_("No payment Link"), "PayPal");
-                                       return array_selector($name, null, $sel);
+                                       return payment_services($name, null);
 
                                case 'DESTINATION':
                                        $sel = array(_("PDF/Printer"), "Excel");
@@ -231,6 +237,13 @@ class BoxReports
                                                $def = 1;
                                        return array_selector($name, $def, $sel);
 
+                               case 'ORIENTATION':
+                                       $sel = array(_("Portrait"), _("Landscape"));
+                                       $def = 0;
+                                       if (isset($def_print_orientation) && $def_print_orientation == 1)
+                                               $def = 1;
+                                       return array_selector($name, $def, $sel);
+
                                case 'COMPARE':
                                        $sel = array(_("Accumulated"), _("Period Y-1"), _("Budget"));
                                        return array_selector($name, null, $sel);
@@ -301,11 +314,18 @@ class BoxReports
 
                                case 'INVOICE':
                                        $IV = $type_shortcuts[ST_SALESINVOICE];
+                                       $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('$IV ', ".TB_PREF."debtor_trans.$ref,' ', ".TB_PREF."debtors_master.name) as IName
+                                               FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE type=".ST_SALESINVOICE." 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 'CREDIT':
                                        $CN = $type_shortcuts[ST_CUSTCREDIT];
                                        $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_SALESINVOICE.", ' $IV ', ' $CN '), ".TB_PREF."debtors_master.name) as IName
-                                               FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE (type=".ST_SALESINVOICE." 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";
+                                               ".TB_PREF."debtor_trans.type) AS TNO, concat('$CN ', ".TB_PREF."debtor_trans.$ref,' ', ".TB_PREF."debtors_master.name) as IName
+                                               FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE 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 'DELIVERY':
@@ -354,16 +374,21 @@ class BoxReports
                                case 'RECEIPT':
                                        $BD = $type_shortcuts[ST_BANKDEPOSIT];
                                        $CP = $type_shortcuts[ST_CUSTPAYMENT];
-                                       $CN = $type_shortcuts[ST_CUSTCREDIT];
                                        $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
+                                               ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.$ref, if (type=".ST_BANKDEPOSIT.", ' $BD ', ' $CP '), ".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);
 
+                               case 'ITEMS_ALL':
+                                       return stock_manufactured_items_list($name, null, true);
+
+                               case 'ITEMS_P':
+                                       return stock_purchasable_items_list($name, null, true);
+                               
                                case 'WORKORDER':
                                        $sql = "SELECT ".TB_PREF."workorders.id, concat(".TB_PREF."workorders.id, '-',
                                                ".TB_PREF."stock_master.description) as IName