} else { $RemTxt = _('Delete'); } echo '</td><td class="number">' . $DisplayLineTotal . '</td>'; $LineDueDate = $OrderLine->ItemDue; if (!Is_Date($OrderLine->ItemDue)) { $LineDueDate = DateAdd(Date($_SESSION['DefaultDateFormat']), 'd', $_SESSION['Items' . $identifier]->DeliveryDays); $_SESSION['Items' . $identifier]->LineItems[$OrderLine->LineNumber]->ItemDue = $LineDueDate; } echo '<td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ItemDue_' . $OrderLine->LineNumber . '" size="10" maxlength="10" value="' . $LineDueDate . '" /></td>'; echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?identifier=' . $identifier . '&Delete=' . $OrderLine->LineNumber . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . $RemTxt . '</a></td> <td>' . $LineComments . '</td></tr>'; if ($_SESSION['AllowOrderLineItemNarrative'] == 1) { echo $RowStarter; echo '<td colspan="10">' . _('Narrative') . ': <textarea name="Narrative_' . $OrderLine->LineNumber . '" cols="100%" rows="1">' . stripslashes(AddCarriageReturns($OrderLine->Narrative)) . '</textarea> <br /></td></tr>'; } else { echo '<input type="hidden" name="Narrative" value="" />'; } $PropertySQL = "SELECT label,\n\t\t\t\t\t\t\t\tcontroltype,\n\t\t\t\t\t\t\t\tstkcatpropid,\n\t\t\t\t\t\t\t\tnumericvalue\n\t\t\t\t\t\t\tFROM stockcatproperties\n\t\t\t\t\t\t\tLEFT JOIN stockmaster\n\t\t\t\t\t\t\tON stockcatproperties.categoryid=stockmaster.categoryid\n\t\t\t\t\t\t\tWHERE stockmaster.stockid='" . $OrderLine->StockID . "'\n\t\t\t\t\t\t\t\tAND reqatsalesorder=1"; $PropertyResult = DB_query($PropertySQL, $db); if (DB_num_rows($PropertyResult) > 0) { $PropertyCounter = 0; while ($PropertyRow = DB_fetch_array($PropertyResult)) { if ($k == 1) { echo '<tr class="OddTableRows">'; $k = 0; } else { echo '<tr class="EvenTableRows">'; $k = 1;
</tr>'; foreach ($ItemDescriptionLanguages as $DescriptionLanguage) { if ($DescriptionLanguage != '') { //unfortunately cannot have points in POST variables so have to mess with the language id $PostVariableName = 'Description_' . str_replace('.', '_', $DescriptionLanguage); if (!isset($_POST[$PostVariableName])) { $_POST[$PostVariableName] = ''; } echo '<tr> <td>' . $LanguagesArray[$DescriptionLanguage]['LanguageName'] . ' ' . _('Description') . ':</td> <td><input type="text" name="' . $PostVariableName . '" size="52" maxlength="50" value="' . $_POST[$PostVariableName] . '" /></td> </tr>'; } } if (isset($_POST['LongDescription'])) { $LongDescription = AddCarriageReturns($_POST['LongDescription']); } else { $LongDescription = ''; } echo '<tr> <td>' . _('Part Description') . ' (' . _('long') . '):</td> <td><textarea ' . (in_array('LongDescription', $Errors) ? 'class="texterror"' : '') . ' name="LongDescription" cols="40" rows="3">' . stripslashes($LongDescription) . '</textarea></td> </tr> <tr> <td>' . _('Image File (.jpg)') . ':</td> <td><input type="file" id="ItemPicture" name="ItemPicture" /> <br /> <input type="checkbox" name="ClearImage" id="ClearImage" value="1" /> ' . _('Clear Image') . ' </td>'; // if this is the first time displaying the form, there will only be a picture with the OldStockID name, if any, else there can be a $_POST['OldStockID'].'-TEMP'. '.jpg' file if one was uploaded if (empty($_POST['StockID']) or $_POST['StockID'] == $_POST['OldStockID']) {
} else { $TaxTotals[$Tax->TaxAuthID] += $Tax->TaxRate * $SubTotal; $TaxLineTotal += $Tax->TaxRate * $SubTotal; } $TaxGLCodes[$Tax->TaxAuthID] = $Tax->TaxGLCode; } } $TaxTotal += $TaxLineTotal; $_SESSION['Items' . $identifier]->TaxTotals = $TaxTotals; $_SESSION['Items' . $identifier]->TaxGLCodes = $TaxGLCodes; echo '<td class="number">' . locale_number_format($TaxLineTotal, $_SESSION['Items' . $identifier]->CurrDecimalPlaces) . '</td>'; echo '<td class="number">' . locale_number_format($SubTotal + $TaxLineTotal, $_SESSION['Items' . $identifier]->CurrDecimalPlaces) . '</td>'; echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?identifier=' . $identifier . '&Delete=' . $OrderLine->LineNumber . '" onclick="return MakeConfirm(\'' . _('Are You Sure?') . '\', \'Confirm Delete\', this);">' . _('Delete') . '</a></td></tr>'; if ($_SESSION['AllowOrderLineItemNarrative'] == 1) { echo $RowStarter; echo '<td valign="top" colspan="11">' . _('Narrative') . ':<textarea name="Narrative_' . $OrderLine->LineNumber . '" cols="100" rows="1">' . stripslashes(AddCarriageReturns($OrderLine->Narrative)) . '</textarea><br /></td></tr>'; } else { echo '<input type="hidden" name="Narrative" value="" />'; } $_SESSION['Items' . $identifier]->total = $_SESSION['Items' . $identifier]->total + $SubTotal; $_SESSION['Items' . $identifier]->totalVolume = $_SESSION['Items' . $identifier]->totalVolume + $OrderLine->Quantity * $OrderLine->Volume; $_SESSION['Items' . $identifier]->totalWeight = $_SESSION['Items' . $identifier]->totalWeight + $OrderLine->Quantity * $OrderLine->Weight; } /* end of loop around items */ echo '<tr class="EvenTableRows">'; if (in_array(1000, $_SESSION['AllowedPageSecurityTokens'])) { echo '<td colspan="8" class="number"><b>' . _('Total') . '</b></td>'; } else { echo '<td colspan="6" class="number"><b>' . _('Total') . '</b></td>'; } echo '<td class="number">' . locale_number_format($_SESSION['Items' . $identifier]->total, $_SESSION['Items' . $identifier]->CurrDecimalPlaces) . '</td>
$RemTxt = _('Clear Remaining'); } else { $RemTxt = _('Delete'); } echo '<td class="number">' . $DisplayLineTotal . '</td>'; $LineDueDate = $OrderLine->ItemDue; if (!Is_Date($OrderLine->ItemDue)) { $LineDueDate = DateAdd(Date($_SESSION['DefaultDateFormat']), 'd', $_SESSION['Items' . $identifier]->DeliveryDays); $_SESSION['Items' . $identifier]->LineItems[$OrderLine->LineNumber]->ItemDue = $LineDueDate; } echo '<td><input alt="' . $_SESSION['DefaultDateFormat'] . '" class="date" maxlength="10" name="ItemDue_' . $OrderLine->LineNumber . '" size="10" type="text" value="' . $LineDueDate . '" /></td>'; echo '<td rowspan="2"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?identifier=' . $identifier . '&Delete=' . $OrderLine->LineNumber . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . $RemTxt . '</a></td></tr>'; if ($_SESSION['AllowOrderLineItemNarrative'] == 1) { echo $RowStarter; $varColSpan = 8 + $ShowPOLine + $ShowDiscountGP; echo '<td colspan="' . $varColSpan . '">' . _('Narrative') . ':<textarea name="Narrative_' . $OrderLine->LineNumber . '" cols="100%" rows="1" title="' . _('Enter any narrative to describe to the customer the nature of the charge for this line') . '" >' . stripslashes(AddCarriageReturns($OrderLine->Narrative)) . '</textarea><br /></td> </tr>'; } else { echo '<tr> <td><input name="Narrative" type="hidden" value="" /></td> </tr>'; } $_SESSION['Items' . $identifier]->total = $_SESSION['Items' . $identifier]->total + $LineTotal; $_SESSION['Items' . $identifier]->totalVolume = $_SESSION['Items' . $identifier]->totalVolume + $OrderLine->Quantity * $OrderLine->Volume; $_SESSION['Items' . $identifier]->totalWeight = $_SESSION['Items' . $identifier]->totalWeight + $OrderLine->Quantity * $OrderLine->Weight; } /* end of loop around items */ $DisplayTotal = locale_number_format($_SESSION['Items' . $identifier]->total, $_SESSION['Items' . $identifier]->CurrDecimalPlaces); /* if (in_array($_SESSION['PageSecurityArray']['OrderEntryDiscountPricing'], $_SESSION['AllowedPageSecurityTokens'])){ $ColSpanNumber = 2; } else {
$LongDescription = ''; } echo '<tr> <td>' . _('Part Description') . ' (' . _('long') . '):</td> <td><textarea ' . (in_array('LongDescription', $Errors) ? 'class="texterror"' : '') . ' name="LongDescription" cols="40" rows="3">' . stripslashes($LongDescription) . '</textarea></td> </tr>'; foreach ($ItemDescriptionLanguagesArray as $LanguageId) { if ($LanguageId != '') { //unfortunately cannot have points in POST variables so have to mess with the language id $PostVariableName = 'LongDescription_' . str_replace('.', '_', $LanguageId); if (!isset($_POST[$PostVariableName])) { $_POST[$PostVariableName] = ''; } echo '<tr> <td>' . $LanguagesArray[$LanguageId]['LanguageName'] . ' ' . _('Long Description') . ':</td> <td><textarea name="' . $PostVariableName . '"" cols="40" rows="3">' . stripslashes(AddCarriageReturns($_POST[$PostVariableName])) . '</textarea></td> </tr>'; } } echo '<tr> <td>' . _('Image File (.jpg)') . ':</td> <td><input type="file" id="ItemPicture" name="ItemPicture" /> <br /><input type="checkbox" name="ClearImage" id="ClearImage" value="1" > ' . _('Clear Image') . ' </td>'; if (function_exists('imagecreatefromjpg') && isset($StockID) && !empty($StockID)) { $StockImgLink = '<img src="GetStockImage.php?automake=1&textcolor=FFFFFF&bgcolor=CCCCCC' . '&StockID=' . urlencode($StockID) . '&text=' . '&width=100' . '&height=100' . '" alt="" />'; } else { if (isset($StockID) and !empty($StockID) and file_exists($_SESSION['part_pics_dir'] . '/' . $StockID . '.jpg')) { $StockImgLink = '<img src="' . $_SESSION['part_pics_dir'] . '/' . $StockID . '.jpg" height="100" width="100" />'; if (isset($_POST['ClearImage'])) { //workaround for many variations of permission issues that could cause unlink fail
if ($_SESSION['Items']->Some_Already_Delivered($OrderLine->LineNumber)) { $RemTxt = _('Clear Remaining'); } else { $RemTxt = _('Delete'); } echo '</TD><TD ALIGN=RIGHT>' . $DisplayLineTotal . '</FONT></TD>'; $LineDueDate = $OrderLine->ItemDue; if (!Is_Date($OrderLine->ItemDue)) { $LineDueDate = DateAdd(Date($_SESSION['DefaultDateFormat']), 'd', $_SESSION['Items']->DeliveryDays); $_SESSION['Items']->LineItems[$OrderLine->LineNumber]->ItemDue = $LineDueDate; } echo '<TD><INPUT TYPE=TEXT NAME="ItemDue_' . $OrderLine->LineNumber . '" SIZE=10 MAXLENGTH=10 VALUE=' . $LineDueDate . '></TD>'; echo '<TD><A HREF="' . $_SERVER['PHP_SELF'] . '?' . SID . '&Delete=' . $OrderLine->LineNumber . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . $RemTxt . '</A></TD></TR>'; if ($_SESSION['AllowOrderLineItemNarrative'] == 1) { echo $RowStarter; echo '<TD COLSPAN=7><TEXTAREA NAME="Narrative_' . $OrderLine->LineNumber . '" cols=100% rows=1>' . AddCarriageReturns($OrderLine->Narrative) . '</TEXTAREA><BR><HR></TD></TR>'; } else { echo '<INPUT TYPE=HIDDEN NAME="Narrative" VALUE="">'; } $_SESSION['Items']->total = $_SESSION['Items']->total + $LineTotal; $_SESSION['Items']->totalVolume = $_SESSION['Items']->totalVolume + $OrderLine->Quantity * $OrderLine->Volume; $_SESSION['Items']->totalWeight = $_SESSION['Items']->totalWeight + $OrderLine->Quantity * $OrderLine->Weight; } /* end of loop around items */ $DisplayTotal = number_format($_SESSION['Items']->total, 2); echo '<TR><TD></TD><TD><B>' . _('TOTAL Excl Tax/Freight') . '</B></TD><TD COLSPAN=6 ALIGN=RIGHT>' . $DisplayTotal . '</TD></TR></TABLE>'; $DisplayVolume = number_format($_SESSION['Items']->totalVolume, 2); $DisplayWeight = number_format($_SESSION['Items']->totalWeight, 2); echo '<TABLE BORDER=1><TR><TD>' . _('Total Weight') . ':</TD> <TD>' . $DisplayWeight . '</TD> <TD>' . _('Total Volume') . ':</TD>
echo '<TR><TD>' . _('Requistion Ref') . ":</TD><TD><INPUT TYPE=TEXT NAME='Requisition' SIZE=16 MAXLENGTH=15 VALUE=" . $_POST['Requisition'] . '></TD> </TR>'; echo '<TR><TD>' . _('Exchange Rate') . ":</TD>\n\t\t<TD><INPUT TYPE=TEXT NAME='ExRate' SIZE=16 MAXLENGTH=15 VALUE=" . $_POST['ExRate'] . '></TD> </TR>'; echo '<TR><TD>' . _('Date Printed') . ':</TD><TD>'; if (isset($_SESSION['PO']->DatePurchaseOrderPrinted) and strlen($_SESSION['PO']->DatePurchaseOrderPrinted) > 6) { echo ConvertSQLDate($_SESSION['PO']->DatePurchaseOrderPrinted); $Printed = True; } else { $Printed = False; echo _('Not yet printed'); } if ($_SESSION['PO']->AllowPrintPO == 0 and $_POST['RePrint'] != 1) { echo '<TR><TD>' . _('Allow Reprint') . ":</TD><TD><SELECT NAME='RePrint'><OPTION SELECTED VALUE=0>" . _('No') . "<OPTION VALUE=1>" . _('Yes') . '</SELECT></TD></TR>'; } elseif ($Printed) { echo "<TR><TD COLSPAN=2 ALIGN=CENTER><A target='_blank' HREF='{$rootpath}/PO_PDFPurchOrder.php?" . SID . "OrderNo=" . $_SESSION['ExistingOrder'] . "'>" . _('Reprint Now') . '</A></TD></TR>'; } echo '</TD></TR></TABLE>'; /* end of sub table nested */ echo '</TD></TR><TR><TD VALIGN=TOP COLSPAN=2>' . _('Comments'); if (!isset($_POST['Comments'])) { $_POST['Comments'] = ''; } echo ":<textarea name='Comments' cols=70 rows=2>" . AddCarriageReturns($_POST['Comments']) . '</textarea>'; echo '</TD></TR></TABLE>'; /* end of main table */ echo "<INPUT TYPE=SUBMIT Name='EnterLines' VALUE='" . _('Enter Line Items') . "'><INPUT TYPE=SUBMIT Name='ChangeSupplier' VALUE='" . _('Change supplier') . "'><BR><BR><INPUT TYPE=SUBMIT NAME='CancelOrder' VALUE='" . _("Cancel and Delete The Whole Order") . "'>"; } /*end of if supplier selected */ echo '</form>'; include 'includes/footer.inc';