Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Excel Scrub
Thursday, January 3rd, 2008 at 5:52:34pm MST 

  1. <?php
  2.    define('TITLE1', 'Avid Business Networks - Excel Scrub');
  3.    define('TITLE2', 'for Samsung Telephone Systems');
  4.    define('ORGFIL', 'AVID Pricesheet.xls');
  5.    define('ORGSHT', 'Samsung Systems');
  6.    define('OCLROW', '5 324');
  7.    define('TRGFIL', 'avid phone quote.xls');
  8.    define('TRGSHT', 'pvinv');
  9.    define('TCLROW', '11 57');
  10.    include('Zips/TBS Excel/tbs_class.php');
  11.    include('Zips/TBS Excel/tbs_plugin_excel.php');
  12.  
  13.    function open_xcel($myfile,$mysheet) {
  14.       $opn_str = $myfile.".".$mysheet;
  15.       $opn_str = stripslashes($myfile);
  16. //      $opn_str = 'E:/Local Files/Company Relations, Projects & Bids/Active/Avid/avid phone quote.xls';
  17. //echo "Opening => $opn_str <br>";
  18.       $TBS = new clsTinyButStrong;
  19.       $TBS->PlugIn(TBS_INSTALL,TBS_EXCEL);
  20.       $TBS->LoadTemplate($opn_str);
  21.       $TBS->PlugIn(TBS_EXCEL,TBS_EXCEL_FILENAME,'result.xls');
  22.       $TBS->Show();
  23.    }
  24.  
  25.    function set_but($mybut) {
  26. echo "Button => $mybut <br>";
  27.       $tstbut = $mybut;
  28.       if (isset($HTTP_POST_VARS['proc'])) {
  29.          $prcstr = $HTTP_POST_VARS['proc'];
  30.       } else {
  31.          $prcstr = "";
  32.       }
  33.       if (isset($HTTP_POST_VARS['form'])) {
  34.          $frmstr = $HTTP_POST_VARS['form'];
  35.       } else {
  36.          $frmstr = "";
  37.       }
  38.       if (isset($HTTP_POST_VARS['iview'])) {
  39.          $invstr = $HTTP_POST_VARS['iview'];
  40.       } else {
  41.          $invstr = "";
  42.       }
  43.       if (isset($HTTP_POST_VARS['oview'])) {
  44.          $otvstr = $HTTP_POST_VARS['oview'];
  45.       } else {
  46.          $otvstr = "";
  47.       }
  48.       if (isset($HTTP_POST_VARS['prnt'])) {
  49.          $prtstr = $HTTP_POST_VARS['prnt'];
  50.       } else {
  51.          $prtstr = "";
  52.       }
  53.       $valstr = "PRC => $prcstr <= ".
  54.                 "FRM => $frmstr <= ".
  55.                 "INV => $invstr <= ".
  56.                 "OTV => $otvstr <= ".
  57.                 "PRT => $prtstr <= ".
  58.                 "IFL => $prtstr <= ".
  59.                 "OFL => $prtstr <= ";
  60. echo "Vals => $valstr <br>";
  61.       unset ($HTTP_POST_VARS['proc'],$HTTP_POST_VARS['form'],
  62.             $HTTP_POST_VARS['iview'],$HTTP_POST_VARS['oview'],
  63.             $HTTP_POST_VARS['prnt']);
  64. echo "Vals => $valstr <br>";
  65.       switch ($tstbut) {
  66.         case "apple":
  67.            echo "i is apple";
  68.            break;
  69.         case "bar":
  70.            echo "i is bar";
  71.            break;
  72.         case "cake":
  73.            echo "i is cake";
  74.            break;
  75.       }   // End Switch
  76.    }      // End Function
  77.  
  78.    $but_vin = "<input type=button name=iview value=View ".
  79.               "onclick=\"document.forms['scrub'].submit(set_but('infile'));\">";
  80.    $but_vot = "<input type=button name=oview value=View ".
  81.               "onclick=\"document.forms['scrub'].submit(set_but('otfile'));\">";
  82.    if ($HTTP_POST_VARS['infil'] != "") {
  83. //      echo "Found iview! <br>";
  84.       $vin_val = $HTTP_POST_VARS['infil'];
  85. //      echo "File $vin_val <br>";
  86.       $fld_vin = "<input type=file size=80 name=infil value=$vin_val ".
  87.                  "onclick=\"document.forms['scrub'].submit();\">";
  88.       $vot_val = "Test text";
  89.       $fld_vot = "=> ".$vot_val;
  90.       if (file_exists($vin_val)) {
  91.          $rc = open_xcel($vin_val, ORGSHT);
  92.       } else {
  93.          echo "File => $vin_val <= not found! <br>";
  94.       }
  95.    } else {
  96.       $fld_vin = "<input type=file size=80 name=infil>";
  97.    }
  98.    $vot_val = '"D:\Local Files\Company Relations, Projects & Bids\Active\Avid Business Networks\avid phone quote.xls"';
  99.    if ($HTTP_POST_VARS['otfil'] != "") {
  100.       echo "Found oview! <br>";
  101. //      $vot_val = realpath($HTTP_POST_VARS['otfil']);
  102.       $vot_pth = dirname($vot_val);
  103.       $fld_vot = "<input type=text size=100 name=otfil value=$vot_val>";
  104.    } else {
  105.       $fld_vot = "<input type=text size=100 name=otfil value=$vot_val>";
  106.    }
  107.    if (isset($HTTP_POST_VARS['proc'])) {
  108.       echo "Found proc! <br>";
  109.    }
  110.    if (isset($HTTP_POST_VARS['form'])) {
  111.       echo "Found form! <br>";
  112.    }
  113.    if (isset($HTTP_POST_VARS['iview'])) {
  114.       echo "Found inview! <br>";
  115.    }
  116.    if (isset($HTTP_POST_VARS['oview'])) {
  117.       echo "Found otview! <br>";
  118.    }
  119.    $TIT1 = TITLE1;
  120.    $TIT2 = TITLE2;
  121.    ob_start();
  122. ?>
  123.  
  124. <html>
  125. <head>
  126. <title>Excel Scrub Processor</title>
  127. </head>
  128.  
  129. <body>
  130. <FORM name="scrub" METHOD="POST" ACTION="<?php echo $_SERVER['PHP_SELF']; ?>">
  131. <table width='75%' border=0 align=center bgcolor='#55aaee'>
  132.    <tr>
  133.    <td colspan=3 align=center>
  134.       <h1><?php echo $TIT1; ?></h1>
  135.       <b><?php echo $TIT2; ?></b>
  136.    </td>
  137.    </tr>
  138.  
  139.    <tr>
  140.    <td width=25>&nbsp;</td>
  141.    <td>&nbsp;</td>
  142.    <td>&nbsp;</td>
  143.    </tr>
  144.  
  145.    <tr>
  146.    <td>&nbsp;</td>
  147.    <td>
  148.       <?php echo $fld_vin; ?>
  149.    </td>
  150.    <td align=left width=100>
  151.       <button type=submit name=iview>View Input File</button>
  152.    </td>
  153.    </tr>
  154.  
  155.    <tr>
  156.    <td>&nbsp;</td>
  157.    <td colspan=3>
  158.       <?php echo $fld_vot; ?>&nbsp;<b><= Output file</b>
  159.    </td>
  160.    <td>&nbsp;</td>
  161.    </tr>
  162.  
  163.    <tr>
  164.    <td colspan=3>&nbsp;</td>
  165.    </tr>
  166.  
  167.    <tr>
  168.    <td colspan=3 align=center>
  169.       <button type=submit name=oview>View Output File</button>&nbsp;&nbsp;
  170.       <button type=submit name=proc>Process</button>&nbsp;&nbsp;
  171.       <button type=submit name=prnt>Print Output</button>
  172.       <input type=hidden name=form value="">
  173.    </td>
  174.    </tr>
  175.    <tr>
  176.  
  177.    <td colspan=3>&nbsp;</td>
  178.    </tr>
  179. </table>
  180. </form>
  181. </body>
  182. </html>
  183. <?php
  184.    ob_end_flush();
  185. ?>

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right
fantasy-obligation