*** empty log message ***
[fa-stable.git] / reporting / includes / reports_classes.inc
index f5c64f19585089b70631a291c9014de944f8087d..995a39d73c7a535481c3678fd155ecb1e765958a 100644 (file)
@@ -85,7 +85,13 @@ class Report
        }
        function getDisplay() 
        {
-               global $path_to_root, $use_date_picker;
+               global $comp_path, $path_to_root, $use_date_picker;
+
+               $rep_file = $comp_path.'/'.user_company().
+                    "/reporting/rep".$this->id.".php";  
+               if (!file_exists($rep_file))
+                   $rep_file = $path_to_root ."/reporting/rep".$this->id.".php";
+                   
                $st = "
 <script language='javascript'>
        function displayReport_" . $this->id . "() {
@@ -98,7 +104,7 @@ class Report
 
                window.open('','REP_WINDOW','toolbar=no,scrollbar=no,resizable=yes,menubar=no');
                document.forms[0].target='REP_WINDOW';
-               document.forms[0].action= '" . $path_to_root . "/reporting/rep" . $this->id . ".php';
+               document.forms[0].action= '$rep_file';
                document.forms[0].submit();
        }
        function checkDate(pObj) {
@@ -138,12 +144,12 @@ class Report
                                        if ($param->param_type == 'DATEBEGINM')
                                                $date = begin_month($date);
                                        elseif ($param->param_type == 'DATEENDM')
-                                               $date = enc_month($date);
+                                               $date = end_month($date);
                                        elseif ($param->param_type == 'DATEBEGINTAX' || $param->param_type == 'DATEENDTAX')
                                        {
                                                $row = get_company_prefs();
                                                $edate = add_months($date, -$row['tax_last']);
-                                               $edate = enc_month($edate);
+                                               $edate = end_month($edate);
                                                if ($param->param_type == 'DATEENDTAX')
                                                        $date = $edate;
                                                else
@@ -156,7 +162,7 @@ class Report
                                        //$st .= "<input type='text' name='$name' value='$date' onblur='javascript:checkDate(this)'>";
                                        $st .= "<input type='text' name='$name' value='$date'>";
                                        if ($use_date_picker)
-                                               $st .= "<a href=\"javascript:date_picker('document.forms[0].$name', document.forms[0].$name.value);\">"
+                                               $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";
                                        
                                        break;
@@ -164,6 +170,10 @@ class Report
                                        $sel = array(_('No'), _("Yes"));
                                        $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel);
                                        break;
+                               case 'PAYMENT_LINK':    
+                                       $sel = array(_("No Payment Link"), "PayPal");
+                                       $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel);
+                                       break;
                                case 'COMPARE':
                                        $sel = array(_("Accumulated"), _("Period Y-1"), _("Budget"));
                                        $st .= dup_simple_name_list("RP_" . $this->id . "_$index", $sel);
@@ -242,6 +252,16 @@ class Report
                                                FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE (type=10 OR type=11) AND ".TB_PREF."debtors_master.debtor_no=".TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC";
                                        $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
                                        break;
+                               case 'DELIVERY':
+                                       $DN = _("DN");
+                                       $sql = "SELECT 
+                                       concat(".TB_PREF."debtor_trans.trans_no, '-', ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.trans_no, ' $DN ', 
+                                        ".TB_PREF."debtors_master.name) as IName 
+                                               FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans 
+                                               WHERE type=13 AND ".TB_PREF."debtors_master.debtor_no=".
+                                               TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC";
+                                       $st .= dup_simple_codeandname_list($sql, "RP_" . $this->id . "_$index", $dummy);
+                                       break;
                                case 'ORDERS':
                                        $sql = "SELECT ".TB_PREF."sales_orders.order_no, concat(".TB_PREF."sales_orders.order_no, '-', 
                                                ".TB_PREF."debtors_master.name) as IName