Final rewriting of sales module and some smaller changes.
[fa-stable.git] / reporting / includes / reports_classes.inc
index f5c64f19585089b70631a291c9014de944f8087d..761ef43cb922364f0e28d5740e9ad38a9b5b70af 100644 (file)
@@ -138,12 +138,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 +156,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 +164,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 +246,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