Revision history for AppendPDF


Revision [1151]

Last edited on 2008-02-21 18:38:28 by EmDee
Additions:
> $pdf->addText($Page_Width-$Right_Margin-472, $YPos - ($line_height*3)+32,$FontSize, _('Bank Code: *** Bank Account: ***'));
Deletions:
> $pdf->addText($Page_Width-$Right_Margin-472, $YPos - ($line_height*3)+32,$FontSize, _('National Bank: BSB 083337 Account 035138130'));


Revision [1150]

Edited on 2008-02-21 18:07:48 by EmDee
Additions:
====22nd Feb 2008 ** note this mod is now standard part of 3.09 **====
> echo '<tr><td>' . _('PDF attachment (.pdf)') . ':</TD><TD>' . "\n" . select_files("companies/' . $_SESSION['DatabaseName'] .'/pdf_append/", "", "ItemPDF", $_POST['ItemPDF'], "60") . '</td></tr>'. "\n";
Deletions:
> echo '<tr><td>' . _('PDF attachment (.pdf)') . ':</TD><TD>' . "\n" . select_files("/var/www/html/marbleart_erp/pdf_append/", "", "ItemPDF", $_POST['ItemPDF'], "60") . '</td></tr>'. "\n";


Revision [1070]

Edited on 2008-01-30 17:06:52 by EmDee
Additions:
> $pdf->setFiles(array('invoice.pdf','pdf_append/' . $row['appendfile']));
Deletions:
> $pdf->setFiles(array('invoice.pdf',$row['appendfile']));


Revision [1069]

Edited on 2008-01-30 16:45:06 by EmDee
Additions:
Then we modify Stocks.php, so that an item can have a PDF file attached to it.
You have to add the PDF files to a directory named "pdf_append" under your root weberp directory.
The drop down list is populated with all the PDF files within that directory. Under Item Maintenance, you can now choose which PDF file to attach, or choose 'none'.
NB I have added several "\n" line breaks to Stocks.php to aid HTML debugging.
Deletions:
Then we modify Stocks.php, so that an item can have a PDF file attached to it. If no PDF entry is made, that's fine.
Currently, we have just a text field to enter the PDF name.
We could have a file selection and upload box for the PDF, but would need to handle overwriting]] of existing files and logic for where several items all have the same PDF appendfile.


Revision [1068]

Edited on 2008-01-30 16:40:43 by EmDee [added pdf file selection dropdown]
Additions:
30c30
< echo "<A HREF='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</A><BR>';
> echo "<A HREF='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</A><BR>' . "\n";
358c362
< echo '<BR>';
> echo '<BR>'. "\n";
475c480
< <tr><td><table>'; //Nested table
> <tr><td><table>'. "\n"; //Nested table
482c487
< echo '<input type="hidden" name="New" value="1">';
> echo '<input type="hidden" name="New" value="1">'. "\n";
484c489
< echo '<TR><TD>'. _('Item Code'). ':</TD><TD><INPUT TYPE="TEXT" NAME="StockID" SIZE=21 MAXLENGTH=20></TD></TR>';
> echo '<TR><TD>'. _('Item Code'). ':</TD><TD><INPUT TYPE="TEXT" NAME="StockID" SIZE=21 MAXLENGTH=20></TD></TR>'. "\n";
526c535
< echo '<TR><TD>' . _('Item Code') . ':</TD><TD>'.$StockID.'</TD></TR>';
> echo '<TR><TD>' . _('Item Code') . ':</TD><TD>'.$StockID.'</TD></TR>'. "\n";
530,531c539,540
< echo '<TR><TD>' . _('Item Code') . ':</TD><TD>'.$StockID.'</TD></TR>';
< echo "<input type='Hidden' name='StockID' value='$StockID'>";
> echo '<TR><TD>' . _('Item Code') . ':</TD><TD>'.$StockID.'</TD></TR>'. "\n";
> echo "<input type='Hidden' name='StockID' value='$StockID'>". "\n";
535c544,546
< echo '<TR><TD>' . _('Part Description') . ' (' . _('short') . '):</TD><TD><input type="Text" name="Description" SIZE=52 MAXLENGTH=50 value="' . htmlentities($_POST['Description'],ENT_QUOTES,_('ISO-8859-1')) . '"></TD></TR>';
> echo '<TR><TD>' . _('Part Description') . ' (' . _('short') . '):</TD><TD><input type="Text" name="Description" SIZE=52 MAXLENGTH=50 value="' . htmlentities($_POST['Description'],ENT_QUOTES,_('ISO-8859-1')) . '"></TD></TR>'. "\n";
> echo '<TR><TD>' . _('Part Description') . ' (' . _('long') . '):</TD><TD><textarea name="LongDescription" cols=40 rows=4>' . htmlentities($_POST['LongDescription'],ENT_QUOTES,_('ISO-8859-1')) . '</textarea></TD></TR>'. "\n";
537c548,584
< echo '<TR><TD>' . _('Part Description') . ' (' . _('long') . '):</TD><TD><textarea name="LongDescription" cols=40 rows=4>' . htmlentities($_POST['LongDescription'],ENT_QUOTES,_('ISO-8859-1')) . '</textarea></TD></TR>';
> // Generate selection drop down from pdf_append directory - by emdx, developed with examples from http://au2.php.net/manual/en/function.opendir.php
> function select_files($dir, $label = "", $select_name = "", $curr_val = "", $char_length = 60) {
> $teller = 0;
> if ($handle = opendir($dir)) {
> $mydir = ($label != "") ? "<label for=\"".$select_name."\">".$label."</label>\n" : "";
> $mydir .= "<select name=\"".$select_name."\">\n";
> $curr_val = (isset($_REQUEST[$select_name])) ? $_REQUEST[$select_name] : $curr_val;
> $mydir .= ($curr_val == "0") ? " <option value=\"0\" selected>none\n" : "<option value=\"\">...\n";
> while (false !== ($file = readdir($handle))) {
> $files[] = $file;
> }
> closedir($handle);
> sort($files);
> foreach ($files as $val) {
> if (is_file($dir.$val)) { // show only real files (ver. 1.01)
> $mydir .= " <option value=\"".$val."\"";
> $mydir .= ($val == $curr_val) ? " selected>" : ">";
> $mydir .= (strlen($val) > $char_length) ? substr($val, 0, $char_length)."...\n" : $val."\n";
> $teller++;
> }
> }
> $mydir .= "</select>";
> }
> if ($teller == 0) {
> $mydir = "No files!";
> } else {
> return $mydir;
> }
> echo '<tr><td>' . _('PDF attachment (.pdf)') . ':</TD><TD>' . "\n" . select_files("/var/www/html/marbleart_erp/pdf_append/", "", "ItemPDF", $_POST['ItemPDF'], "60") . '</td></tr>'. "\n";
> //echo '<TR><TD>' . _('PDF attachment (.pdf) orig') . ':</TD><TD><input type="text" SIZE=20 MAXLENGTH=50 value="' . $_POST['ItemPDF'] . '" name="ItemPDF"> ' . $_POST['ItemPDF'] . '</TD></TR>'. "\n";
540c587
< echo '<tr><td>'. _('Image File (.jpg)') . ':</td><td><input type="file" id="ItemPicture" name="ItemPicture"></td></tr>';
> echo '<tr><td>'. _('Image File (.jpg)') . ':</td><td><input type="file" id="ItemPicture" name="ItemPicture"></td></tr>'. "\n";
543c590
< echo '<tr><td>' . _('Category') . ':</td><td><select name="CategoryID" onChange="ReloadForm(this.form)">';
> echo '<tr><td>' . _('Category') . ':</td><td><select name="CategoryID" onChange="ReloadForm(this.form)">'. "\n";
552c599
< echo '<OPTION SELECTED VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription'];
> echo '<OPTION SELECTED VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription']. "\n";
554c601
< echo '<OPTION VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription'];
> echo '<OPTION VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription']. "\n";
585c632
< echo '<TR><TD>' . _('Economic Order Quantity') . ':</TD><TD><input type="Text" name="EOQ" SIZE=12 MAXLENGTH=10 Value="' . $_POST['EOQ'] . '"></TD></TR>';
> echo '<TR><TD>' . _('Economic Order Quantity') . ':</TD><TD><input type="Text" name="EOQ" SIZE=12 MAXLENGTH=10 Value="' . $_POST['EOQ'] . '"></TD></TR>'. "\n";
587c634
< echo '<TR><TD>' . _('Packaged Volume (metres cubed)') . ':</TD><TD><input type="Text" name="Volume" SIZE=12 MAXLENGTH=10 value="' . $_POST['Volume'] . '"></TD></TR>';
> echo '<TR><TD>' . _('Packaged Volume (metres cubed)') . ':</TD><TD><input type="Text" name="Volume" SIZE=12 MAXLENGTH=10 value="' . $_POST['Volume'] . '"></TD></TR>'. "\n";
589c636
< echo '<TR><TD>' . _('Packaged Weight (KGs)') . ':</TD><TD><input type="Text" name="KGS" SIZE=12 MAXLENGTH=10 value="' . $_POST['KGS'] . '"></TD></TR>';
> echo '<TR><TD>' . _('Packaged Weight (KGs)') . ':</TD><TD><input type="Text" name="KGS" SIZE=12 MAXLENGTH=10 value="' . $_POST['KGS'] . '"></TD></TR>'. "\n";
591c638
< echo '<TR><TD>' . _('Units of Measure') . ':</TD><TD><SELECT name="Units">';
> echo '<TR><TD>' . _('Units of Measure') . ':</TD><TD><SELECT name="Units">'. "\n";
599c646
< echo "<OPTION SELECTED Value='" . $UOMrow['unitname'] . "'>" . $UOMrow['unitname'];
> echo "<OPTION SELECTED Value='" . $UOMrow['unitname'] . "'>" . $UOMrow['unitname']. "\n";
601c648
< echo "<OPTION Value='" . $UOMrow['unitname'] . "'>" . $UOMrow['unitname'];
> echo "<OPTION Value='" . $UOMrow['unitname'] . "'>" . $UOMrow['unitname']. "\n";
605c652
< echo '</SELECT></TD></TR>';
> echo '</SELECT>' . "\n" . '</TD></TR>'. "\n";
607c654
< echo '<TR><TD>' . _('Make, Buy, Kit, Assembly or Service Part') . ':</TD><TD><SELECT name="MBFlag">';
> echo '<TR><TD>' . _('Make, Buy, Kit, Assembly or Service Part') . ':</TD><TD><SELECT name="MBFlag">'. "\n";
609c656
< echo '<OPTION SELECTED VALUE="A">' . _('Assembly');
> echo '<OPTION SELECTED VALUE="A">' . _('Assembly'). "\n";
611c658
< echo '<OPTION VALUE="A">' . _('Assembly');
> echo '<OPTION VALUE="A">' . _('Assembly'). "\n";
614c661
< echo '<OPTION SELECTED VALUE="K">' . _('Kit');
> echo '<OPTION SELECTED VALUE="K">' . _('Kit'). "\n";
616c663
< echo '<OPTION VALUE="K">' . _('Kit');
> echo '<OPTION VALUE="K">' . _('Kit'). "\n";
619c666
< echo '<OPTION SELECTED VALUE="M">' . _('Manufactured');
> echo '<OPTION SELECTED VALUE="M">' . _('Manufactured'). "\n";
621c668
< echo '<OPTION VALUE="M">' . _('Manufactured');
> echo '<OPTION VALUE="M">' . _('Manufactured'). "\n";
624c671
< echo '<OPTION SELECTED VALUE="B">' . _('Purchased');
> echo '<OPTION SELECTED VALUE="B">' . _('Purchased'). "\n";
626c673
< echo '<OPTION VALUE="B">' . _('Purchased');
> echo '<OPTION VALUE="B">' . _('Purchased'). "\n";
630c677
< echo '<OPTION SELECTED VALUE="D">' . _('Service');
> echo '<OPTION SELECTED VALUE="D">' . _('Service'). "\n";
632c679
< echo '<OPTION VALUE="D">' . _('Service');
> echo '<OPTION VALUE="D">' . _('Service'). "\n";
637c684
< echo '<TR><TD>' . _('Current or Obsolete') . ':</TD><TD><SELECT name="Discontinued">';
> echo '<TR><TD>' . _('Current or Obsolete') . ':</TD><TD><SELECT name="Discontinued">'. "\n";
639c686
< echo '<OPTION SELECTED VALUE=0>' . _('Current');
> echo '<OPTION SELECTED VALUE=0>' . _('Current'). "\n";
641c688
< echo '<OPTION VALUE=0>' . _('Current');
> echo '<OPTION VALUE=0>' . _('Current'). "\n";
644c691
< echo '<OPTION SELECTED VALUE=1>' . _('Obsolete');
> echo '<OPTION SELECTED VALUE=1>' . _('Obsolete'). "\n";
646c693
< echo '<OPTION VALUE=1>' . _('Obsolete');
> echo '<OPTION VALUE=1>' . _('Obsolete'). "\n";
650c697
< echo '<TR><TD>' . _('Batch, Serial or Lot Control') . ':</TD><TD><SELECT name="Controlled">';
> echo '<TR><TD>' . _('Batch, Serial or Lot Control') . ':</TD><TD><SELECT name="Controlled">'. "\n";
653c700
< echo '<OPTION SELECTED VALUE=0>' . _('No Control');
> echo '<OPTION SELECTED VALUE=0>' . _('No Control'). "\n";
655c702
< echo '<OPTION VALUE=0>' . _('No Control');
> echo '<OPTION VALUE=0>' . _('No Control'). "\n";
658c705
< echo '<OPTION SELECTED VALUE=1>' . _('Controlled');
> echo '<OPTION SELECTED VALUE=1>' . _('Controlled'). "\n";
660c707
< echo "<OPTION VALUE=1>" . _('Controlled');
> echo "<OPTION VALUE=1>" . _('Controlled'). "\n";
664c711
< echo '<TR><TD>' . _('Serialised') . ':</TD><TD><SELECT name="Serialised">';
> echo '<TR><TD>' . _('Serialised') . ':</TD><TD><SELECT name="Serialised">'. "\n";
667c714
< echo '<OPTION SELECTED VALUE=0>' . _('No');
> echo '<OPTION SELECTED VALUE=0>' . _('No'). "\n";
669c716
< echo '<OPTION VALUE=0>' . _('No');
> echo '<OPTION VALUE=0>' . _('No'). "\n";
672c719
< echo '<OPTION SELECTED VALUE=1>' . _('Yes');
> echo '<OPTION SELECTED VALUE=1>' . _('Yes'). "\n";
674c721
< echo '<OPTION VALUE=1>' . _('Yes');
> echo '<OPTION VALUE=1>' . _('Yes'). "\n";
676c723
< echo '</SELECT><i>' . _('Note') . ', ' . _('this has no effect if the item is not Controlled') . '</i></TD></TR>';
> echo '</SELECT><i>' . _('Note') . ', ' . _('this has no effect if the item is not Controlled') . '</i></TD></TR>'. "\n";
678c725
< echo '<TR><TD>' . _('Decimal Places to Display') . ':</TD><TD><input type="Text" name="DecimalPlaces" SIZE=1 MAXLENGTH=1 value="' . $_POST['DecimalPlaces'] . '"><TD></TR>';
> echo '<TR><TD>' . _('Decimal Places to Display') . ':</TD><TD><input type="Text" name="DecimalPlaces" SIZE=1 MAXLENGTH=1 value="' . $_POST['DecimalPlaces'] . '"><TD></TR>'. "\n";
680c727
< echo '<TR><TD>' . _('Bar Code') . ':</TD><TD><input type="Text" name="BarCode" SIZE=22 MAXLENGTH=20 value="' . $_POST['BarCode'] . '"></TD></TR>';
> echo '<TR><TD>' . _('Bar Code') . ':</TD><TD><input type="Text" name="BarCode" SIZE=22 MAXLENGTH=20 value="' . $_POST['BarCode'] . '"></TD></TR>'. "\n";
682c729
< echo '<TR><TD>' . _('Discount Category') . ':</TD><TD><input type="Text" name="DiscountCategory" SIZE=2 MAXLENGTH=2 value="' . $_POST['DiscountCategory'] . '"></TD></TR>';
> echo '<TR><TD>' . _('Discount Category') . ':</TD><TD><input type="Text" name="DiscountCategory" SIZE=2 MAXLENGTH=2 value="' . $_POST['DiscountCategory'] . '"></TD></TR>'. "\n";
684c731
< echo '<TR><TD>' . _('Tax Category') . ':</TD><TD><SELECT NAME="TaxCat">';
> echo '<TR><TD>' . _('Tax Category') . ':</TD><TD><SELECT NAME="TaxCat">'. "\n";
694c741
< echo '<OPTION SELECTED VALUE=' . $myrow['taxcatid'] . '>' . $myrow['taxcatname'];
> echo '<OPTION SELECTED VALUE=' . $myrow['taxcatid'] . '>' . $myrow['taxcatname']. "\n";
696c743
< echo '<OPTION VALUE=' . $myrow['taxcatid'] . '>' . $myrow['taxcatname'];
> echo '<OPTION VALUE=' . $myrow['taxcatid'] . '>' . $myrow['taxcatname']. "\n";
717c764
< echo '</table></td><td><center>' . _('Image') . '<br>'.$StockImgLink . '</center></td></tr></table><center>';
> echo '</table></td><td><center>' . _('Image') . '<br>'.$StockImgLink . '</center></td></tr></table><center>'. "\n";
721c768
< echo '<input type="Submit" name="submit" value="' . _('Insert New Item') . '">';
> echo '<input type="Submit" name="submit" value="' . _('Insert New Item') . '">'. "\n";
Deletions:
537a547,553
> echo '<TR><TD>' . _('PDF attachment (.pdf)') . ':</TD><TD><input type="text" SIZE=20 MAXLENGTH=50 value="' . $_POST['ItemPDF'] . '" name="ItemPDF"> ' . $_POST['ItemPDF'] . '</TD></TR>';


Revision [1057]

Edited on 2008-01-24 19:34:53 by EmDee [added pdf file selection dropdown]
Additions:
To retain compatibility with the other PDF documents, make this change to the new fpdf.php file,
line 994, replace:
function Output($name='',$dest='')
with
function Output($name='pdf',$dest='S')


Revision [1056]

Edited on 2008-01-24 18:39:32 by EmDee [added pdf file selection dropdown]
Additions:
25th Jan 08 - updated to reflect changes required from webERP v3.08.


Revision [1055]

Edited on 2008-01-24 18:38:33 by EmDee [added pdf file selection dropdown]
Additions:
diff PrintCustTrans.php.3.08 PrintCustTrans.php.new
6a7,15
> error_reporting (E_ALL);
69a81
342a355
419,420c432,433
< $FontSize=6;
< $LeftOvers = $pdf->addTextWrap($Left_Margin+300,$YPos-2,245,$FontSize,$_SESSION['RomalpaClause']);
> $FontSize=9;
> $LeftOvers = $pdf->addTextWrap($Left_Margin+300,$YPos-4,245,$FontSize,$_SESSION['RomalpaClause']);
422c435
< $YPos -=7;
> $YPos-=14;
424a438,442
> /* Add Images for Visa / Mastercard / Paypal */
> $pdf->addJpegFromFile('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg',$Page_Width/2 -280,$YPos-20,0,40);
> $pdf->addText($Page_Width-$Right_Margin-472, $YPos - ($line_height*3)+32,$FontSize, _('National Bank: BSB 083337 Account 035138130'));
> if (isset($_GET['FromTransNo'])){
> } elseif (isset($_POST['FromTransNo'])){
> // Check its an Invoice type again, then select appendfile filename
> //if ($InvOrCredit=='Invoice'){
> //$sql = 'SELECT stockmoves.stockid, stockmaster.appendfile
> // FROM stockmoves,
> //stockmaster
> //WHERE stockmoves.stockid = stockmaster.stockid
> //AND stockmoves.type=10
> //AND stockmoves.transno=' . $FromTransNo . '
> //AND stockmoves.show_on_inv_crds=1';
> //};
> while ($row=DB_fetch_array($result)){
> $pdf->setFiles(array('invoice.pdf',$row['appendfile']));
> // If the appendfile field is empty, just print the invoice without any appended pages
> $pdf->setFiles(array('invoice.pdf'));
1013c1108
< ?>
\ No newline at end of file
> ?>
Deletions:
diff PrintCustTrans.php.old PrintCustTrans.php.new
> if (isset($_GET['FromTransNo']]]{
> } elseif (isset($_POST['FromTransNo']]]{
>// Select the appendfile
> while ($row=DB_fetch_array($result]]{
> $pdf->setFiles(array('invoice.pdf',$row['appendfile']]];
> // If the appendfile field is empty, just print the invoice/creditnote without any appended pages
> $pdf->setFiles(array('invoice.pdf']];


Revision [1054]

Edited on 2008-01-24 18:36:13 by EmDee [added pdf file selection dropdown]
Additions:
242c242,243
300c301,302
316c318,319
350a354
464a469
503c508,509
512a519,521
537a547,553
Deletions:
3c3,4
< /* $Revision: 1.39 $ */
> /* $Revision: 1.33 $ */
10a12,14
> echo "<A HREF='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</A><BR>';
18,31d21
< ?>
< <script LANGUAGE="JavaScript">
< function ReloadForm(form)
< {
< document.ItemForm.submit.click();
< //var val=ItemForm.StockID.value;
< self.location='Stocks.php?&StockID=' + ItemForm.StockID.value;
< }
< </script>
< <?php
< echo "<A HREF='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</A><BR>';
34c24
38,39c28,29
< //But check for the worst
> //But check for the worst
57c47
65d54
124a114
127a118
134,137c125
< $sql = "SELECT mbflag,
< controlled,
< serialised
< FROM stockmaster WHERE stockid = '$StockID'";
> $sql = "SELECT mbflag, controlled, serialised FROM stockmaster WHERE stockid = '$StockID'";
162,164c150,152
< $sql = "SELECT quantity-qtyinvoiced
< FROM salesorderdetails
< WHERE stkcode = '$StockID'
> $sql = "SELECT quantity-qtyinvoiced
> FROM salesorderdetails
> WHERE stkcode = '$StockID'
166c154
177,179c165,167
< $sql = "SELECT quantityord-quantityrecd
< FROM purchorderdetails
< WHERE itemcode = '$StockID'
> $sql = "SELECT quantityord-quantityrecd
> FROM purchorderdetails
> WHERE itemcode = '$StockID'
181c169
242c230,231
250,272d238
< //delete any properties for the item no longer relevant with the change of category
< $result = DB_query("DELETE FROM stockitemproperties
< WHERE stockid ='" . $StockID . "'",
< $db);
< //now insert any item properties
< for ($i=0;$i<$_POST['PropertyCounter'];$i++){
< if ($_POST['PropType' . $i] ==2){
< if ($_POST['PropValue' . $i]=='on'){
< $_POST['PropValue' . $i]=1;
< } else {
< $_POST['PropValue' . $i]=0;
< }
< }
< $result = DB_query("INSERT INTO stockitemproperties (stockid,
< stkcatpropid,
< value)
< VALUES ('" . $StockID . "',
< " . $_POST['PropID' . $i] . ",
< '" . $_POST['PropValue' . $i] . "')",
< $db);
< } //end of loop around properties defined for the category
300c266,267
316c283,284
318c286
323c291
325,329c293,297
< stockid)
< SELECT locations.loccode,
< '" . $StockID . "'
< FROM locations";
> stockid)
> SELECT locations.loccode,
> '" . $StockID . "'
> FROM locations";
333c301
350a319
352,353c321,322
< }//ALL WORKED SO RESET THE FORM VARIABLES
< }//THE INSERT OF THE NEW CODE WORKED SO BANG IN THE STOCK LOCATION RECORDS TOO
> }//ALL WORKED WELL RESET THE FORM VARIABLES
> }//THE INSERT OF THE NEW CODE WORKED SO BANG IN THE STOCK LOCATION RECORDS TOO
430,432d398
< /*Deletes Price records*/
< $sql ="DELETE FROM prices WHERE stockid='$StockID'";
< $result=DB_query($sql,$db,_('Could not delete the prices for this stock record because'),'',true);
444c410
< prnMsg(_('Deleted the stock master record for') . ' ' . $StockID . '....' .
> prnMsg(_('Deleted the stock master record for') . ' ' . $StockID . '....' .
446,448c412,413
< '<BR>. . .' . _('and any bill of material that may have been set up for the part') .
< '<BR> . . . .' . _('and any purchasing data that may have been set up for the part') .
< '<BR> . . . . .' . _('and any prices that may have been set up for the part'),'success');
> '<BR>. . .' . _('and any bill of material that may have been set up for the part') .
> '<BR> . . . .' . _('and any purchasing data that may have been set up for the part'),'success');
464a430
474,475c440,441
< echo '<form name="ItemForm" enctype="multipart/form-data" method="post" action="' . $_SERVER['PHP_SELF'] . '?' .SID .'"><center><table>
< <tr><td><table>'; //Nested table
> echo '<FORM ENCTYPE="MULTIPART/FORM-DATA" METHOD="POST" ACTION="' . $_SERVER['PHP_SELF'] . '?' .SID .'"><CENTER><TABLE>
> <TR><TD><TABLE>'; //Nested table
477c443
< if (!isset($StockID)) {
> if (!isset($StockID) OR isset($_POST['New'])) {
481,482c447
< $New = true;
< echo '<input type="hidden" name="New" value="1">';
> echo '<INPUT TYPE="HIDDEN" NAME="New" VALUE="Yes">';
484c449
< echo '<TR><TD>'. _('Item Code'). ':</TD><TD><INPUT TYPE="TEXT" NAME="StockID" SIZE=21 MAXLENGTH=20></TD></TR>';
> echo '<TR><TD>'. _('Item Code'). ':</TD><TD><INPUT TYPE="TEXT" NAME="StockID" SIZE=21 MAXLENGTH=20 Value="'.$StockID.'"></TD></TR>';
503c468,469
512a479,481
528c497
533c502
538a508,514
540c516
< echo '<tr><td>'. _('Image File (.jpg)') . ':</td><td><input type="file" id="ItemPicture" name="ItemPicture"></td></tr>';
> echo '<TR><TD>'. _('Image File (.jpg)') . ':</TD><TD><input type="file" id="ItemPicture" name="ItemPicture"></TD></TR>';
543c519
< echo '<tr><td>' . _('Category') . ':</td><td><select name="CategoryID" onChange="ReloadForm(this.form)">';
> echo '<TR><TD>' . _('Category') . ':</TD><TD><SELECT name=CategoryID>';
558c534
< echo '</select><a target="_blank" href="'. $rootpath . '/StockCategories.php?' . SID . '">' . _('Add or Modify Stock Categories') . '</a></td></tr>';
> echo '</SELECT><a target="_blank" href="'. $rootpath . '/StockCategories.php?' . SID . '">' . _('Add or Modify Stock Categories') . '</a></TD></TR>';
691c667
717c693
< echo '</table></td><td><center>' . _('Image') . '<br>'.$StockImgLink . '</center></td></tr></table><center>';
> echo '</TABLE></TD><TD><CENTER>' . _('Image') . '<BR>'.$StockImgLink . '</CENTER></TD></TR></TABLE><CENTER>';
720c696
< if ($New) {
> if (isset($_POST['New']) OR $_POST['New']!="") {
725,785c701
< // Now the form to enter the item properties
< echo '<table><tr><td class="tableheader" colspan="2">' . _('Item Category Properties') . '</td></tr>';
< $sql = "SELECT stkcatpropid,
< label,
< controltype,
< defaultvalue
< FROM stockcatproperties
< WHERE categoryid ='" . DB_escape_string($_POST['CategoryID']) . "'
< AND reqatsalesorder =0
< ORDER BY stkcatpropid";
< $PropertiesResult = DB_query($sql,$db);
< $PropertyCounter = 0;
< $PropertyWidth = array();
< while ($PropertyRow=DB_fetch_array($PropertiesResult)){
< $PropValResult = DB_query("SELECT value FROM
< stockitemproperties
< WHERE stockid='" . $StockID . "'
< AND stkcatpropid =" . $PropertyRow['stkcatpropid'],
< $db);
< $PropValRow = DB_fetch_row($PropValResult);
< $PropertyValue = $PropValRow[0];
< echo '<input type="hidden" name="PropID' . $PropertyCounter . '" value=' .$PropertyRow['stkcatpropid'] .'>';
< echo '<tr><td>' . $PropertyRow['label'] . '</td>
< <td>';
< switch ($PropertyRow['controltype']) {
< case 0; //textbox
< echo '<input type="textbox" name="PropValue' . $PropertyCounter . '" size="20" maxlength="100" value="' . $PropertyValue . '">';
< break;
< case 1; //select box
< $OptionValues = explode(',',$PropertyRow['defaultvalue']);
< echo '<select name="PropValue' . $PropertyCounter . '">';
< foreach ($OptionValues as $PropertyOptionValue){
< if ($PropertyOptionValue == $PropertyValue){
< echo '<option selected value="' . $PropertyOptionValue . '">' . $PropertyOptionValue . '</option>';
< } else {
< echo '<option value="' . $PropertyOptionValue . '">' . $PropertyOptionValue . '</option>';
< }
< }
< echo '</select>';
< break;
< case 2; //checkbox
< echo '<input type="checkbox" name="PropValue' . $PropertyCounter . '"';
< if ($PropertyValue==1){
< echo '"checked"';
< }
< echo '>';
< break;
< } //end switch
< echo '<input type="hidden" name="PropType' . $PropertyCounter .'" value=' . $PropertyRow['controltype'] . '>';
< echo '</td></tr>';
< $PropertyCounter++;
< } //end loop round properties for the item category
< echo '</table>';
< echo '<input type="hidden" name="PropertyCounter" value=' . $PropertyCounter . '>';
< echo '<input type="submit" name="submit" value="' . _('Update') . '">';
> echo '<input type="Submit" name="submit" value="' . _('Update') . '">';


Revision [1053]

Edited on 2008-01-24 18:33:08 by EmDee [added pdf file selection dropdown]
Additions:
diff Stocks.php.3.08 Stocks.php.new
3c3,4
< /* $Revision: 1.39 $ */
> /* $Revision: 1.33 $ */
10a12,14
> echo "<A HREF='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</A><BR>';
18,31d21
< ?>
< <script LANGUAGE="JavaScript">
< function ReloadForm(form)
< {
< document.ItemForm.submit.click();
< //var val=ItemForm.StockID.value;
< self.location='Stocks.php?&StockID=' + ItemForm.StockID.value;
< }
< </script>
< <?php
< echo "<A HREF='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</A><BR>';
34c24
38,39c28,29
< //But check for the worst
> //But check for the worst
57c47
65d54
124a114
127a118
134,137c125
< $sql = "SELECT mbflag,
< controlled,
< serialised
< FROM stockmaster WHERE stockid = '$StockID'";
> $sql = "SELECT mbflag, controlled, serialised FROM stockmaster WHERE stockid = '$StockID'";
162,164c150,152
< $sql = "SELECT quantity-qtyinvoiced
< FROM salesorderdetails
< WHERE stkcode = '$StockID'
> $sql = "SELECT quantity-qtyinvoiced
> FROM salesorderdetails
> WHERE stkcode = '$StockID'
166c154
177,179c165,167
< $sql = "SELECT quantityord-quantityrecd
< FROM purchorderdetails
< WHERE itemcode = '$StockID'
> $sql = "SELECT quantityord-quantityrecd
> FROM purchorderdetails
> WHERE itemcode = '$StockID'
181c169
242c230,231
250,272d238
< //delete any properties for the item no longer relevant with the change of category
< $result = DB_query("DELETE FROM stockitemproperties
< WHERE stockid ='" . $StockID . "'",
< $db);
< //now insert any item properties
< for ($i=0;$i<$_POST['PropertyCounter'];$i++){
< if ($_POST['PropType' . $i] ==2){
< if ($_POST['PropValue' . $i]=='on'){
< $_POST['PropValue' . $i]=1;
< } else {
< $_POST['PropValue' . $i]=0;
< }
< }
< $result = DB_query("INSERT INTO stockitemproperties (stockid,
< stkcatpropid,
< value)
< VALUES ('" . $StockID . "',
< " . $_POST['PropID' . $i] . ",
< '" . $_POST['PropValue' . $i] . "')",
< $db);
< } //end of loop around properties defined for the category
300c266,267
316c283,284
318c286
323c291
325,329c293,297
< stockid)
< SELECT locations.loccode,
< '" . $StockID . "'
< FROM locations";
> stockid)
> SELECT locations.loccode,
> '" . $StockID . "'
> FROM locations";
333c301
350a319
352,353c321,322
< }//ALL WORKED SO RESET THE FORM VARIABLES
< }//THE INSERT OF THE NEW CODE WORKED SO BANG IN THE STOCK LOCATION RECORDS TOO
> }//ALL WORKED WELL RESET THE FORM VARIABLES
> }//THE INSERT OF THE NEW CODE WORKED SO BANG IN THE STOCK LOCATION RECORDS TOO
430,432d398
< /*Deletes Price records*/
< $sql ="DELETE FROM prices WHERE stockid='$StockID'";
< $result=DB_query($sql,$db,_('Could not delete the prices for this stock record because'),'',true);
444c410
< prnMsg(_('Deleted the stock master record for') . ' ' . $StockID . '....' .
> prnMsg(_('Deleted the stock master record for') . ' ' . $StockID . '....' .
446,448c412,413
< '<BR>. . .' . _('and any bill of material that may have been set up for the part') .
< '<BR> . . . .' . _('and any purchasing data that may have been set up for the part') .
< '<BR> . . . . .' . _('and any prices that may have been set up for the part'),'success');
> '<BR>. . .' . _('and any bill of material that may have been set up for the part') .
> '<BR> . . . .' . _('and any purchasing data that may have been set up for the part'),'success');
464a430
474,475c440,441
< echo '<form name="ItemForm" enctype="multipart/form-data" method="post" action="' . $_SERVER['PHP_SELF'] . '?' .SID .'"><center><table>
< <tr><td><table>'; //Nested table
> echo '<FORM ENCTYPE="MULTIPART/FORM-DATA" METHOD="POST" ACTION="' . $_SERVER['PHP_SELF'] . '?' .SID .'"><CENTER><TABLE>
> <TR><TD><TABLE>'; //Nested table
477c443
< if (!isset($StockID)) {
> if (!isset($StockID) OR isset($_POST['New'])) {
481,482c447
< $New = true;
< echo '<input type="hidden" name="New" value="1">';
> echo '<INPUT TYPE="HIDDEN" NAME="New" VALUE="Yes">';
484c449
< echo '<TR><TD>'. _('Item Code'). ':</TD><TD><INPUT TYPE="TEXT" NAME="StockID" SIZE=21 MAXLENGTH=20></TD></TR>';
> echo '<TR><TD>'. _('Item Code'). ':</TD><TD><INPUT TYPE="TEXT" NAME="StockID" SIZE=21 MAXLENGTH=20 Value="'.$StockID.'"></TD></TR>';
503c468,469
512a479,481
528c497
533c502
538a508,514
> // Add PDF attachment upload for Items - by Emdx
> // EOR Add Image upload for New Item - by Emdx
540c516
< echo '<tr><td>'. _('Image File (.jpg)') . ':</td><td><input type="file" id="ItemPicture" name="ItemPicture"></td></tr>';
> echo '<TR><TD>'. _('Image File (.jpg)') . ':</TD><TD><input type="file" id="ItemPicture" name="ItemPicture"></TD></TR>';
543c519
< echo '<tr><td>' . _('Category') . ':</td><td><select name="CategoryID" onChange="ReloadForm(this.form)">';
> echo '<TR><TD>' . _('Category') . ':</TD><TD><SELECT name=CategoryID>';
558c534
< echo '</select><a target="_blank" href="'. $rootpath . '/StockCategories.php?' . SID . '">' . _('Add or Modify Stock Categories') . '</a></td></tr>';
> echo '</SELECT><a target="_blank" href="'. $rootpath . '/StockCategories.php?' . SID . '">' . _('Add or Modify Stock Categories') . '</a></TD></TR>';
691c667
717c693
< echo '</table></td><td><center>' . _('Image') . '<br>'.$StockImgLink . '</center></td></tr></table><center>';
> echo '</TABLE></TD><TD><CENTER>' . _('Image') . '<BR>'.$StockImgLink . '</CENTER></TD></TR></TABLE><CENTER>';
720c696
< if ($New) {
> if (isset($_POST['New']) OR $_POST['New']!="") {
725,785c701
< // Now the form to enter the item properties
< echo '<table><tr><td class="tableheader" colspan="2">' . _('Item Category Properties') . '</td></tr>';
< $sql = "SELECT stkcatpropid,
< label,
< controltype,
< defaultvalue
< FROM stockcatproperties
< WHERE categoryid ='" . DB_escape_string($_POST['CategoryID']) . "'
< AND reqatsalesorder =0
< ORDER BY stkcatpropid";
< $PropertiesResult = DB_query($sql,$db);
< $PropertyCounter = 0;
< $PropertyWidth = array();
< while ($PropertyRow=DB_fetch_array($PropertiesResult)){
< $PropValResult = DB_query("SELECT value FROM
< stockitemproperties
< WHERE stockid='" . $StockID . "'
< AND stkcatpropid =" . $PropertyRow['stkcatpropid'],
< $db);
< $PropValRow = DB_fetch_row($PropValResult);
< $PropertyValue = $PropValRow[0];
< echo '<input type="hidden" name="PropID' . $PropertyCounter . '" value=' .$PropertyRow['stkcatpropid'] .'>';
< echo '<tr><td>' . $PropertyRow['label'] . '</td>
< <td>';
< switch ($PropertyRow['controltype']) {
< case 0; //textbox
< echo '<input type="textbox" name="PropValue' . $PropertyCounter . '" size="20" maxlength="100" value="' . $PropertyValue . '">';
< break;
< case 1; //select box
< $OptionValues = explode(',',$PropertyRow['defaultvalue']);
< echo '<select name="PropValue' . $PropertyCounter . '">';
< foreach ($OptionValues as $PropertyOptionValue){
< if ($PropertyOptionValue == $PropertyValue){
< echo '<option selected value="' . $PropertyOptionValue . '">' . $PropertyOptionValue . '</option>';
< } else {
< echo '<option value="' . $PropertyOptionValue . '">' . $PropertyOptionValue . '</option>';
< }
< }
< echo '</select>';
< break;
< case 2; //checkbox
< echo '<input type="checkbox" name="PropValue' . $PropertyCounter . '"';
< if ($PropertyValue==1){
< echo '"checked"';
< }
< echo '>';
< break;
< } //end switch
< echo '<input type="hidden" name="PropType' . $PropertyCounter .'" value=' . $PropertyRow['controltype'] . '>';
< echo '</td></tr>';
< $PropertyCounter++;
< } //end loop round properties for the item category
< echo '</table>';
< echo '<input type="hidden" name="PropertyCounter" value=' . $PropertyCounter . '>';
< echo '<input type="submit" name="submit" value="' . _('Update') . '">';
> echo '<input type="Submit" name="submit" value="' . _('Update') . '">';
Deletions:
diff Stocks.php.old Stocks.php.new
55d54
231c230,231
266c266,267
282c283,284
316a319
426a430
464c468,469
473a479,481
498a507,513


Revision [1052]

Edited on 2008-01-24 17:43:16 by EmDee [some comments]
Additions:
<Phil>I'm not sure if the document to append should be determined by reference to the customer or perhaps by the items on the invoice. - this implementation has a document selected per customer and it is sent with every customer</Phil> <emdee> This implementation actually has a PDF document per stock item, its attached only if the stock item is on the invoice. </emdee>
We require at least FPDF version 1.53. Make sure your includes/fpdf.php file is up-to-date. <emdee> The current 3.08 weberp package has an older version of FPDF, you need to overwrite with the latest versions. </emdee>
We require at least FPDI version 1.2. Download FPDI package, unzip and move to fpdi directory under webERP installation root.
Deletions:
<Phil>I'm not sure if the document to append should be determined by reference to the customer or perhaps by the items on the invoice. - this implementation has a document selected per customer and it is sent with every customer</Phil>
We require FPDF version 1.53. Make sure your fpdf.php file in the webERP root, and the includes folder is up-to-date. Note webERP has fpdf.php in TWO locations. - <Phil>Its only in the includes directory currently - do we need to have the same file twice?</Phil>
We require the FPDI version 1.2. Download FPDI package, unzip and move to fpdi directory under webERP installation root.


Revision [686]

Edited on 2007-10-28 22:27:06 by PhilDaintree [some comments]
Additions:
<Phil>I'm not sure if the document to append should be determined by reference to the customer or perhaps by the items on the invoice. - this implementation has a document selected per customer and it is sent with every customer</Phil>


Revision [259]

The oldest known version of this page was created on 2007-06-17 18:52:02 by EmDee [some comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki