- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / weberp / TaxAuthorityRates.php
blobbdfe9b53c1200843bed4e824766d5520b57b2758
1 <?php
2 /* $Revision: 1.13 $ */
4 $PageSecurity = 11; // only allow accountant access
6 if (isset($_POST['TaxAuthority'])){
7 $TaxAuthority = $_POST['TaxAuthority'];
9 if (isset($_GET['TaxAuthority'])){
10 $TaxAuthority = $_GET['TaxAuthority'];
13 include('includes/session.inc');
14 $title = _('Tax Rates');
15 include('includes/header.inc');
17 /* <-- $Revision: 1.13 $ --> */
19 if (!isset($TaxAuthority)){
20 prnMsg(_('This page can only be called after selecting the tax authority to edit the rates for') . '. ' . _('Please select the Rates link from the tax authority page') . ".<BR><A HREF='$rootpath/TaxAuthorities.php'>" . _('click here') . '</A> ' . _('to go to the Tax Authority page'),'error');
21 include ('includes/footer.inc');
22 exit;
26 if (isset($_POST['UpdateRates'])){
28 $TaxRatesResult = DB_query('SELECT taxauthrates.taxcatid,
29 taxauthrates.taxrate,
30 taxauthrates.dispatchtaxprovince
31 FROM taxauthrates
32 WHERE taxauthrates.taxauthority=' . $TaxAuthority,
33 $db);
35 while ($myrow=DB_fetch_array($TaxRatesResult)){
37 $sql = 'UPDATE taxauthrates SET taxrate=' . ($_POST[$myrow['dispatchtaxprovince'] . '_' . $myrow['taxcatid']]/100) . '
38 WHERE taxcatid = ' . $myrow['taxcatid'] . '
39 AND dispatchtaxprovince = ' . $myrow['dispatchtaxprovince'] . '
40 AND taxauthority = ' . $TaxAuthority;
41 DB_query($sql,$db);
44 prnMsg(_('All rates updated successfully'),'info');
47 /* end of update code
50 /*Display updated rates
53 $TaxAuthDetail = DB_query('SELECT description FROM taxauthorities WHERE taxid=' . $TaxAuthority,$db);
54 $myrow = DB_fetch_row($TaxAuthDetail);
55 echo '<FONT SIZE=3 COLOR=BLUE><B>' . _('Update') . ' ' . $myrow[0] . ' ' . _('Rates') . '</B></FONT>';
57 echo "<FORM ACTION='" . $_SERVER['PHP_SELF'] . '?' . SID ."' METHOD=POST>";
59 echo "<INPUT TYPE=HIDDEN NAME='TaxAuthority' VALUE=$TaxAuthority>";
61 $TaxRatesResult = DB_query('SELECT taxauthrates.taxcatid,
62 taxcategories.taxcatname,
63 taxauthrates.taxrate,
64 taxauthrates.dispatchtaxprovince,
65 taxprovinces.taxprovincename
66 FROM taxauthrates INNER JOIN taxauthorities
67 ON taxauthrates.taxauthority=taxauthorities.taxid
68 INNER JOIN taxprovinces
69 ON taxauthrates.dispatchtaxprovince= taxprovinces.taxprovinceid
70 INNER JOIN taxcategories
71 ON taxauthrates.taxcatid=taxcategories.taxcatid
72 WHERE taxauthrates.taxauthority=' . $TaxAuthority . "
73 ORDER BY taxauthrates.dispatchtaxprovince,
74 taxauthrates.taxcatid",
75 $db);
77 if (DB_num_rows($TaxRatesResult)>0){
79 echo '<CENTER><TABLE CELLPADDING=2 BORDER=2>';
80 $TableHeader = "<TR><TD Class='tableheader'>" . _('Deliveries From') . '<BR>' . _('Tax Province') . "</TD>
81 <TD Class='tableheader'>" . _('Tax Category') . "</TD>
82 <TD Class='tableheader'>" . _('Tax Rate') . ' %</TD></TR>';
83 echo $TableHeader;
84 $j = 1;
85 $k = 0; //row counter to determine background colour
86 $OldProvince='';
88 while ($myrow = DB_fetch_array($TaxRatesResult)){
90 if ($OldProvince!=$myrow['dispatchtaxprovince'] AND $OldProvince!=''){
91 echo '<TR BGCOLOR="#555555"><FONT SIZE=1> </FONT><TD COLSPAN=3></TD></TR>';
94 if ($k==1){
95 echo "<tr bgcolor='#CCCCCC'>";
96 $k=0;
97 } else {
98 echo "<tr bgcolor='#EEEEEE'>";
99 $k=1;
102 printf('<td>%s</td>
103 <td>%s</td>
104 <td><INPUT TYPE=TEXT NAME=%s MAXLENGTH=5 SIZE=5 VALUE=%s></td>
105 </tr>',
106 $myrow['taxprovincename'],
107 $myrow['taxcatname'],
108 $myrow['dispatchtaxprovince'] . '_' . $myrow['taxcatid'],
109 $myrow['taxrate']*100 );
111 $OldProvince = $myrow['dispatchtaxprovince'];
114 //end of while loop
115 echo '</TABLE>';
116 echo "<BR><INPUT TYPE=SUBMIT NAME='UpdateRates' VALUE='" . _('Update Rates') . "'></CENTER>";
117 } //end if tax taxcatid/rates to show
118 else {
119 prnMsg(_('There are no tax rates to show - perhaps the dispatch tax province records have not yet been created?'),'warn');
122 echo '</FORM>';
124 echo '<BR><A HREF="' . $rootpath . '/TaxAuthorities.php?' . SID . '">' . _('Tax Authorities') . '</A>';
125 echo '<BR><A HREF="' . $rootpath . '/TaxGroups.php?' . SID . '">' . _('Tax Groupings') . '</A>';
126 echo '<BR><A HREF="' . $rootpath . '/TaxCategories.php?' . SID . '">' . _('Tax Categories') . '</A>';
127 echo '<BR><A HREF="' . $rootpath . '/TaxProvinces.php?' . SID . '">' . _('Dispatch Tax Provinces') . '</A>';
129 include( 'includes/footer.inc' );