PageRenderTime 46ms CodeModel.GetById 7ms RepoModel.GetById 1ms app.codeStats 0ms

/ebpls5502.php

http://ebpls.googlecode.com/
PHP | 2180 lines | 1866 code | 153 blank | 161 comment | 181 complexity | 56facd19080ab682903326f69bcaf9cb MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. include'lib/phpFunctions-inc.php';
  3. dbConnect();
  4. $link2db = $dbLink;
  5. if ($cbut=='Add New Record') {
  6. setUrlRedirect('index.php?part=4&class_type=Preference&pref_type=Business&selMode=ebpls_nbusiness&action_=1&reftype=bus');
  7. }
  8. if ($updatetfo=='true') {
  9. echo "<div align=center><font color=red><b><i>Updated Successfully</i></b></font></div>";
  10. }
  11. if ($reqbut=='Add New Record') {
  12. setUrlRedirect('index.php?part=4&class_type=Preference&selMode=ebpls_nbusiness&action_=21&reftype=req');
  13. }
  14. if ($psicbut=='ADD') {
  15. setUrlRedirect('<?php echo $PHP_SELF;?>?part=<?php echo $part;?>&class_type=<?php echo $class_type; ?>&pref_type=Business&selMode=<?php echo $selMode;?>&action_=91&reftype=$reftype');
  16. }
  17. if ($tfobut=='Add New Record') {
  18. setUrlRedirect('index.php?part=4&class_type=Preference&pref_type=Business&selMode=ebpls_nbusiness&action_=3&reftype=tfo');
  19. }
  20. //if ($searchnat=='Search Nature') {
  21. //setUrlRedirect('index.php?part=4&class_type=Preference&pref_type=Business&selMode=ebpls_nbusiness&action_=0&orderbyasdes=1&reftype=bus&ssnat=on&snat=$searcheenat');
  22. //}
  23. if (!empty($compEvent) and $compEvent=='Delete'){
  24. /*echo "1yahoo....<br>";
  25. echo "2$natureid<br>";
  26. echo "3$aTFOID<br>";
  27. echo "4$aTAXFEEid";*/
  28. if (!empty($compEvent1)){
  29. //echo "yayayayayayayayaayayayayayayayaayayayayayayaayayayya $oidof_complex";
  30. $deleComplex = "DELETE FROM ebpls_buss_complex WHERE compid = '$oidof_complex'";
  31. $deleComplex1=th_query($deleComplex) or die("Cannot delete...");
  32. $compEvent1="";
  33. }
  34. else {
  35. $compEvent1=1;
  36. }
  37. }
  38. if (isset($iSubmitComplex)){
  39. //echo "yahhhhhhhooooooo";
  40. //echo "$iComplexOption<br>";
  41. $explodeKey=explode("-",$iComplexOption);
  42. //echo "1. $explodeKey[0]<br>"; // tfoid
  43. //echo "2. $explodeKey[1]"; // taxfeeid
  44. //exit;
  45. $iAmountFormula=strip_tags($iAmountFormula);
  46. /*
  47. echo "litotototototo $iAmountFormula<br>";
  48. echo "1$natureid<br>";
  49. echo "2$aTFOID<br>";
  50. echo "3$aTAXFEEid<br>";
  51. echo "=Option: $iOption<br>";
  52. echo "=type: $itfotype<br>";*/
  53. //exit;
  54. $iAddOns=strip_tags($iAddOns);
  55. $insertComplex=mysql_query("INSERT INTO ebpls_buss_complex (taxfeeid,tfoid,coptr,revdate,addons,taxfeeid1,natureid) VALUES ('$aTAXFEEid','$explodeKey[0]','$iOperator',Now(),'$iAddOns','$explodeKey[1]','$natureid' )",$link2db);
  56. //, taxfeeoption='$iOption', itfotype='$itfotype'
  57. $updateMe = mysql_query("UPDATE ebpls_buss_taxfeeother SET taxfeeamtfor='$iAmountFormula', taxfeeoption='$iOption', uom='$iuom',defamt=$iMinAmount WHERE natureid = '$natureid' and tfo_id='$aTFOID' and taxfeeid='$aTAXFEEid' ",$link2db);
  58. //$tbl_DeleRecord_123=th_query($tbl_DeleRecord123)// or die("Cannot Update...");;
  59. $validateID=0;
  60. include'validate-inc.php';
  61. $compEvent1="";
  62. //$eventComplex=1;
  63. }
  64. if (isset($iCancelTFO)){
  65. header("location:index.php?part=$part&class_type=$class_type&pref_type=Business&selMode=$selMode&action_=5");
  66. }
  67. if (isset($iCancelPSIC)){
  68. header("location:index.php?part=$part&class_type=$class_type&pref_type=Business&selMode=$selMode&action_=9");
  69. }
  70. if (isset($iCancelREQ)){
  71. header("location:index.php?part=$part&class_type=$class_type&pref_type=Business&selMode=$selMode&action_=2");
  72. }
  73. if (isset($iCancelNature)){
  74. header("location:index.php?part=$part&class_type=$class_type&pref_type=Business&selMode=$selMode&action_=0");
  75. }
  76. if (isset($iCancelRange)){
  77. header("location:index.php?part=$part&class_type=$class_type&pref_type=Business&natureid=$natureid&action_=1&actionID=1&selMode=$selMode&natureaction=Edit ");
  78. }
  79. if (!empty($valueof_tfoid)){ // delete mode for taxfeeother module listing
  80. //echo "development academy of the philippines";
  81. // this must be given confirmation page first before deletion...(subject for enhancement)
  82. $chkRecord=mysql_query("Select * from ebpls_buss_taxfeeother where taxfeeid='$valueof_tfoid' and tfo_id='$aTFOID' and natureid='$natureid' ",$link2db);
  83. $mychkRow=mysql_num_rows($chkRecord);
  84. if ($mychkRow==1){
  85. $chkData=mysql_fetch_array($chkRecord);
  86. $cnatureid=$chkData[natureid];
  87. $ctaxfeeid=$chkData[taxfeeid];
  88. $ctaxfeeind=$chkData[taxfeeind];
  89. $cMinAmount=$chkData[defamt];
  90. $ctfoid=$chkData[tfoid];
  91. $deleteRec = "DELETE FROM ebpls_buss_taxfeeother WHERE taxfeeid = '$valueof_tfoid' and natureid='$cnatureid' and tfo_id='$ctfoid' ";
  92. $deleteRec_=th_query($deleteRec) or die("Cannot delete...");
  93. if ($ctaxfeeind==3){
  94. $updateNature=mysql_query("UPDATE ebpls_buss_nature SET natureoption=Null WHERE natureid='$cnatureid'",$link2db); // update both nature with L flag for range link.
  95. // check for raxfeeid record in taxfeeother table
  96. $seleTaxFeeOther=mysql_query("Select * from ebpls_buss_taxfeeother WHERE taxfeeid='$ctaxfeeid'",$link2db);
  97. $rowtfother=mysql_num_rows($seleTaxFeeOther);
  98. if ($rowtfother==1){
  99. $cdeleteRec = "DELETE FROM ebpls_buss_taxrange WHERE taxfeeid = '$ctaxfeeid' ";
  100. $cdeleteRec_=th_query($cdeleteRec) or die("Cannot delete...");
  101. } // delete only data with one record...NOT applicable to the multi link range
  102. }
  103. $validateID=3;
  104. include'validate-inc.php';
  105. }
  106. else {
  107. $validateID=1;
  108. include'validate-inc.php';
  109. }
  110. }
  111. // Range Deletion
  112. if (!empty($OkforDelete) and $OkforDelete=='RangeValue'){
  113. $tbl_DeleRecord = "UPDATE ebpls_buss_taxrange SET rangestatus='X' WHERE rangeid = '$rangeid' ";
  114. $tbl_DeleRecord_=th_query($tbl_DeleRecord) or die("Cannot delete...");;
  115. $validateID=3;
  116. include'validate-inc.php';
  117. }
  118. // //////////////
  119. if (isset($iSubmitApplytoNature)){
  120. /*echo "hello.....new...... $iCopytoNature....... old $Xnatureid<br>";
  121. echo "hello.....$aTAXFEEid<br>";
  122. echo "hello.....$aTFOID<br>";*/
  123. $getData=mysql_query("Select * FROM ebpls_buss_taxfeeother WHERE natureid='$Xnatureid' and tfo_id='$aTFOID' and taxfeeid='$aTAXFEEid'",$link2db);
  124. $rowGet=mysql_num_rows($getData);
  125. if ($rowGet==1){
  126. $ngetData=mysql_fetch_array($getData);
  127. $xOption=$ngetData[taxfeeoption];
  128. $xInd=$ngetData[taxfeeind];
  129. $xMode=$ngetData[taxfeemode];
  130. $xAmt=$ngetData[taxfeeamtfor];
  131. $xTax=$ngetData[taxtype];
  132. $niMinAmount=$ngetData[defamt];
  133. $xuom=$ngetData[uom];
  134. $xgetData=mysql_query("Select * FROM ebpls_buss_taxfeeother WHERE natureid='$iCopytoNature' and tfo_id='$aTFOID' and taxfeeid='$aTAXFEEid'",$link2db);
  135. $xrowGet=mysql_num_rows($xgetData);
  136. if ($xrowGet==0){
  137. $selectDistinct=mysql_query("Select DISTINCT taxfeeid FROM ebpls_buss_taxrange order by taxfeeid DESC",$link2db);
  138. $rowDistinct=mysql_numrows($selectDistinct);
  139. if ($rowDistinct>0){
  140. $newgetData=mysql_fetch_array($selectDistinct);
  141. $varnewTaxFeeId=$newgetData[taxfeeid] + 1;
  142. }
  143. else {
  144. exit; // should have a routine here or message for IT support
  145. }
  146. $insertGetdata = mysql_query("INSERT INTO ebpls_buss_taxfeeother (natureid,tfo_id,taxfeeid,taxfeeoption,taxfeeind,taxfeemode,taxfeeamtfor,datecreated,taxtype,uom,defamt) VALUES ($iCopytoNature,$aTFOID,$varnewTaxFeeId,'$xOption','$xInd','$xMode','$xAmt',Now(),'$xTax','$xuom',$niMinAmount)",$link2db) or die("1".mysql_error());
  147. $selectRange=mysql_query("Select * from ebpls_buss_taxrange WHERE taxfeeid='$aTAXFEEid' and rangestatus='A' ORDER BY rangeid",$link2db);
  148. $rowSelectRange=mysql_num_rows($selectRange);
  149. //echo "number of rows... $rowSelectRange";
  150. if ($rowSelectRange>0){
  151. $ctr=0;
  152. //echo "hi to all<br>";
  153. while ($ctr < $rowSelectRange){
  154. $recngetData=mysql_fetch_array($selectRange);
  155. $insertIntoDb=mysql_query("INSERT INTO ebpls_buss_taxrange (taxfeeid,rangelow,rangehigh,rangeamount,rangeind,rangestatus,datecreated) VALUES ('$varnewTaxFeeId','$recngetData[rangelow]','$recngetData[rangehigh]','$recngetData[rangeamount]','$recngetData[rangeind]','$recngetData[rangestatus]',Now())",$link2db);
  156. $ctr++;
  157. }
  158. $updateNature=mysql_query("UPDATE ebpls_buss_nature SET natureoption='C' WHERE natureid='$Xnatureid' or natureid='$iCopytoNature'",$link2db); // update both nature with L flag for range link.
  159. }
  160. $validateID=0;
  161. }
  162. else {
  163. $validateID=6;
  164. }
  165. include'validate-inc.php';
  166. }
  167. else {
  168. $validateID=1;
  169. include'validate-inc.php';
  170. }
  171. }
  172. if (isset($iSubmitCopytoNature)){
  173. $getData=mysql_query("Select * FROM ebpls_buss_taxfeeother WHERE natureid='$Xnatureid' and tfo_id='$aTFOID' and taxfeeid='$aTAXFEEid'",$link2db);
  174. $rowGet=mysql_num_rows($getData);
  175. if ($rowGet==1){
  176. $ngetData=mysql_fetch_array($getData);
  177. $xOption=$ngetData[taxfeeoption];
  178. $xInd=$ngetData[taxfeeind];
  179. $xMode=$ngetData[taxfeemode];
  180. $xAmt=$ngetData[taxfeeamtfor];
  181. $xMinAmount=$ngetData[defamt];
  182. $xTax=$ngetData[taxtype];
  183. $xuom=$ngetData[uom];
  184. $xgetData=mysql_query("Select * FROM ebpls_buss_taxfeeother WHERE natureid='$iCopytoNature' and tfo_id='$aTFOID' and taxfeeid='$aTAXFEEid'",$link2db);
  185. $xrowGet=mysql_num_rows($xgetData);
  186. if ($xrowGet==0){
  187. //echo "hahahahaahhahaahahahahahaha....";
  188. $insertGetdata = mysql_query("INSERT INTO ebpls_buss_taxfeeother (natureid,tfo_id,taxfeeid,taxfeeoption,taxfeeind,taxfeemode,taxfeeamtfor,datecreated,taxtype,uom) VALUES ('$iCopytoNature','$aTFOID','$aTAXFEEid','$xOption','$xInd','$xMode','$xAmt',Now(),'$xTax','$uom',xMinAmount)",$link2db);
  189. $updateNature=mysql_query("UPDATE ebpls_buss_nature SET natureoption='L' WHERE natureid='$Xnatureid' or natureid='$iCopytoNature'",$link2db); // update both nature with L flag for range link.
  190. $validateID=0;
  191. }
  192. else {
  193. $validateID=6;
  194. }
  195. include'validate-inc.php';
  196. }
  197. else {
  198. $validateID=1;
  199. include'validate-inc.php';
  200. }
  201. }
  202. //business nature
  203. if (!empty($actionDeleteStatus) and $actionDeleteStatus=='Ok'){
  204. //$xmyid = mysql_query("UPDATE $tbl_current SET naturestatus='X' WHERE natureid = '$natureid' ",$link2db);
  205. $tbl_DeleRecord = "UPDATE $tbl_current SET naturestatus='X' WHERE natureid = '$natureid' ";
  206. $tbl_DeleRecord_=th_query($tbl_DeleRecord) or die("Cannot delete...");;
  207. $validateID=3;
  208. include'validate-inc.php';
  209. }
  210. if (!empty($natureid) and $natureaction=='Delete'){ //must be cascaded but should check first the link tables...before deletion
  211. $action_=80;
  212. }
  213. else {
  214. $xmyid = mysql_query("SELECT * FROM $tbl_current WHERE natureid = '$natureid' ",$link2db);
  215. if (mysql_affected_rows($link2db)==1 ){
  216. $nidescription_=mysql_fetch_array($xmyid);
  217. $nidescription=$nidescription_[naturedesc];
  218. $niPsicCode=$nidescription_[psiccode];
  219. }
  220. }
  221. //tfo
  222. if ($reftype=='tfo' and $tfoaction=='Activate') {
  223. $tbl_DeleRecord = "UPDATE ebpls_buss_tfo SET tfostatus='A' WHERE tfoid = '$tfoid' ";
  224. $tbl_DeleRecord_=th_query($tbl_DeleRecord);
  225. }
  226. if (!empty($actionDeleteTfo) and $actionDeleteTfo=='Ok'){
  227. $tbl_DeleRecord = "UPDATE ebpls_buss_tfo SET tfostatus='X' WHERE tfoid = '$tfoid' ";
  228. $tbl_DeleRecord_=th_query($tbl_DeleRecord) or die("Cannot delete...");;
  229. //echo "tama naman $tfoid";
  230. $validateID=9;
  231. include'validate-inc.php';
  232. //$action_=5;
  233. }
  234. if (!empty($tfoid) and $tfoaction=='Delete'){ //must be cascaded but should check first the link tables...before deletion
  235. $action_=81;
  236. }
  237. else {
  238. $xmyid = mysql_query("SELECT * FROM $tbl_current WHERE tfoid = '$tfoid' ",$link2db);
  239. //$tbl_ResultId="SELECT * FROM $tbl_current WHERE tfoid = '$tfoid' ";
  240. //$tbl_ResultId_=th_query($tbl_ResultId);
  241. if (mysql_affected_rows($link2db)==1 ){
  242. $nitfodescription_=mysql_fetch_array($xmyid);
  243. $nitfodescription=$nitfodescription_[tfodesc];
  244. $nitfoindicator=$nitfodescription_[tfoindicator];
  245. $nitfotype=$nitfodescription_[taxfeetype];
  246. $nilangtaon=$nitfodescription_[or_print];
  247. $nubert = $nitfodescription_[counter];
  248. $DBtype_=mysql_query("SELECT * FROM ebpls_buss_taxfeetype WHERE taxfeetype = $nitfotype ",$link2db);
  249. if (mysql_affected_rows($link2db)==1 ){
  250. $ntype_=mysql_fetch_array($DBtype_);
  251. $ntypedesc=$ntype_[typedesc];
  252. }
  253. }
  254. }
  255. //requirements
  256. if (!empty($actionDeleteReq) and $actionDeleteReq=='Ok'){
  257. $check_rec = @mysql_query("select count(*) from havereq WHERE reqid = '$bbo' ");
  258. $get_num_rec = @mysql_fetch_array($check_rec);
  259. if ($get_num_rec[0] > 0) {
  260. ?>
  261. print "<div align='center'><font color='red' size='2'>Cannot Delete! Existing Record Found</font></div>";
  262. <?
  263. } else {
  264. $tbl_DeleRecord = mysql_query("Delete from ebpls_buss_requirements WHERE reqid = '$bbo' ");
  265. //echo "tama naman $tfoid";
  266. ?>
  267. <body onload='javascript:alert ("Record Successfully Deleted!");'></body>
  268. <?
  269. //$action_=5;
  270. }
  271. }
  272. if (!empty($reqid) and $reqaction=='Delete'){ //must be cascaded but should check first the link tables...before deletion
  273. //$xmyid = mysql_query("DELETE FROM $tbl_current WHERE tfoid = '$tfoid' ",$link2db);
  274. //$tbl_DeleRecord = "DELETE FROM $tbl_current WHERE reqid = '$reqid' ";
  275. //$tbl_DeleRecord_=th_query($tbl_DeleRecord) or die("Cannot delete...");;
  276. $xmyid = mysql_query("SELECT * FROM $tbl_current WHERE reqid = '$reqid' ",$link2db);
  277. //$tbl_ResultId="SELECT * FROM $tbl_current WHERE tfoid = '$tfoid' ";
  278. //$tbl_ResultId_=th_query($tbl_ResultId);
  279. if (mysql_affected_rows($link2db)==1 ){
  280. $nitfodescription_=mysql_fetch_array($xmyid);
  281. $nireqdescription=$nitfodescription_[reqdesc];
  282. $nireqindicator=$nitfodescription_[reqindicator];
  283. $niPermitType=$nitfodescription_[permit_type];
  284. }
  285. $action_=82;
  286. }
  287. else {
  288. $xmyid = mysql_query("SELECT * FROM $tbl_current WHERE reqid = '$reqid' ",$link2db);
  289. //$tbl_ResultId="SELECT * FROM $tbl_current WHERE tfoid = '$tfoid' ";
  290. //$tbl_ResultId_=th_query($tbl_ResultId);
  291. if (mysql_affected_rows($link2db)==1 ){
  292. $nitfodescription_=mysql_fetch_array($xmyid);
  293. $nireqdescription=$nitfodescription_[reqdesc];
  294. $nireqindicator=$nitfodescription_[reqindicator];
  295. $niPermitType=$nitfodescription_[permit_type];
  296. }
  297. }
  298. ////////////////////////////
  299. if (isset($ISubmitBussNature)){
  300. $nidescription=strip_tags(strtoupper($idescription));
  301. $niPsicCode=strip_tags(strtoupper($iPsicCode));
  302. if (!empty($nidescription)){
  303. if ($natureaction=='Edit'){
  304. $xmyid = mysql_query("SELECT * FROM $tbl_current WHERE naturedesc = '$nidescription' and natureid <> '$natureid'",$link2db);
  305. }
  306. else {
  307. $xmyid = mysql_query("SELECT * FROM $tbl_current WHERE naturedesc = '$nidescription' and naturestatus='A'",$link2db);
  308. }
  309. if (mysql_affected_rows($link2db)==0 ){
  310. $action_=1;
  311. $actionID=1;
  312. if ($natureaction=='Edit'){
  313. $myid = mysql_query("UPDATE $tbl_current set naturedesc = '$nidescription', psiccode = '$niPsicCode' where natureid = '$natureid'");
  314. $naedit = 'true';
  315. } else {
  316. $myid = mysql_query("INSERT INTO $tbl_current (naturedesc,naturestatus,psiccode) VALUES ('$nidescription','A','$niPsicCode')",$link2db);
  317. $naedit = 'false';
  318. ?>
  319. <body onload="AddRec(); _FRM.submit();"></body>
  320. <?php
  321. }
  322. if ($myid == TRUE){
  323. // get natureID//likeoperationiferrorisencountered...
  324. $mynatureID=mysql_query("SELECT natureid FROM $tbl_current WHERE naturedesc='$nidescription'",$link2db);
  325. if (mysql_affected_rows($link2db)==1){
  326. $nidescriptionrec_=mysql_fetch_array($mynatureID);
  327. $natureid=$nidescriptionrec_[natureid];
  328. //$natureid=$nidescriptionrec_[psiccode];
  329. $natureaction='Edit';
  330. }
  331. else {
  332. $validateID=1;
  333. //include'validate-inc.php';
  334. }
  335. // end here
  336. if ($naedit=='true'){
  337. $validateID=5;
  338. } else {
  339. $validateID=0;
  340. }
  341. include'validate-inc.php';
  342. }
  343. else {
  344. //echo "fhfhfhfhjosel";
  345. $validateID=1;
  346. include'validate-inc.php';
  347. }
  348. }
  349. elseif (mysql_affected_rows($link2db)==1 ){
  350. ?>
  351. <body onload='javascript:alert ("Existing Record Found!!");_FRM.idescription.focus();'></body>
  352. <?
  353. //$myid = mysql_query("UPDATE $tbl_current SET naturedesc='$nidescription', psiccode='$niPsicCode' WHERE natureid='$natureid' ",$link2db);
  354. //$validateID=5;
  355. //include'validate-inc.php';
  356. }
  357. } // EndIf for not empty description...
  358. else {
  359. ?>
  360. <body onload='javascript:alert ("Enter Valid Description!!");_FRM.idescription.focus();'></body>
  361. <?
  362. }
  363. }
  364. // requirements
  365. if ($ISubmitREQ=="Submit"){
  366. $nireqdescription=strip_tags($ireqdescription);
  367. if ($ireqindicator==1){
  368. $ireqindicator=1;
  369. }
  370. else {
  371. $ireqindicator=0;
  372. }
  373. if (!empty($nireqdescription)){
  374. if ($reqaction=='Edit'){
  375. $dtaReq = mysql_query("SELECT * FROM $tbl_current WHERE reqid = '$reqid' ",$link2db);
  376. }
  377. else {
  378. $dtaReq = mysql_query("SELECT * FROM $tbl_current WHERE reqdesc = '$nireqdescription' and permit_type='$iPermitType'",$link2db);
  379. }
  380. if (mysql_affected_rows($link2db)==0 ){
  381. $dtaReq1 = mysql_query("INSERT INTO $tbl_current (reqdesc,recstatus,reqindicator,datecreated,revdate,permit_type) VALUES ('$nireqdescription','A','$ireqindicator',Now(),Now(),'$iPermitType')",$link2db);
  382. //echo "INSERT INTO $tbl_current (reqdesc,recstatus,reqindicator,datecreated,revdate) VALUES ('$nireqdescription','A','$ireqindicator',Now(),Now(),'$iPermitType') $link2db";
  383. if ($dtaReq1 == TRUE){
  384. ?>
  385. <body onload='javascript:alert ("Data is successfully added to the database.");'></body>
  386. <?
  387. $nireqdescription = "";
  388. $iPermitType = "";
  389. }
  390. else {
  391. $validateID=1;
  392. include'validate-inc.php';
  393. }
  394. }
  395. elseif (mysql_affected_rows($link2db)==1) {
  396. if ($reqaction=='Edit'){
  397. $DBupdatereq = mysql_query("UPDATE $tbl_current SET reqdesc='$nireqdescription', reqindicator='$ireqindicator', revdate=Now(), permit_type='$iPermitType' WHERE reqid = '$reqid' ",$link2db);
  398. ?>
  399. <body onload='javascript:alert ("Record Successfully Updated");'></body>
  400. <?
  401. $nireqdescription = "";
  402. $iPermitType = "";
  403. }
  404. else {
  405. ?>
  406. <body onload='javascript:alert ("Duplicate Record is not accepted!!");'></body>
  407. <?php
  408. }
  409. }
  410. } // EndIf for not empty description...
  411. else {
  412. $validateID=2;
  413. include'validate-inc.php';
  414. }
  415. }
  416. // end of requriements
  417. // taxes,fees and other charges...
  418. if (isset($ISubmitTFO)){
  419. if ($itfoindicator==1) {
  420. $nitfodescription=strip_tags(strtoupper($itfodescription));
  421. } else {
  422. $nitfodescription=strip_tags(strtoupper($itfodescription));
  423. $defamt=$defamt;
  424. $itfotype=$itfotype;
  425. }
  426. if ($itfoindicator==1){
  427. $itfoindicator=1;
  428. }
  429. else {
  430. $itfoindicator=0;
  431. }
  432. $nitfoindicator=$itfoindicator;
  433. if (!empty($nitfodescription)){
  434. if ($tfoaction=='Edit'){
  435. $xmyid = mysql_query("SELECT * FROM $tbl_current WHERE tfoid = '$tfoid' ",$link2db);
  436. }
  437. else {
  438. $xmyid = mysql_query("SELECT * FROM $tbl_current WHERE tfodesc = '$nitfodescription' ",$link2db);
  439. }
  440. if ($nitfoindicator==1) {
  441. if ($defamt=='' or $defamt==0) {
  442. echo "<div align=center><font color=red><b><i>Enter Default Amount</i></b></font></div>";
  443. $nitfodescription=$itfodescription;
  444. $nitfoindicator=$itfoindicator;
  445. $defamt=$defamt;
  446. $itfotype=$itfotype;
  447. } else {
  448. $nitfodescription=strip_tags(strtoupper($itfodescription));
  449. if (mysql_affected_rows($link2db)==0 ){
  450. $myid = mysql_query("INSERT INTO $tbl_current (tfodesc,tfostatus,tfoindicator,taxfeetype,datecreated,defamt,or_print,counter) VALUES ('$nitfodescription','A','$itfoindicator','$itfotype',Now(),$defamt,'$ilangtaon','$nubert')",$link2db) or die(mysql_error());
  451. if ($myid == TRUE){
  452. $validateID=0;
  453. include'validate-inc.php';
  454. //setURLRedirect("index.php?tfoid=5&action_=3&class_type=Preference&pref_type=Business&actionID=1&part=4&class_type=Preference&selMode=ebpls_nbusiness&tfoaction=Edit&orderbyasdes=1&reftype=tfo&updatetfo=true");
  455. }
  456. else {
  457. $validateID=1;
  458. include'validate-inc.php';
  459. }
  460. }
  461. elseif (mysql_affected_rows($link2db)==1) {
  462. if ($tfoaction=='Edit'){
  463. $DBupdatetfo = mysql_query("UPDATE $tbl_current SET tfodesc='$nitfodescription', tfoindicator='$itfoindicator', taxfeetype='$itfotype', defamt=$defamt, or_print='$ilangtaon', counter='$ubert' WHERE tfoid = '$tfoid' ",$link2db);
  464. $action_=5;
  465. $validateID=5;
  466. setURLRedirect("index.php?tfoid=5&action_=3&class_type=Preference&pref_type=Business&actionID=1&part=4&class_type=Preference&selMode=ebpls_nbusiness&tfoaction=Edit&orderbyasdes=1&reftype=tfo&updatetfo=true&nitfodescription=$nitfodescription&nitfoindicator=$nitfoindicator&defamt=$defamt&itfotype=$itfotype&tfoid=$tfoid");
  467. }
  468. else {
  469. $validateID=6;
  470. }
  471. }
  472. //$nitfodescription='';
  473. //$nitfoindicator='';
  474. //$defamt='';
  475. //$itfotype='';
  476. }
  477. } else {
  478. $nitfodescription=strip_tags(strtoupper($itfodescription));
  479. if (mysql_affected_rows($link2db)==0 ){
  480. $myid = mysql_query("INSERT INTO $tbl_current (tfodesc,tfostatus,tfoindicator,taxfeetype,datecreated,defamt,or_print,counter) VALUES ('$nitfodescription','A','$itfoindicator','$itfotype',Now(),$defamt,'$ilangtaon','$nubert')",$link2db)
  481. or die(mysql_error());
  482. if ($myid == TRUE){
  483. $validateID=0;
  484. include'validate-inc.php';
  485. // setURLRedirect("index.php?tfoid=5&action_=3&class_type=Preference&pref_type=Business&actionID=1&part=4&class_type=Preference&selMode=ebpls_nbusiness&tfoaction=Edit&reftype=tfo&updatetfo=true&nitfodescription=$nitfodescription&nitfoindicator=$nitfoindicator&defamt=$defamt&itfotype=$itfotype");
  486. }
  487. else {
  488. $validateID=1;
  489. include'validate-inc.php';
  490. }
  491. }
  492. elseif (mysql_affected_rows($link2db)==1) {
  493. if ($tfoaction=='Edit'){
  494. $DBupdatetfo = mysql_query("UPDATE $tbl_current SET tfodesc='$nitfodescription', tfoindicator='$itfoindicator', taxfeetype='$itfotype', defamt=$defamt, or_print='$ilangtaon', counter='$ubert' WHERE tfoid = '$tfoid' ",$link2db);
  495. $action_=5;
  496. $validateID=5;
  497. setURLRedirect("index.php?tfoid=5&action_=3&class_type=Preference&pref_type=Business&actionID=1&part=4&class_type=Preference&selMode=ebpls_nbusiness&tfoaction=Edit&reftype=tfo&updatetfo=true&nitfodescription=$nitfodescription&nitfoindicator=$nitfoindicator&defamt=$defamt&itfotype=$itfotype&tfoid=$tfoid");
  498. }
  499. else {
  500. $validateID=6;
  501. }
  502. }
  503. }
  504. } // EndIf for not empty description...
  505. else {
  506. $validateID=2;
  507. include'validate-inc.php';
  508. }
  509. }
  510. /***********/
  511. if (isset($ISubmitTax)){
  512. $counterTaxFeeID=mysql_query("Select DISTINCT taxfeeid FROM ebpls_buss_taxfeeother order
  513. by taxfeeid DESC",$link2db);
  514. $rowCounter=mysql_num_rows($counterTaxFeeID);
  515. if ($rowCounter==0){
  516. $ctrtaxfeeid=1;
  517. }
  518. else {
  519. ///////////////////////////////////
  520. /*$xselectDistinct=mysql_query("Select DISTINCT taxfeeid FROM ebpls_buss_taxrange order by taxfeeid DESC",$link2db);
  521. $xrowDistinct=mysql_numrows($xselectDistinct);
  522. if ($xrowDistinct>0){
  523. $xnewgetData=mysql_fetch_array($xselectDistinct);
  524. $ctrtaxfeeid=$newgetData[taxfeeid] + 1;
  525. }*/
  526. //////////////////////////////////
  527. $xnewgetData=mysql_fetch_array($counterTaxFeeID);
  528. $ctrtaxfeeid=$xnewgetData[taxfeeid] + 1;
  529. //$ctrtaxfeeid=$rowCounter + 1;
  530. }
  531. if ($iMode==2){
  532. $eventComplex=2;
  533. }
  534. elseif ($iMode==1){
  535. $eventComplex=1;
  536. }
  537. $niAmountFormula=strip_tags($iAmountFormula);
  538. if (!empty($niAmountFormula)){
  539. if (empty($aTFOID) and empty($aTAXFEEid)){
  540. $checkRecord=mysql_query("Select * from ebpls_buss_taxfeeother WHERE natureid=$natureid and tfo_id=$itfotype and taxfeeid=$ctrtaxfeeid ",$link2db); // and taxfeeind='$iIndicator' and taxtype='$itype' and taxfeeoption='$iOption' no duplicate additional
  541. $rowchkRecord=mysql_num_rows($checkRecord);
  542. if ($rowchkRecord==0){
  543. $seleDuplicate=mysql_query("select * from ebpls_buss_taxfeeother where tfo_id='$itfotype' and taxfeeind='$iIndicator' and taxtype='$iType' and taxfeeoption='$iOption' and natureid='$natureid'",$link2db);
  544. $rowDuplicate=mysql_num_rows($seleDuplicate);
  545. //echo "doble daw... $rowDuplicate<br>";
  546. /*
  547. echo "orignatureid $natureid<br>";
  548. echo "origtfoid $aTFOID<br>";
  549. echo "origtaxfeeid $aTAXFEEid<br>";
  550. echo "doble daw... $rowDuplicate<br>";
  551. echo "option $iOption<br>";
  552. echo "type $iType<br>";
  553. echo "indicator $iIndicator<br>";
  554. echo "tfotype $itfotype<br>";
  555. */
  556. //exit;
  557. if ($rowDuplicate==0){
  558. if ($iMinAmount=='') {
  559. $iMinAmount=0;
  560. }
  561. //echo "lito frrrerreererreerererer";
  562. if ($iIndicator==3){
  563. $valueof_ResultId=1;
  564. $checkRange=1;
  565. $iAmountFormula=1;
  566. $niAmountFormula=1;
  567. if ($iMinAmount=='') {
  568. $iMinAmount=0;
  569. }
  570. $INSERTdata = mysql_query("INSERT INTO ebpls_buss_taxfeeother (taxfeeid,natureid,tfo_id,taxfeeoption,taxfeeind,taxfeemode,taxfeeamtfor,datecreated,taxtype,uom,defamt) VALUES ($ctrtaxfeeid,$natureid,$itfotype,'$iOption','$iIndicator','$iMode',$niAmountFormula,Now(),'$iType','$iuom',$iMinAmount)",$link2db) or die("die".mysql_error());
  571. }
  572. if ($iIndicator=='2') {
  573. $openpar = substr_count($niAmountFormula, '(');
  574. $closepar = substr_count($niAmountFormula, ')');
  575. $closepar1 = $closepar-2;
  576. if ($openpar==$closepar1) {
  577. $INSERTdata = mysql_query("INSERT INTO ebpls_buss_taxfeeother (taxfeeid,natureid,tfo_id,taxfeeoption,taxfeeind,taxfeemode,taxfeeamtfor,datecreated,taxtype,uom,defamt) VALUES ('$ctrtaxfeeid','$natureid','$itfotype','$iOption','$iIndicator','$iMode','$niAmountFormula',Now(),'$iType','$iuom',$iMinAmount)",$link2db) or die("die".mysql_error());
  578. } else {
  579. echo "<div align=center><font color=red<b><i>Invalid Formula ($niAMountFormula)</i></b></font></div>";
  580. }
  581. }
  582. if ($iIndicator=='1') {
  583. if (is_numeric($niAmountFormula)) {
  584. $INSERTdata = mysql_query("INSERT INTO ebpls_buss_taxfeeother (taxfeeid,natureid,tfo_id,taxfeeoption,taxfeeind,taxfeemode,taxfeeamtfor,datecreated,taxtype,uom,defamt) VALUES ('$ctrtaxfeeid','$natureid','$itfotype','$iOption','$iIndicator','$iMode','$niAmountFormula',Now(),'$iType','$iuom',$iMinAmount)",$link2db) or die("die".mysql_error());
  585. } else {
  586. echo "<div align=center><font color=red<b><i>Invalid Amount ($niAmountFormula)</i></b></font></div>";
  587. }
  588. }
  589. if ($INSERTdata == True){
  590. $RecordtaxID_ = mysql_query("SELECT * FROM ebpls_buss_taxfeeother WHERE natureid = '$natureid' and tfo_id='$itfotype' and taxfeeoption='$iOption' and taxfeeind='$iIndicator' and taxfeemode='$iMode' and taxfeeamtfor='$niAmountFormula' and taxtype='$iType' and taxfeeid='$ctrtaxfeeid'",$link2db);
  591. if (mysql_affected_rows($link2db)==1 ){
  592. $nRecordId_=mysql_fetch_array($RecordtaxID_);
  593. $aTAXFEEid=$nRecordId_[taxfeeid];
  594. $aTFOID=$nRecordId_[tfoid];
  595. }
  596. $validateID=0;
  597. include'validate-inc.php';
  598. }
  599. else {
  600. $validateID=1;
  601. include'validate-inc.php';
  602. }
  603. } // duplicate record next line...
  604. // else {
  605. // echo "<p align=center>Duplicate entry is NOT accepted...</p>";
  606. // }
  607. }// no duplicate record found...
  608. else { // $rowchkRecord==1
  609. $validateID=1;
  610. include'validate-inc.php';
  611. }
  612. }
  613. else { // check for range flag here...
  614. $DBupdateRec_ = mysql_query("UPDATE ebpls_buss_taxfeeother SET taxfeeoption='$iOption', taxfeeind='$iIndicator', taxfeemode='$iMode', taxfeeamtfor='$niAmountFormula',defamt=$iMinAmount, datecreated=Now(), taxtype='$iType', tfo_id='$itfotype', uom='$iuom' WHERE natureid='$natureid' and tfoid = '$aTFOID' and taxfeeid='$aTAXFEEid' ",$link2db);
  615. // if error or not correct in process remove tfoid='$itfotype'!!!
  616. $validateID=5;
  617. include'validate-inc.php';
  618. }
  619. } // Not empty
  620. else {
  621. $validateID=2;
  622. include'validate-inc.php';
  623. }
  624. }
  625. if (!empty($bussEvent)){
  626. $taxfeeAmtFor = mysql_query("SELECT * FROM ebpls_buss_taxfeeother WHERE natureid = '$natureid' and tfo_id='$aTFOID' and taxfeeid='$aTAXFEEid' ",$link2db);
  627. if (mysql_affected_rows($link2db)==1 ){
  628. $niAmountFormula_=mysql_fetch_array($taxfeeAmtFor);
  629. $niAmountFormula=$niAmountFormula_[taxfeeamtfor];
  630. $niMinAmount=$niAmountFormula_[defamt];
  631. $niOption=$niAmountFormula_[taxfeeoption];
  632. $niIndicator=$niAmountFormula_[taxfeeind];
  633. $niTaxMode=$niAmountFormula_[taxfeemode];
  634. $niType=$niAmountFormula_[taxtype];
  635. $niuom=$niAmountFormula_[uom];
  636. //$niTaxMode=$niAmountFormula_[taxfeemode];
  637. $iTFO_data = mysql_query("SELECT * FROM ebpls_buss_tfo WHERE tfoid = '$aTFOID'",$link2db);
  638. if (mysql_affected_rows($link2db)==1 ){
  639. $niTFO_data=mysql_fetch_array($iTFO_data);
  640. $ni_typedesc=$niTFO_data[tfodesc];
  641. $ni_taxfeetype=$niTFO_data[tfoid];
  642. }
  643. }
  644. }
  645. // range maintenance
  646. // Save routine
  647. if (isset($iSaveRange)){
  648. $chkindi = mysql_query("select * from ebpls_buss_taxfeeother where natureid='$natureid' and tfo_id = '$aTFOID' and taxfeeid='$aTAXFEEid'",$link2db);
  649. $chkindic1=mysql_fetch_array($chkindi);
  650. $chkiIndicator = $chkindic1[taxfeeind];
  651. if ($chkiIndicator != $iIndicator) {
  652. $valueof_ResultId='';
  653. $eventComplex='';
  654. $niIndicator=$iIndicator;
  655. //$deleterange = mysql_query("delete from ebpls_buss_taxrange where taxfeeid='$aTAXFEEid'",$link2db);
  656. $upDateDbrec1=mysql_query("UPDATE ebpls_buss_taxfeeother SET taxfeeoption='$iOption', taxfeeind='$iIndicator', taxfeemode='$iMode', taxfeeamtfor='$niAmountFormula',defamt=$iMinAmount, datecreated=Now(), taxtype='$iType', tfo_id='$itfotype', uom='$iuom' WHERE natureid='$natureid' and tfo_id = '$aTFOID' and taxfeeid='$aTAXFEEid' ",$link2db);
  657. }
  658. $ctr=0;
  659. $varIDreSult_=0;
  660. while ($ctr < $lastRecord_){
  661. if ($rangelow[$ctr]==Null || $rangehigh[$ctr]==Null || $rangeamount[$ctr]==Null ){
  662. }
  663. else {
  664. if ($editRange==1){ // for edit range use only
  665. //echo "for edit range ito ";
  666. if ($rangeind[$ctr]=='1') {
  667. if (is_numeric($rangeamount[$ctr])) {
  668. $upDateDbrec=mysql_query("UPDATE ebpls_buss_taxrange SET rangelow='$rangelow[$ctr]', rangehigh='$rangehigh[$ctr]', rangeamount='$rangeamount[$ctr]', rangeind='$rangeind[$ctr]', datecreated=Now() WHERE taxfeeid='$aTAXFEEid' and rangeid='$rangeID[$ctr]' ",$link2db);
  669. // and rangeid='$rangeID[$ctr]'
  670. //$myid = mysql_query("UPDATE $tbl_current SET naturedesc='$nidescription' WHERE natureid='$natureid' ",$link2db);
  671. $validateID=5;
  672. //echo "<p align=center><font color=#ff0033><b><i>Record successfully updated!!!</font></i></b></p>";
  673. //include'validate-inc.php';
  674. } else {
  675. echo "<div align=center><font color=red><b><i>Invalid Amount ($rangeamount[$ctr])</i></b></font></div>";
  676. }
  677. }
  678. if ($rangeind[$ctr]=='2') {
  679. $openpar = substr_count($rangeamount[$ctr], '(');
  680. $closepar = substr_count($rangeamount[$ctr], ')');
  681. $closepar1 = $closepar-2;
  682. if ($openpar==$closepar1) {
  683. $upDateDbrec=mysql_query("UPDATE ebpls_buss_taxrange SET rangelow='$rangelow[$ctr]', rangehigh='$rangehigh[$ctr]', rangeamount='$rangeamount[$ctr]', rangeind='$rangeind[$ctr]', datecreated=Now() WHERE taxfeeid='$aTAXFEEid' and rangeid='$rangeID[$ctr]' ",$link2db);
  684. // and rangeid='$rangeID[$ctr]'
  685. //$myid = mysql_query("UPDATE $tbl_current SET naturedesc='$nidescription' WHERE natureid='$natureid' ",$link2db);
  686. $validateID=5;
  687. //echo "<p align=center><font color=#ff0033><b><i>Record successfully updated!!!</font></i></b></p>";
  688. //include'validate-inc.php';
  689. } else {
  690. echo "<div align=center><font color=red><b><i>Invalid Amount ($rangeamount[$ctr])</i></b></font></div>";
  691. }
  692. }
  693. //Robert
  694. if (!empty($eventAddRow) and $eventAddRow=='PlusOne'){
  695. $taddr=0;
  696. $ctr=0;
  697. while ($taddr < $noofloop) {
  698. $AddRangeLow[$ctr]=strip_tags($AddRangeLow[$ctr]);
  699. $AddRangeHigh[$ctr]=strip_tags($AddRangeHigh[$ctr]);
  700. $AddRangeAmount[$ctr]=strip_tags($AddRangeAmount[$ctr]);
  701. $AddRangeInd[$ctr]=strip_tags($AddRangeInd[$ctr]);
  702. if (is_numeric($AddRangeLow[$ctr]) and is_numeric($AddRangeHigh[$ctr])){
  703. if ($AddRangeInd[$ctr]=='1') {
  704. if (is_numeric($AddRangeAmount[$ctr])) {
  705. $INSERTdata = mysql_query("INSERT INTO ebpls_buss_taxrange (taxfeeid,rangelow,rangehigh,rangeamount,rangeind,rangestatus,datecreated) VALUES ('$aTAXFEEid','$AddRangeLow[$ctr]','$AddRangeHigh[$ctr]','$AddRangeAmount[$ctr]','$AddRangeInd[$ctr]','A',Now())",$link2db);
  706. // and rangeid='$rangeID[$ctr]'
  707. //$myid = mysql_query("UPDATE $tbl_current SET naturedesc='$nidescription' WHERE natureid='$natureid' ",$link2db);
  708. //$validateID=5;
  709. //echo "<p align=center><font color=#ff0033><b><i>Record successfully updated!!!</font></i></b></p>";
  710. //include'validate-inc.php';
  711. } else {
  712. echo "<div align=center><font color=red<b><i>Invalid Amount ($rangeamount[$ctr])</i></b></font></div>";
  713. }
  714. }
  715. if ($AddRangeInd[$ctr]=='2') {
  716. $openpar = substr_count($AddRangeAmount[$ctr], '(');
  717. $closepar = substr_count($AddRangeAmount[$ctr], ')');
  718. $closepar1 = $closepar-2;
  719. if ($openpar==$closepar1) {
  720. $INSERTdata = mysql_query("INSERT INTO ebpls_buss_taxrange (taxfeeid,rangelow,rangehigh,rangeamount,rangeind,rangestatus,datecreated) VALUES ('$aTAXFEEid','$AddRangeLow[$ctr]','$AddRangeHigh[$ctr]','$AddRangeAmount[$ctr]','$AddRangeInd[$ctr]','A',Now())",$link2db);
  721. // and rangeid='$rangeID[$ctr]'
  722. //$myid = mysql_query("UPDATE $tbl_current SET naturedesc='$nidescription' WHERE natureid='$natureid' ",$link2db);
  723. //$validateID=5;
  724. //echo "<p align=center><font color=#ff0033><b><i>Record successfully updated!!!</font></i></b></p>";
  725. //include'validate-inc.php';
  726. } else {
  727. echo "<div align=center><font color=red<b><i>Invalid Amount ($rangeamount[$ctr])</i></b></font></div>";
  728. }
  729. }
  730. $valueof_ResultId=1;
  731. $eventAddRow='';
  732. }
  733. else {
  734. echo "<br><font color=#ff0033><p align=center>Invalid entry!!! Please check your entry.</p></font>";
  735. $nofrow=$noofloop;
  736. }
  737. $ctr++;
  738. $taddr++;
  739. }
  740. }
  741. //Robert
  742. }
  743. else {
  744. if ($aTAXFEEid==0){
  745. echo "<p align=center>Error encountered... Please report immediately to your IT personnel.</p>";
  746. }
  747. else {
  748. //echo "tama naman...";
  749. if ($rangeind[$ctr]=='1') {
  750. if (is_numeric($rangeamount[$ctr])) {
  751. $INSERTdata = mysql_query("INSERT INTO ebpls_buss_taxrange (taxfeeid,rangelow,rangehigh,rangeamount,rangeind,rangestatus,datecreated) VALUES ('$aTAXFEEid','$rangelow[$ctr]','$rangehigh[$ctr]','$rangeamount[$ctr]','$rangeind[$ctr]','A',Now())",$link2db);
  752. // and rangeid='$rangeID[$ctr]'
  753. //$myid = mysql_query("UPDATE $tbl_current SET naturedesc='$nidescription' WHERE natureid='$natureid' ",$link2db);
  754. //$validateID=5;
  755. //echo "<p align=center><font color=#ff0033><b><i>Record successfully updated!!!</font></i></b></p>";
  756. //include'validate-inc.php';
  757. $ctrtaxfeeid='';
  758. setUrlRedirect("index.php?natureid=$natureid&action_=1&actionID=1&part=4&class_type=Preference&pref_type=Business&selMode=ebpls_nbusiness&natureaction=Edit&orderbyasdes=1&reftype=bus");
  759. } else {
  760. echo "<div align=center><font color=red><b><i>Invalid Amount ($rangeamount[$ctr])</i></b></font></div>";
  761. }
  762. }
  763. if ($rangeind[$ctr]=='2') {
  764. $openpar = substr_count($rangeamount[$ctr], '(');
  765. $closepar = substr_count($rangeamount[$ctr], ')');
  766. $closepar1 = $closepar-2;
  767. if ($openpar==$closepar1) {
  768. $INSERTdata = mysql_query("INSERT INTO ebpls_buss_taxrange (taxfeeid,rangelow,rangehigh,rangeamount,rangeind,rangestatus,datecreated) VALUES ('$aTAXFEEid','$rangelow[$ctr]','$rangehigh[$ctr]','$rangeamount[$ctr]','$rangeind[$ctr]','A',Now())",$link2db);
  769. // and rangeid='$rangeID[$ctr]'
  770. //$myid = mysql_query("UPDATE $tbl_current SET naturedesc='$nidescription' WHERE natureid='$natureid' ",$link2db);
  771. $validateID=5;
  772. //echo "<p align=center><font color=#ff0033><b><i>Record successfully updated!!!</font></i></b></p>";
  773. //include'validate-inc.php';
  774. } else {
  775. echo "<div align=center><font color=red><b><i>Invalid Amount ($rangeamount[$ctr])</i></b></font></div>";
  776. }
  777. }
  778. }
  779. //echo "$rangelow[$ctr]..........$rangehigh[$ctr].........$rangeamount[$ctr] <br>";
  780. }
  781. }
  782. $varIDreSult_++;
  783. $ctr++;
  784. }
  785. //echo "Record TaxFeeID# =>>$aTAXFEEid";
  786. //exit;
  787. if (!empty($eventAddRow) and $eventAddRow=='PlusOne'){
  788. $taddr=0;
  789. $ctr=0;
  790. while ($taddr < $noofloop) {
  791. $AddRangeLow[$ctr]=strip_tags($AddRangeLow[$ctr]);
  792. $AddRangeHigh[$ctr]=strip_tags($AddRangeHigh[$ctr]);
  793. $AddRangeAmount[$ctr]=strip_tags($AddRangeAmount[$ctr]);
  794. $AddRangeInd[$ctr]=strip_tags($AddRangeInd[$ctr]);
  795. if (is_numeric($AddRangeLow[$ctr]) and is_numeric($AddRangeHigh[$ctr])){
  796. if ($AddRangeInd[$ctr]=='1') {
  797. if (is_numeric($AddRangeAmount[$ctr])) {
  798. $INSERTdata = mysql_query("INSERT INTO ebpls_buss_taxrange (taxfeeid,rangelow,rangehigh,rangeamount,rangeind,rangestatus,datecreated) VALUES ('$aTAXFEEid','$AddRangeLow[$ctr]','$AddRangeHigh[$ctr]','$AddRangeAmount[$ctr]','$AddRangeInd[$ctr]','A',Now())",$link2db);
  799. // and rangeid='$rangeID[$ctr]'
  800. //$myid = mysql_query("UPDATE $tbl_current SET naturedesc='$nidescription' WHERE natureid='$natureid' ",$link2db);
  801. //$validateID=5;
  802. //echo "<p align=center><font color=#ff0033><b><i>Record successfully updated!!!</font></i></b></p>";
  803. //include'validate-inc.php';
  804. } else {
  805. echo "<div align=center><font color=red<b><i>Invalid Amount ($rangeamount[$ctr])</i></b></font></div>";
  806. }
  807. }
  808. if ($AddRangeInd[$ctr]=='2') {
  809. $openpar = substr_count($AddRangeAmount[$ctr], '(');
  810. $closepar = substr_count($AddRangeAmount[$ctr], ')');
  811. $closepar1 = $closepar-2;
  812. if ($openpar==$closepar1) {
  813. $INSERTdata = mysql_query("INSERT INTO ebpls_buss_taxrange (taxfeeid,rangelow,rangehigh,rangeamount,rangeind,rangestatus,datecreated) VALUES ('$aTAXFEEid','$AddRangeLow[$ctr]','$AddRangeHigh[$ctr]','$AddRangeAmount[$ctr]','$AddRangeInd[$ctr]','A',Now())",$link2db);
  814. // and rangeid='$rangeID[$ctr]'
  815. //$myid = mysql_query("UPDATE $tbl_current SET naturedesc='$nidescription' WHERE natureid='$natureid' ",$link2db);
  816. //$validateID=5;
  817. //echo "<p align=center><font color=#ff0033><b><i>Record successfully updated!!!</font></i></b></p>";
  818. //include'validate-inc.php';
  819. } else {
  820. echo "<div align=center><font color=red<b><i>Invalid Amount ($rangeamount[$ctr])</i></b></font></div>";
  821. }
  822. }
  823. $valueof_ResultId=1;
  824. $eventAddRow='';
  825. }
  826. else {
  827. echo "<br><font color=#ff0033><p align=center>Invalid entry!!! Please check your entry.</p></font>";
  828. $nofrow=$noofloop;
  829. }
  830. $ctr++;
  831. $taddr++;
  832. }
  833. }
  834. //else {
  835. //} // endif for eventAddrow
  836. if (!empty($aTAXFEEid) and !empty($aTFOID) and !empty($natureid)){
  837. /*echo "Ok to update...";
  838. echo "$natureid<br>";
  839. echo "$aTAXFEEid<br>";
  840. echo "$aTFOID<br>";
  841. echo "$iOption<br>";
  842. //echo "$iIndicator<br>";
  843. echo "$iMode<br>";
  844. echo "$iType<br>";
  845. echo "$niAmountFormula */
  846. //taxfeeind='$iIndicator', taxfeemode='$iMode', taxfeeamtfor='$niAmountFormula', for Range only!
  847. $DBupdateRec_ = mysql_query("UPDATE ebpls_buss_taxfeeother SET taxfeeoption='$iOption', datecreated=Now(), taxtype='$iType', tfo_id='$itfotype', uom='$iuom', defamt=$iMinAmount WHERE natureid='$natureid' and tfo_id = '$aTFOID' and taxfeeid='$aTAXFEEid' ",$link2db);
  848. $aTFOID=$itfotype;
  849. $niOption=$iOption;
  850. $niType=$iType;
  851. $niMinAmount=$iMinAmount;
  852. $niuom=$iuom;
  853. $iTFO_data = mysql_query("SELECT * FROM ebpls_buss_tfo WHERE tfoid = '$aTFOID'",$link2db);
  854. if (mysql_affected_rows($link2db)==1 ){
  855. $niTFO_data=mysql_fetch_array($iTFO_data);
  856. $ni_typedesc=$niTFO_data[tfodesc];
  857. $ni_taxfeetype=$niTFO_data[tfoid];
  858. }
  859. }
  860. }
  861. if (isset($iRows)){
  862. $lastRecord_=$lastRecord_ + 3;
  863. }
  864. else {
  865. if (empty($varIDreSult_)){
  866. $lastRecord_=3; // original line of code (1)
  867. }
  868. else {
  869. $lastRecord_=$varIDreSult_;
  870. }
  871. }
  872. // end here for range maintenance
  873. ?>
  874. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  875. <html>
  876. <head>
  877. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  878. <title>eBPLS Business Permit and Licensing System</title>
  879. <meta name="Author" content=" FourJ's ">
  880. <link href="includes/eBPLS.css" rel="stylesheet" type="text/css">
  881. <title></title>
  882. </head>
  883. <body>
  884. <form name="_FRM">
  885. <?php
  886. if ($addingrow=='Add Row') {
  887. //$natureid=$natureid;
  888. $class_type=Preference;
  889. $pref_type=Business;
  890. $action_=1;
  891. $actionID=1;
  892. //$part=$part;
  893. $class_type=Preference;
  894. $pref_type=Business;
  895. //$selMode=$selMode;
  896. $natureaction=Edit;
  897. //$bussEvent=$bussEvent;
  898. //$aTFOID=$aTFOID;
  899. $valueof_ResultId=1;
  900. $aTAXFEEid=$aTAXFEEid;
  901. //$rangeid=$rangeid;
  902. $eventAddRow=PlusOne;
  903. //$nofrow=$nofrow;
  904. }
  905. ?>
  906. <input type=hidden name=part value="<?php echo $part;?>">
  907. <input type=hidden name=class_type value="<?php echo $class_type;?>">
  908. <input type=hidden name=noofloop value="<?php echo $nofrow;?>">
  909. <input type=hidden name=pref_type value="Business">
  910. <input type=hidden name=selMode value="<?php echo $selMode;?>">
  911. <input type=hidden name=action_ value="<?php echo $action_;?>">
  912. <input type=hidden name=actionID value="<?php echo $actionID;?>">
  913. <input type=hidden name=natureid value="<?php echo $natureid;?>">
  914. <input type=hidden name=natureaction value="<?php echo $natureaction;?>">
  915. <input type=hidden name=tfoid value="<?php echo $tfoid;?>">
  916. <input type=hidden name=reqid value="<?php echo $reqid;?>">
  917. <input type=hidden name=aTFOID value="<?php echo $aTFOID;?>">
  918. <input type=hidden name=aTAXFEEid value="<?php echo $aTAXFEEid;?>">
  919. <input type=hidden name=tfoaction value="<?php echo $tfoaction;?>">
  920. <input type=hidden name=reqaction value="<?php echo $reqaction;?>">
  921. <input type="hidden" name="actionDeleteReq">
  922. <input type="hidden" name="bbo">
  923. <!--Requirements-->
  924. <input type=hidden name=compEvent value="<?php echo $compEvent;?>">
  925. <input type=hidden name=compEvent1 value="<?php echo $compEvent1;?>">
  926. <input type=hidden name=oidof_complex value="<?php echo $oidof_complex;?>">
  927. <input type=hidden name=bussEvent value="<?php echo $bussEvent;?>">
  928. <input type=hidden name=valueof_ResultId value="<?php echo $valueof_ResultId;?>">
  929. <input type=hidden name=eventComplex value="<?php echo $eventComplex;?>">
  930. <input type=hidden name=reftype value="<?php echo $reftype;?>">
  931. <!--
  932. <input type=hidden name=lastRecord_ value="<?php echo $lastRecord_;?>">
  933. <input type=hidden name=rangelow[<?php echo $ctr;?>] value="<?php echo $rangelow[$ctr];?>">
  934. <input type=hidden name=rangehigh[<?php echo $ctr;?>] value="<?php echo $rangehigh[$ctr];?>">
  935. <input type=hidden name=rangeamount[<?php echo $ctr;?>] value="<?php echo $rangeamount[$ctr];?>">
  936. <input type=hidden name=rangeformula[<?php echo $ctr;?>] value="<?php echo $rangeformula[$ctr];?>">
  937. -->
  938. <input type=hidden name=rangelow[] value="<?php echo $rangelow[$ctr];?>">
  939. <input type=hidden name=rangehigh[] value="<?php echo $rangehigh[$ctr];?>">
  940. <input type=hidden name=rangeamount[] value="<?php echo $rangeamount[$ctr];?>">
  941. <input type=hidden name=rangeformula[] value="<?php echo $rangeformula[$ctr];?>">
  942. <input type=hidden name=rangeind[] value="<?php echo $rangeind[$ctr];?>">
  943. <input type=hidden name=eventAddRow value="<?php echo $eventAddRow;?>">
  944. <input type=hidden name=AddRangeLow value="<?php echo $AddRangeLow;?>">
  945. <input type=hidden name=AddRangeHigh value="<?php echo $AddRangeHigh;?>">
  946. <input type=hidden name=AddRangeAmount value="<?php echo $AddRangeAmount;?>">
  947. <input type=hidden name=AddRangeInd value="<?php echo $AddRangeInd;?>">
  948. <table width=100% align=center cellspacing=0 cellpadding=0>
  949. <tr><td colspan=2 class=header align=center width=100%>REFERENCES</td></tr>
  950. <tr>
  951. <td colspan=2 align=center>
  952. </td>
  953. </tr>
  954. <?php
  955. if ($action_==0){
  956. if ($confx==1) {
  957. include_once 'class/TaxFeeOtherChargesClass.php';
  958. $DelNat = new TaxFee;
  959. $DelNat->CheckTaxFee($bcode);
  960. if ($DelNat->outnumrow > 0) {
  961. ?>
  962. <body onload='javascript:alert ("Cannot Delete, Record exists in other table(s)!!");'></body>
  963. <?
  964. } else {
  965. $strwhere = "natureid='$bcode'";
  966. $DelNat->DeleteTax('ebpls_buss_nature',$strwhere);
  967. ?>
  968. <body onload='javascript:alert ("Record Deleted!!");'></body>
  969. <?
  970. }
  971. }
  972. if ($donfx==1) {
  973. include_once 'class/TaxFeeOtherChargesClass.php';
  974. $DelNat = new TaxFee;
  975. $strvalues = "naturestatus='A'";
  976. $strwhere = "natureid='$bcode'";
  977. $DelNat->UpdateNature($strvalues,$strwhere);
  978. }
  979. ?>
  980. <body onload="javascript: _FRM.searcheenat.focus();"></body>
  981. <tr><td colspan=2 class=header2 align=center width=100%>Masterlist of Business Nature</td></tr>
  982. <tr>
  983. <td colspan=2><br><br>&nbsp;<!--To add new record click here.-->
  984. &nbsp;<input type=text name=searcheenat size=20 maxlength=255>&nbsp;<input type = submit name=searchnat value ='Search Nature'><br><br>
  985. <input type = submit name=cbut value ='Add New Record'><br><br> <!--LEO RENTON.-->
  986. </td>
  987. </tr>
  988. <tr>
  989. <td colspan=2 valign=top align=left><br>
  990. <!--first table within a cell-->
  991. <table width=100%>
  992. <tr bgcolor="#EEEEEE">
  993. <td width=5%>&nbsp;No.</td>
  994. <!--<td width=5%>ID#</td>-->
  995. <td width=60%><a href='index.php?part=4&class_type=Preference&pref_type=Business&selMode=ebpls_nbusiness&action_=0&valueofdesc=desc&orderbyasdes=<?php echo $orderbyasdes;?>&reftype=<?php echo $reftype;?>&searcheenat=<?php echo $searcheenat;?>'>Description</a></td>
  996. <td width=5% align=center>PSIC Code</td>
  997. <td width=20% align=center>Action</td>
  998. </tr>
  999. <input type=hidden name=bcode>
  1000. <input type=hidden name=confx>
  1001. <input type=hidden name=donfx>
  1002. <script language='javascript'>
  1003. function DelNature(cc)
  1004. {
  1005. var _FRM = document._FRM;
  1006. doyou = confirm("Record Will Be Deleted, Continue?");
  1007. if (doyou==true) {
  1008. _FRM.bcode.value = cc;
  1009. _FRM.confx.value = 1;
  1010. } else {
  1011. _FRM.confx.value=

Large files files are truncated, but you can click here to view the full file