5c28c8939ba5d65ef3a25f3e89fd182b8e6efaea
[fa-stable.git] / includes / ui / ui_msgs.inc
1 <?php
2 /**********************************************************************
3     Copyright (C) FrontAccounting, LLC.
4         Released under the terms of the GNU General Public License, GPL, 
5         as published by the Free Software Foundation, either version 3 
6         of the License, or (at your option) any later version.
7     This program is distributed in the hope that it will be useful,
8     but WITHOUT ANY WARRANTY; without even the implied warranty of
9     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
10     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 function display_error($msg, $center=true)
13 {
14         global $go_debug;
15
16         $bt = $go_debug>1 ? ('<hr>'.get_backtrace(true)) : '';
17         trigger_error($msg.$bt, E_USER_ERROR);
18 }
19
20 function display_notification($msg, $center=true)
21 {
22         trigger_error($msg, E_USER_NOTICE);
23 }
24
25 function display_warning($msg, $center=true)
26 {
27         trigger_error($msg, E_USER_WARNING);
28 }
29
30 function display_notification_centered($msg)
31 {
32         display_notification($msg, true);
33 }
34
35 function display_heading($msg)
36 {
37         echo "<center><span class='headingtext'>$msg</span></center>\n";        
38 }
39
40 function display_heading2($msg)
41 {
42         echo "<center><span class='headingtext2'>$msg</span></center>\n";       
43 }
44
45 function display_note($msg, $br=0, $br2=0, $extra="")
46 {
47         for ($i = 0; $i < $br; $i++)
48                 echo "<br>";
49         if ($extra != "")       
50                 echo "<center><span $extra>$msg</span></center>\n";     
51         else    
52                 echo "<center><span>$msg</span></center>\n";    
53         for ($i = 0; $i < $br2; $i++)
54                 echo "<br>";
55 }
56
57 function stock_item_heading($stock_id)
58 {
59         if ($stock_id != "") 
60         {
61                 $result = db_query("SELECT description, units FROM ".TB_PREF."stock_master WHERE stock_id=".db_escape($stock_id));
62         $myrow = db_fetch_row($result);
63         
64         display_heading("$stock_id - $myrow[0]"); 
65         $units = $myrow[1];
66         display_heading2(_("in units of : ") . $units);         
67         }
68 }
69
70 ?>