1<?php 2/*Input Serial Items - used for inputing serial numbers or batch/roll/bundle references 3for controlled items - used in: 4- ConfirmDispatchControlledInvoice.php 5- GoodsReceivedControlled.php 6- StockAdjustments.php 7- StockTransfers.php 8- CreditItemsControlled.php 9 10*/ 11 12//we start with a batch or serial no header and need to display something for verification... 13global $TableHeader; 14 15if (isset($_GET['LineNo'])){ 16 $LineNo = $_GET['LineNo']; 17} elseif (isset($_POST['LineNo'])){ 18 $LineNo = $_POST['LineNo']; 19} 20 21/*Display the batches already entered with quantities if not serialised */ 22 23echo '<table class="selection"> 24 <tr><td valign="top"> 25 <table class="selection">'; 26echo $TableHeader; 27 28$TotalQuantity = 0; /*Variable to accumulate total quantity received */ 29$RowCounter =0; 30 31foreach ($LineItem->SerialItems as $Bundle){ 32 33 if ($RowCounter == 10){ 34 echo $TableHeader; 35 $RowCounter =0; 36 } else { 37 $RowCounter++; 38 } 39 40 echo '<tr class="striped_row"> 41 <td>' . $Bundle->BundleRef . '</td>'; 42 43 if ($LineItem->Serialised==0){ 44 echo '<td class="number">' . locale_number_format($Bundle->BundleQty, $LineItem->DecimalPlaces) . '</td>'; 45 } 46 if ($Perishable==1){ 47 echo '<td class="number">' . $Bundle->ExpiryDate . '</td>'; 48 } 49 50 51 echo '<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Delete=' . $Bundle->BundleRef . '&StockID=' . $LineItem->StockID . '&LineNo=' . $LineNo .'&identifier=' . $identifier . $CreditInvoice . '">' . _('Delete'). '</a></td> 52 </tr>'; 53 54 $TotalQuantity += $Bundle->BundleQty; 55} 56 57 58/*Display the totals and rule off before allowing new entries */ 59if ($LineItem->Serialised==1){ 60 echo '<tr><td class="number"><b>' . _('Total Quantity'). ': ' . locale_number_format($TotalQuantity,$LineItem->DecimalPlaces) . '</b></td></tr>'; 61} else { 62 echo '<tr> 63 <td class="number"><b>' . _('Total Quantity'). ':</b></td> 64 <td class="number"><b>' . locale_number_format($TotalQuantity,$LineItem->DecimalPlaces) . '</b></td> 65 </tr>'; 66} 67 68/*Close off old table */ 69echo '</table></td><td valign="top">'; 70 71 72echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?identifier=' . urlencode($identifier) . '" id="Ga6uF5Wa" method="post"> 73 <div> 74 <input type="hidden" name="LineNo" value="' . $LineNo . '" /> 75 <input type="hidden" name="StockID" value="' . $StockID . '" /> 76 <input type="hidden" name="EntryType" value="KEYED" /> 77 <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; 78 79if (isset($_GET['CreditInvoice']) OR isset($_POST['CreditInvoice'])){ 80 echo '<input type="hidden" name="CreditInvoice" value="Yes" />'; 81} 82/*Start a new table for the Serial/Batch ref input in one column (as a sub table 83then the multi select box for selection of existing bundle/serial nos for dispatch if applicable*/ 84 85/*in the first column add a table for the input of newies */ 86echo '<table class="selection">'; 87echo $TableHeader; 88 89if ( isset($_GET['EditControlled']) ) { 90 $EditControlled = isset($_GET['EditControlled'])?$_GET['EditControlled']:false; 91} elseif ( isset($_POST['EditControlled']) ){ 92 $EditControlled = isset($_POST['EditControlled'])?$_POST['EditControlled']:false; 93} else { 94 $EditControlled=false; 95} 96 97$StartAddingAt = 0; 98if ($EditControlled){ 99 foreach ($LineItem->SerialItems as $Bundle){ 100 101 echo '<tr> 102 <td valign="top"><input type="text" name="SerialNo'. $StartAddingAt .'" value="' .$Bundle->BundleRef.'" size="21" maxlength="20" /></td>'; 103 104 /*if the item is controlled not serialised - batch quantity required so just enter bundle refs 105 into the form for entry of quantities manually */ 106 107 if ($LineItem->Serialised==1){ 108 echo '<input type="hidden" name="Qty' . $StartAddingAt .'" value="1" /></TR>'; 109 } else if ($LineItem->Serialised==0 and $Perishable==1) { 110 echo '<td><input type="text" class="number" name="Qty' . $StartAddingAt .'" size="11" value="'. locale_number_format($Bundle->BundleQty, $LineItem->DecimalPlaces). '" maxlength="10" /></td><td><input type="text" name="ExpiryDate' . $StartAddingAt . '" size="11" value="' . $Bundle->ExpiryDate . '" class="date" maxlength="10" /></td></tr>'; 111 } else { 112 echo '<td><input type="text" class="number" name="Qty' . $StartAddingAt .'" size="11" value="'. locale_number_format($Bundle->BundleQty, $LineItem->DecimalPlaces). '" maxlength="10" /></tr>'; 113 } 114 115 $StartAddingAt++; 116 } 117} 118 119for ($i=0;$i < 10;$i++){ 120 121 echo '<tr> 122 <td valign="top"><input type="text" name="SerialNo'. ($StartAddingAt+$i) .'" size="21" maxlength="20" /></td>'; 123 124 /*if the item is controlled not serialised - batch quantity required so just enter bundle refs 125 into the form for entry of quantities manually */ 126 127 if ($LineItem->Serialised==1){ 128 if ($Perishable==0) { 129 echo '<input type="hidden" name="Qty' . ($StartAddingAt+$i) .'" value="1" /> 130 </tr>'; 131 } else { 132 echo '<td><input type="hidden" name="Qty' . ($StartAddingAt+$i) .'" value="1" /> 133 <input type="text" class="date" name="ExpiryDate' . ($StartAddingAt+$i) .'" size="11" value="" maxlength="10" /></td> 134 </tr>'; 135 } 136 } else if ($LineItem->Serialised==0 and $Perishable==1) { 137 echo '<td><input type="text" class="number" name="Qty' . ($StartAddingAt+$i) .'" size="11" maxlength="10" /></td> 138 <td><input type="text" class="date" name="ExpiryDate' . ($StartAddingAt+$i) .'" size="11" value="" maxlength="10" /></td> 139 </tr>'; 140 } else { 141 echo '<td><input type="text" class="number" name="Qty' . ($StartAddingAt+$i) .'" size="11" maxlength="10" /></td></tr>'; 142 } 143} 144 145echo '</table> 146 <br /> 147 <div class="centre"> 148 <input type="submit" name="AddBatches" value="'. _('Enter'). '" /> 149 </div> 150 </div> 151 </form> 152 </td> 153 <td valign="top">'; 154 155if ($ShowExisting){ 156 include('includes/InputSerialItemsExisting.php'); 157} 158echo '</td> 159 </tr> 160 </table> 161 <script type="text/javascript"> 162//<![CDATA[ 163document.Ga6uF5Wa.SerialNo0.focus(); 164//]]> 165</script>'; /*end of nested table */ 166?>