126

(7 replies, posted in Items and Inventory)

What happens when you allow x-frame options? Does the problem go away?

An iframe is used for the date picker(maybe for other js uses too???)
Any page with a date option will definitely have an iframe, at first glance items don't have a date, but now look at the tabbed content.

SO has numerous posts on the subject - there's even a tag for x-frame-options

@apmuthu, can you help please?


If still problems try:-


Make a clean install, if you get the same problem, it more or less eliminates FA software.

What other php versions do you have besides 7.3.6? I have had issues running 7.2 a while ago, dialed back to 7.1 and all was ok.

127

(7 replies, posted in Items and Inventory)

Hi, you'll need to provide more info for anyone to help you. Version? php version? server type, etc.

Has your server setup changed? Try a clean install?

Use your browser dev mode (F12) to check for errors.


(This was my own yellowtriangle problem - probably not the same issue as you, but will give you some ideas for finding the problem, also search this forum)

128

(13 replies, posted in Reporting)

@apmuthu, @itronics,

For an invoice with one item:-

item one 100,000 tax included

Sub-total 100,000.00
Total Tax Excluded 84,033.61
VAT (19%) 15,966.39
TOTAL INVOICE 100,000.00



And for an invoice with two items:-

item one 100,000 tax included
item two 10,000 no tax (excluded)

gives the following totals:-
Sub-total 110,000.00
Total Tax Excluded 84,033.61
VAT (19%) 15,966.39
TOTAL INVOICE 110,000.00



The 'Sub-total' is not a sub-total at all; it just mimics the Total? At best it's meaningless, at worst it could be confusing?

So for 1st ex
one items
In this case shouldn't the Sub-total be 84,033.61 (total cost before tax)(100,000 - 15,966.39 = 84,033.61)

and 2nd ex
In this case shouldn't the Sub-total be 94,033.61 (total cost before tax)(110,000 - 15,966.39 = 94,033.61)

129

(9 replies, posted in Accounts Payable)

@peacecop kalmer:  can you confirm that for the service item, you selected both Category: AND Item Type: as service, as this screenshot shows

If the Category is not service, go to Items & Inventory->Item Categories and see if the category 'Type' you selected (4th column from the left) is Service

Set your UOM 'hours' to one or two decimal places -  advise two if you want 0.25 - 0.75...

A small 'downside' to this though is that whole numbers are displayed as 1.00 - 2.00...

131

(6 replies, posted in Accounts Receivable)

Please send some screenshots of the issue and some more detail.

132

(2 replies, posted in Setup)

Make a translation, which will change all occurrences of the word.
Or
Change the word in the report

133

(6 replies, posted in Accounts Receivable)

Have you voided an invoice? Sure you have not done a sales order?

At some point, depending on what you have done they will not match, the reference number is different to the system number.
The reference number is your unique number/ value for each transaction: But the system needs a unique number too -
read here and
also read this topic.

So in all the inquiries, use the 'Reference' column to find the right transaction, from there you can see the sys# or order# related to your reference number and then for further investigation if required. (so for the moment ignore sys#, order# look for your unique reference number)

Yes using a "Direct Invoice" does create 'background' transactions
Have a good read about:-

Simple Sales Process
Intermediate Sales Process
Complex Sales Process
here and the related linked pages

You can 'reset' the reference number in Setup->Transaction References, but at some point they will go out of synch again so not advised.

Best advice for a FA beginner is to setup a training company, try things out on there; along with a good read of wiki and this forum, using the training company you can make as many mistakes as you like.

If you are doing something you are not quite sure about on your actual accounts, always make a backup 1st.

There's also some links to learn the basics of accountancy in the wiki as well

134

(3 replies, posted in Translations)

ar_EG was mentioned in this post

Maybe @apmuthu knows of one, though I could not find one in his FA extensions gihub account

Have a look in there, maybe I missed it.

Contact the users who have stated they have a Farsi translation, they may be willing to share?

The other option is to translate into Farsi and share the results

135

(3 replies, posted in Translations)

Other posts indicate that ar_EG in Install/Update Languages is the one you may be looking for.

@rafat; looks like a bug:-

Looking at:-

File: \sales\inquiry\customer_allocation_inquiry.php
151:     _("Due Date") => array('type'=>'date', 'fun'=>'due_date'),

and comparing with:-

File: \purchasing\inquiry\supplier_allocation_inquiry.php
142:     _("Due Date") => array('fun'=>'due_date'),

The supplier due date is not given the type 'date': or any other type.

So in \includes\ui\db_pager_view.inc

its assigned as a normal labelcell:-

File: \includes\ui\db_pager_view.inc
144:               else
145:                     label_cell($cell);

instead of a date labelcell:-

File:\includes\ui\db_pager_view.inc
114:             case 'date':
115:                 label_cell(sql2date($cell), "align='center' nowrap"); break;

I've added to mantis id #0004897

No, system setup priviledge remain with the 1st company.

Yes you are right, but I'm still not sure for your case that you can? 

You are 'restoring' a company from your newly made parent company(2.3)

So briefly with lots of steps missed...normal - existing 2.3 installation, upgrade software to 2.4, then use installation to upgrade DB to 2.4.

You want to install fresh installation of 2.4 then 'restore' with a 2.3DB, the upgrade the DB to 2.4.


You could just try it then compare finished DB with DB that's included; but is it worth all the unknowns and the risk to your DB integrity?

Another way; but with a lot less changes to core:-

Add a third file to merge in \reporting\includes\pdf_report.inc

--- \reporting\includes\pdf_report ORIGINAL.inc
+++ \reporting\includes\pdf_report.inc
@@ -62,6 +62,7 @@
     var $footerEnable;  // select whether to print a page footer or not
     var $footerText;  // store user-generated footer text
     var $headerTmpl;  // store the name of the currently selected header template
+    var $sheaderTmpl;
     var $tmplSize; // pdf header template size in pages
 
     var $rep_id;
@@ -944,8 +945,17 @@
             include($tmpl_php);
         }
 
+        // include related php file if any
+        $stmpl_php = find_custom_file("/reporting/forms/".$this->sheaderTmpl."watermark.php");
+        if ($stmpl_php) {
+            include($stmpl_php);
+        }
+
         if (method_exists($this, $this->headerTmpl))    // draw predefined page layout if any
             $this->{$this->headerTmpl}();
+
+        if (method_exists($this, $this->sheaderTmpl))    // draw predefined page layout if any
+            $this->{$this->sheaderTmpl}();
     }
 
     function End($email=0, $subject='') 

Add a link for a popup window in \reporting\includes\reports_classes.inc

--- \reporting\includes\reports_classes ORIGINAL.inc
+++ \reporting\includes\reports_classes.inc
@@ -103,7 +103,7 @@
                         false, '', $SysPrefs->pdf_debug ? false : 'default process') . hidden('REP_ID', $report->id, false).'<br><br>';
                     $st_params .= $this->getOptions($report->get_controls(), $report->id);
                     $st_params .= "\n<input type=hidden name='Class' value=".$cur_class.">"
-                        ."\n</form></td></tr></table>\n";
+                        ."\n".label_cell(viewer_link(_('Add Watermark/Stamp'), 'reporting/includes/watermark_form.php?popup=1'))."</form></td></tr></table>\n";
                     set_focus('Rep'.$report->id);
                     $Ajax->addUpdate(true, 'rep_form', $st_params);
                 }
@@ -111,6 +111,7 @@
             $st_reports .= "</table>";
         }
 
+        $_SESSION["watermark"][0] = 0;
         $st_params = "<div id='rep_form'>".
             "$st_params</div>";
         

No more changes to core files

Create a file called \reporting\forms\watermark.php

<?php
if ($_SESSION["watermark"][0] == 1) {
    $wm_text = $_SESSION["watermark"][1];
    $wm_color = $_SESSION["watermark"][2];
    $wm_font_size = $_SESSION["watermark"][3];
    $wm_setx = $_SESSION["watermark"][4];
    $wm_sety = $_SESSION["watermark"][5];
    $wm_rotate = $_SESSION["watermark"][6];
    $wm_alpha = $_SESSION["watermark"][7];

    $this->SetX($wm_setx);
    $this->SetY($wm_sety);
    $this->SetFont('','B', $wm_font_size);
    $this->setAlpha($wm_alpha);
    $this->SetTextColorArray($this->convertHTMLColorToDec($wm_color));
    $this->StartTransform();
    $this->Rotate($wm_rotate);
    $this->MultiCell(0,10, $wm_text,0,'C',0,1,0,0);
    $this->StopTransform();
    $this->setAlpha(1);
    $this->SetTextColor(0, 0, 0);
    $this->SetFont('','B', 9);
}

Create a file called \reporting\includes\watermark_form.php

<?php
$page_security = 'SA_OPEN';
$path_to_root="../..";

include_once($path_to_root . "/includes/session.inc");
$js = "";
page(_($help_context = "Add Watermark or Stamp"), @$_REQUEST['popup'], false, "", $js);

include_once($path_to_root . "/includes/ui.inc");

//--------------------------------------------------------------------------------------------

function html_type_input_cells_ex($label, $input_type, $name, $min, $max, $step, $init=null, $title=null,
    $labparams=null, $post_label=null, $submit_on_change=false)
{
    global $Ajax;

    default_focus($name);
    if (!isset($_POST[$name]) || $_POST[$name] == "")
    {
        if ($init)
            $_POST[$name] = $init;
        else
            $_POST[$name] = "";
    }
    if ($label != null)
        label_cell($label, $labparams);

    echo "<td>";
    $class = $submit_on_change ? 'class="searchbox"' : '';
    echo "<input $class type=\"$input_type\" name=\"$name\" min=\"$min\" max=\"$max\" step=\"$step\" value=\"" . $_POST[$name]. "\""
     .($title ? " title='$title'": '')." >";
    

    if ($post_label)
        echo " " . $post_label;

    echo "</td>\n";
    $Ajax->addUpdate($name, $name, $_POST[$name]);
}

function html_type_input_row_ex($label, $input_type, $name, $min, $max, $step, $title=null, $value=null, $params=null, $post_label=null)
{
    echo "<tr><td class='label'>$label</td>";
    html_type_input_cells_ex(null, $input_type, $name, $min, $max, $step, $value, $title, $params, $post_label);

    echo "</tr>\n";
}
//--------------------------------------------------------------------------------------------

function can_process()
{
    if (strlen($_POST['wm_text']) == 0) 
    {
        display_error(_("The Watermark/Stamp Text cannot be empty."));
        set_focus('wm_text');
        return false;
    }

    if (!preg_match('/#([a-f0-9]{3}){1,2}\b/i', $_POST['wm_color']))
    {
        display_error(_("The input value - ".$_POST['wm_color']." is not a valid HTML colour. Input required #000 - #fff OR #000000 - #ffffff"));
        set_focus('wm_color');
        return false;
    } 

    if (!check_num('wm_font_size', 4, 96)) 
    {
        display_error(_("The font size must be between 4 and 96."));
        set_focus('wm_font_size');
        return false;
    }

    if (!check_num('wm_setx', 1, 200))
    {
        display_error(_("Start Point from Left must be between 1 and 200."));
        set_focus('wm_setx');
        return false;
    }

    if (!check_num('wm_sety', 200, 612))
    {
        display_error(_("Start Point from Top must be between 200 and 612."));
        set_focus('wm_sety');
        return false;
    }

    if (!check_num('wm_rotate', 1, 360))
    {
        display_error(_("Rotation angle must be between 1 and 360."));
        set_focus('wm_rotate');
        return false;
    }

    if (!check_num('wm_alpha', 0.05, 1))
    {
        display_error(_("Transparency must be between 0.05 and 1 in steps of 0.05."));
        set_focus('wm_alpha');
        return false;
    }

    return true;
}

// unset($_SESSION['watermark']);// fixit TESTING ONLY
if(isset($_SESSION["watermark"][1]) && ($_SESSION["watermark"][1]) != '') {
    $wm_on = $_SESSION["watermark"][0];
    $wm_text  = $_SESSION["watermark"][1];
    $wm_color = $_SESSION["watermark"][2];
    $wm_font_size = $_SESSION["watermark"][3];
    $wm_setx = $_SESSION["watermark"][4];
    $wm_sety = $_SESSION["watermark"][5];
    $wm_rotate = $_SESSION["watermark"][6];
    $wm_alpha = $_SESSION["watermark"][7];
} else {
    $wm_text = '';
    $wm_color = '#dddddd';
    $wm_font_size = '48';
    $wm_setx = '30';
    $wm_sety = '550';
    $wm_rotate = '45';
    $wm_alpha = '.5';
}

$def = get_post(array('wm_text', 'wm_color', 'wm_font_size', 'wm_setx', 'wm_sety', 'wm_rotate', 'wm_alpha'));

$_POST['wm_text'] = $def["wm_text"];
$_POST['wm_color'] = $def["wm_color"];
$_POST['wm_font_size'] = $def["wm_font_size"];
$_POST['wm_setx'] = $def["wm_setx"];
$_POST['wm_sety'] = $def["wm_sety"];
$_POST['wm_rotate'] = $def["wm_rotate"];
$_POST['wm_alpha'] = $def["wm_alpha"];

start_form();

start_outer_table(TABLESTYLE);
table_section(1);

check_row(_("Turn Off Color Picker"), 'color_input', null, true);
$cp_toggle = isset($_POST['color_input']) ? intval($_POST['color_input']) : 0;
$Ajax->activate('_page_body');
if (!$cp_toggle) {
    $typecolor = 'color';
    $input_html_text = '&nbsp';
} else {
    $typecolor = 'text';
    $input_html_text = '#000 - #fff OR #000000 - #ffffff';
}

end_outer_table(1);

start_outer_table(TABLESTYLE);

table_section(1);
table_section_title(_("Quick Settings"));

textarea_row(_("Watermark/Stamp Text:"), 'wm_text', $wm_text, 35, 3);
html_type_input_row_ex(_("Watermark/Stamp Colour:"), $typecolor, 'wm_color', 4, 7, '', '', $wm_color, null, $input_html_text);

table_section_title(_("Position & Visibility Settings"));

html_type_input_row_ex(_("Font Size:"), 'number', 'wm_font_size', 4, 96, '', '', $wm_font_size, null, _("pt (point): 4 - 96"));
html_type_input_row_ex(_("Start Point from Left:"), 'number', 'wm_setx', 1, 400, '', '', $wm_setx, null, _("pt (point): 1 - 400"));
html_type_input_row_ex(_("Start Point from Top:"), 'number', 'wm_sety', 200, 612, '', '', $wm_sety, null, _("pt (point): 200 - 612"));
html_type_input_row_ex(_("Rotation Angle:"), 'number', 'wm_rotate', 1, 360, '', '', $wm_rotate, null, _("Degrees: 1 - 360"));
html_type_input_row_ex(_("Transparency:"), 'number', 'wm_alpha', 0.05, 1, 0.05, '', $wm_alpha, null, _("Transparency: 0.05 - 1"));

if (isset($_POST['submit']) && can_process()) {
    $wm_on = 1;
    $wm_text = ($_POST['wm_text']);
    $wm_color = ($_POST['wm_color']);
    $wm_font_size = ($_POST['wm_font_size']);
    $wm_setx = ($_POST['wm_setx']);
    $wm_sety = ($_POST['wm_sety']);
    $wm_rotate = ($_POST['wm_rotate']);
    $wm_alpha = ($_POST['wm_alpha']);
    
    $wm_array=array($wm_on, $wm_text, $wm_color, $wm_font_size, $wm_setx, $wm_sety, $wm_rotate, $wm_alpha);
    
    $_SESSION['watermark']=$wm_array;
    $Ajax->activate('_page_body');
    display_notification(_("Watermark/Stamp has been added, now close window and print report."));
}

end_outer_table(1);

submit_center('submit', _("Add Watermark/Stamp"), true, '', 'default');

// submit_center('submit', _("Add Watermark/Stamp"), true, _("Add Watermark/Stamp"), 'selector'); // fixit does not work
// echo "<pre>";
// print_r ($_SESSION);
// echo "<pre>";
end_form(2);
end_page(); 

Notes:
1.    I cannot get popup window to close by using the submit button; currently you have close window or press ‘Back’ after pressing submit button.
2.    Previous settings are retained for session life, so will return to ‘default’ on next login .
3.    Will work for ALL reports including extensions.
4.    Existing header, header2 .php & .pdf if present still merge.
Demo here
username: demo
Password: password

Screenshots
Interface

Result

You can set the default company in Create/Update Company; is that what you want?

For a new installation of V2.3 using one of the companies from your backup

1. Select all tables with your chosen prefix copy this to a new file
2. Find and replace prefix with 0_
3. Save file: after install upload file, select file in Backup & restore and restore.

Don't think its possible to go from 2.3 directly to 2.4.6 have a look at the 'Announcements' forum; read the 'Sticky' posts.

Please note there are DB changes, so the company template you made above with have to be changed OR upgraded for 2.4.6

The only thing I can think it is my post # 2 above
Please post a screenshot of Items & Inventory->Supplier Purchasing Data for that item.

Otherwise I cannot think of anything else.

Look at how the items were purchased and then sold?

Inventory adjustments?

Is date always the 5th column in function display_db_pager?

If it is you could use a nth child css selector?

If it is not always the same column, you would have to include the division(3rd line of same function) such as div#_doc_tbl_span(customer allocation) or div#_trans_tbl_span(customer transactions) to give a unique selector and change the nth child number accordingly; but its used 22 times, so possibly 22 different div# id's.


Edit: the above may affect other tables as well, so you would have to add an addition class:-

change

File: \includes\ui\db_pager_view.inc
115:                 label_cell(sql2date($cell), "align='center' nowrap"); break;

to 

File: \includes\ui\db_pager_view.inc
115:                 label_cell(sql2date($cell), "align='center' nowrap class='mystyle'"); break;

Now 'mystyle' is unique; so can be formatted how you want


Or you can you use inline styling directly to the function

Hi, maybe you are using the purchase conversion in Items & Inventory->Supplier Purchasing Data for that item?

Go to that page, select the items you have a problem with, see if a conversion factor is set - default is 1.

So if a conversion factor is set at 10 (supplier sells in packs of 10), purchasing 1 of this item will actually result in purchasing 10 of this item.
So it seems like some one has purchased 10 of this item (thinking they want 10), but due to the convesion factor they have actually purchased 100.

If this is not the case you need to give more details of your issue

144

(7 replies, posted in Installation)

Yes the dashboard is integrated in 2.4

Is this still unresolved? Cannot find entry in mantis for it

This is still a bug in 2.4.6

The included 'dropdown' theme in 2.4.6 render.php does not have the function call add_access_extensions() and still gives the same Undefined index: errors for installed extensions as previous posts in this topic.

To replicate

clean install 2.4.6
From Install/Activate Extensions downloaded FrontHrm; activated; changed access roles.

No other changes or ext installed

Works fine for themes default & canvas, but not theme dropdown

146

(7 replies, posted in Installation)

did you restart your server?

is System Diagnostics now showing V5.4?

For the record what was your previous php version?

147

(7 replies, posted in Installation)

It looks like your php version has changed.

Go to setup-> system information and there you will see the php version used.

You may need to be using a lower version for 2.3


Or upgrade to 2.4

@apmuthu, in this post you have shown how header.php & header2.php can be used as alternatives to the .pdf versions @Janusz mentions above.

So a suggested alternative could be:-

create file /reporting/forms/header.php with function Draw_watermark from above (header2.php as well)

create popup window on F2

enter watermark text and colour (The other variables could be included as well) parse to header.php

close popup, choose rest of report options and process report

Would this work?

If it does, then I think the only changes to existing core would be to enable the popup ($popup_editors array, etc.) and additional files header.php, header2.php (does header3.php also work?) and the popup window file.

Also the watermark could be used on all reports(including report exts) as and when required.

Thoughts please

Would it be better to call the function Draw_watermark within the 3 header functions?

If this is possible; I think it will write the watermark first, then the report text would overwrite and therefore still be legible: and then the two setAlpha lines can be removed from the function. (Light/contrasting colours would have to be selected)
Also possibly the setX & Y could be removed: their settings would be moved to to the last two parameters of  MultiCell. (As it is using these parameters moves the watermark 3/4 of the way across the page; cutting off some of the text)

I had not realised that TCPDF has its own html to rgb function:-

File: \reporting\includes\tcpdf.php
5671:         function convertHTMLColorToDec($color="#000000") {

I have changed the Draw_watermark function in post #1 above to reflect this and deleted the function html2rgb as it is no longer necessary.